From 9603f3bd01c09d6436ec9c802936989d215e4085 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 11 May 2021 10:34:40 -0400 Subject: [PATCH] zink: make image_bind_count work for buffers Reviewed-by: Dave Airlie Part-of: --- src/gallium/drivers/zink/zink_context.c | 6 ++---- src/gallium/drivers/zink/zink_resource.h | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index 708aed3..22b0ea1 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -1189,11 +1189,9 @@ unbind_shader_image_counts(struct zink_context *ctx, struct zink_resource *res, update_res_bind_count(ctx, res, is_compute, true); if (writable) res->write_bind_count[is_compute]--; - if (res->obj->is_buffer) - return; res->image_bind_count[is_compute]--; /* if this was the last image bind, the sampler bind layouts must be updated */ - if (!res->image_bind_count[is_compute] && res->bind_count[is_compute]) + if (!res->obj->is_buffer && !res->image_bind_count[is_compute] && res->bind_count[is_compute]) update_binds_for_samplerviews(ctx, res, is_compute); } @@ -1272,6 +1270,7 @@ zink_set_shader_images(struct pipe_context *pctx, if (image_view->base.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) { image_view->buffer_view = get_buffer_view(ctx, res, images[i].format, images[i].u.buf.offset, images[i].u.buf.size); assert(image_view->buffer_view); @@ -1289,7 +1288,6 @@ zink_set_shader_images(struct pipe_context *pctx, tmpl.u.tex.last_layer = images[i].u.tex.last_layer; image_view->surface = zink_surface(pctx->create_surface(pctx, &res->base.b, &tmpl)); assert(image_view->surface); - res->image_bind_count[p_stage == PIPE_SHADER_COMPUTE]++; /* if this is the first image bind and there are sampler binds, the image's sampler layout * must be updated to GENERAL */ diff --git a/src/gallium/drivers/zink/zink_resource.h b/src/gallium/drivers/zink/zink_resource.h index bd44789..4988beb 100644 --- a/src/gallium/drivers/zink/zink_resource.h +++ b/src/gallium/drivers/zink/zink_resource.h @@ -115,10 +115,10 @@ struct zink_resource { VkImageAspectFlags aspect; bool optimal_tiling; uint8_t fb_binds; - uint16_t image_bind_count[2]; //gfx, compute }; }; uint32_t sampler_binds[PIPE_SHADER_TYPES]; + uint16_t image_bind_count[2]; //gfx, compute uint16_t write_bind_count[2]; //gfx, compute uint16_t bind_count[2]; //gfx, compute -- 2.7.4