From 29822cf29af228b55568e98a33358565d2692d20 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Thu, 10 Feb 2022 14:30:25 -0500 Subject: [PATCH] zink: always invalidate streamout counter buffer if not resuming this otherwise treates begin/end/begin the same as begin/pause/resume cc: mesa-stable fixes: KHR-GL46.texture_view.view_classes KHR-GL46.transform_feedback.capture_geometry_separate_test KHR-GL46.transform_feedback.capture_vertex_separate_test KHR-GL46.transform_feedback.query_geometry_separate_test KHR-GL46.transform_feedback.query_vertex_separate_test Reviewed-by: Dave Airlie Part-of: (cherry picked from commit e8ba9cee270417af29f2399ada05c2d104f1dc58) --- .pick_status.json | 2 +- src/gallium/drivers/zink/zink_context.c | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index ae8139ede3f..565ec1c6332 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -4747,7 +4747,7 @@ "description": "zink: always invalidate streamout counter buffer if not resuming", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null }, diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index 8ba6fcbdea4..c645a6d13ed 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -3613,6 +3613,11 @@ zink_set_stream_output_targets(struct pipe_context *pctx, { struct zink_context *ctx = zink_context(pctx); + /* always set counter_buffer_valid=false on unbind: + * - on resume (indicated by offset==-1), set counter_buffer_valid=true + * - otherwise the counter buffer is invalidated + */ + if (num_targets == 0) { for (unsigned i = 0; i < ctx->num_so_targets; i++) { if (ctx->so_targets[i]) { @@ -3632,14 +3637,16 @@ zink_set_stream_output_targets(struct pipe_context *pctx, if (!t) continue; struct zink_resource *res = zink_resource(t->counter_buffer); - if (offsets[0] == (unsigned)-1) + if (offsets[0] == (unsigned)-1) { ctx->xfb_barrier |= zink_resource_buffer_needs_barrier(res, VK_ACCESS_TRANSFORM_FEEDBACK_COUNTER_READ_BIT_EXT, VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT); - else + } else { ctx->xfb_barrier |= zink_resource_buffer_needs_barrier(res, VK_ACCESS_TRANSFORM_FEEDBACK_COUNTER_WRITE_BIT_EXT, VK_PIPELINE_STAGE_TRANSFORM_FEEDBACK_BIT_EXT); + t->counter_buffer_valid = false; + } struct zink_resource *so = zink_resource(ctx->so_targets[i]->buffer); if (so) { so->so_bind_count++;