Mesa (staging/22.0): zink: always invalidate streamout counter buffer if not resuming

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Mar 3 22:21:55 UTC 2022


Module: Mesa
Branch: staging/22.0
Commit: 29822cf29af228b55568e98a33358565d2692d20
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=29822cf29af228b55568e98a33358565d2692d20

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Thu Feb 10 14:30:25 2022 -0500

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 <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15020>
(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++;



More information about the mesa-commit mailing list