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 c3f5416eaf)
This commit is contained in:
Mike Blumenkrantz 2023-09-25 15:30:11 -04:00 committed by Eric Engestrom
parent 5ab99743c0
commit 1f42a7004c
2 changed files with 3 additions and 3 deletions

View File

@ -58,7 +58,7 @@
"description": "zink: fix crashing in image rebinds",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null
},

View File

@ -4686,7 +4686,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) {
@ -4700,7 +4700,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);