Module: Mesa
Branch: staging/23.2
Commit: 24e51fa0ff5c2840b83ec4baf5cffc4d595c29c9
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=24e51fa0ff5c2840b83ec4baf5cffc4d595c29c9

Author: Mike Blumenkrantz <[email protected]>
Date:   Mon Sep 25 15:30:11 2023 -0400

zink: fix crashing in image rebinds

this is invalid for buffer textures

cc: mesa-stable

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25379>
(cherry picked from commit c3f5416eaf3c080856b369632a1987511e214a46)

---

 .pick_status.json                       | 2 +-
 src/gallium/drivers/zink/zink_context.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 47ce4d9fe28..05894b7bcba 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -1484,7 +1484,7 @@
         "description": "zink: fix crashing in image rebinds",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": null,
         "notes": null
diff --git a/src/gallium/drivers/zink/zink_context.c 
b/src/gallium/drivers/zink/zink_context.c
index 4b2f9a26153..2c2401bd1b9 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -4733,7 +4733,7 @@ zink_rebind_all_images(struct zink_context *ctx)
     for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
       for (unsigned j = 0; j < ctx->di.num_sampler_views[i]; j++) {
          struct zink_sampler_view *sv = 
zink_sampler_view(ctx->sampler_views[i][j]);
-         if (!sv)
+         if (!sv || sv->image_view->base.texture->target == PIPE_BUFFER)
             continue;
          struct zink_resource *res = 
zink_resource(sv->image_view->base.texture);
          if (res->obj != sv->image_view->obj) {
@@ -4747,7 +4747,7 @@ zink_rebind_all_images(struct zink_context *ctx)
       for (unsigned j = 0; j < ctx->di.num_images[i]; j++) {
          struct zink_image_view *image_view = &ctx->image_views[i][j];
          struct zink_resource *res = zink_resource(image_view->base.resource);
-         if (!res)
+         if (!res || res->base.b.target == PIPE_BUFFER)
             continue;
          if (ctx->image_views[i][j].surface->obj != res->obj) {
             zink_surface_reference(zink_screen(ctx->base.screen), 
&image_view->surface, NULL);

Reply via email to