Mesa (main): zink: always invalidate streamout counter buffer if not resuming

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Feb 15 03:44:53 UTC 2022


Module: Mesa
Branch: main
Commit: e8ba9cee270417af29f2399ada05c2d104f1dc58
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e8ba9cee270417af29f2399ada05c2d104f1dc58

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>

---

 src/gallium/drivers/zink/zink_context.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c
index f86d5e1f2a7..d317350e3cc 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -3620,6 +3620,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]) {
@@ -3639,14 +3644,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