zink: fix image bind counting

these must only be incremented if the image descriptor has changed

cc: mesa-stable

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17192>
(cherry picked from commit 74dd6e69b4)
This commit is contained in:
Mike Blumenkrantz 2022-06-20 11:08:52 -04:00 committed by Dylan Baker
parent 78a64e862f
commit c426ecb276
2 changed files with 3 additions and 2 deletions

View file

@ -220,7 +220,7 @@
"description": "zink: fix image bind counting",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null
},

View file

@ -1478,12 +1478,12 @@ zink_set_shader_images(struct pipe_context *pctx,
if (images[i].access & PIPE_IMAGE_ACCESS_READ) {
access |= VK_ACCESS_SHADER_READ_BIT;
}
res->image_bind_count[p_stage == PIPE_SHADER_COMPUTE]++;
if (images[i].resource->target == PIPE_BUFFER) {
struct zink_buffer_view *bv = create_image_bufferview(ctx, &images[i]);
assert(bv);
if (image_view->buffer_view != bv) {
update_res_bind_count(ctx, res, p_stage == PIPE_SHADER_COMPUTE, false);
res->image_bind_count[p_stage == PIPE_SHADER_COMPUTE]++;
unbind_shader_image(ctx, p_stage, start_slot + i);
}
image_view->buffer_view = bv;
@ -1494,6 +1494,7 @@ zink_set_shader_images(struct pipe_context *pctx,
struct zink_surface *surface = create_image_surface(ctx, &images[i], p_stage == PIPE_SHADER_COMPUTE);
assert(surface);
if (image_view->surface != surface) {
res->image_bind_count[p_stage == PIPE_SHADER_COMPUTE]++;
update_res_bind_count(ctx, res, p_stage == PIPE_SHADER_COMPUTE, false);
unbind_shader_image(ctx, p_stage, start_slot + i);
}