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

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>

---

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

diff --git a/src/gallium/drivers/zink/zink_context.c 
b/src/gallium/drivers/zink/zink_context.c
index ac80f5a805e..ecb0df68036 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -4774,7 +4774,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) {
@@ -4788,7 +4788,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