From 8a345adf208c46c3a551500015a432f11358ef44 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Fri, 16 Apr 2021 10:21:39 -0400 Subject: zink: use bind counts to more accurately determine image descriptor's exact layout Reviewed-by: Dave Airlie Part-of: --- src/gallium/drivers/zink/zink_context.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index 1c26e599940..db7ef943e39 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -360,13 +360,13 @@ zink_create_sampler_state(struct pipe_context *pctx, } ALWAYS_INLINE static VkImageLayout -get_layout_for_binding(struct zink_resource *res, enum zink_descriptor_type type) +get_layout_for_binding(struct zink_resource *res, enum zink_descriptor_type type, bool is_compute) { if (res->obj->is_buffer) return 0; switch (type) { case ZINK_DESCRIPTOR_TYPE_SAMPLER_VIEW: - return res->bind_history & BITFIELD64_BIT(ZINK_DESCRIPTOR_TYPE_IMAGE) ? + return res->image_bind_count[is_compute] ? VK_IMAGE_LAYOUT_GENERAL : res->aspect & (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT) ? //Vulkan-Docs#1490 @@ -469,7 +469,7 @@ update_descriptor_state(struct zink_context *ctx, enum pipe_shader_type shader, ctx->di.sampler_surfaces[shader][slot].is_buffer = true; } else { struct zink_surface *surface = get_imageview_for_binding(ctx, shader, type, slot); - ctx->di.textures[shader][slot].imageLayout = get_layout_for_binding(res, type); + ctx->di.textures[shader][slot].imageLayout = get_layout_for_binding(res, type, shader == PIPE_SHADER_COMPUTE); ctx->di.textures[shader][slot].imageView = surface->image_view; ctx->di.sampler_surfaces[shader][slot].surface = surface; ctx->di.sampler_surfaces[shader][slot].is_buffer = false; @@ -496,7 +496,7 @@ update_descriptor_state(struct zink_context *ctx, enum pipe_shader_type shader, ctx->di.image_surfaces[shader][slot].is_buffer = true; } else { struct zink_surface *surface = get_imageview_for_binding(ctx, shader, type, slot); - ctx->di.images[shader][slot].imageLayout = get_layout_for_binding(res, type); + ctx->di.images[shader][slot].imageLayout = VK_IMAGE_LAYOUT_GENERAL; ctx->di.images[shader][slot].imageView = surface->image_view; ctx->di.image_surfaces[shader][slot].surface = surface; ctx->di.image_surfaces[shader][slot].is_buffer = false; -- cgit v1.2.3