Mesa (main): zink: handle rebinds for vertex buffers

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon May 31 14:46:38 UTC 2021


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

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Sat Jan 30 09:06:25 2021 -0500

zink: handle rebinds for vertex buffers

now that the tracking info is there, it's easy to make this happen

Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10997>

---

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

diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c
index 73c63354dfa..7a1b4762a8c 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -2881,6 +2881,8 @@ zink_rebind_framebuffer(struct zink_context *ctx, struct zink_resource *res)
 static void
 rebind_buffer(struct zink_context *ctx, struct zink_resource *res)
 {
+   bool did_ref = false;
+
    for (unsigned shader = 0; shader < PIPE_SHADER_TYPES; shader++) {
       if (!(res->bind_stages & (1 << shader)))
          continue;
@@ -2958,9 +2960,16 @@ rebind_buffer(struct zink_context *ctx, struct zink_resource *res)
                access |= VK_ACCESS_SHADER_WRITE_BIT;
             zink_resource_buffer_barrier(ctx, NULL, res, access,
                                          zink_pipeline_flags_from_stage(zink_shader_stage(shader)));
+            did_ref = true;
          }
       }
    }
+   if (!res->vbo_bind_count)
+      return;
+   if (!did_ref)
+      zink_batch_reference_resource_rw(&ctx->batch, res, false);
+   zink_resource_buffer_barrier(ctx, NULL, res, VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT,
+                                VK_PIPELINE_STAGE_VERTEX_INPUT_BIT);
 }
 
 static bool



More information about the mesa-commit mailing list