diff options
author | Mike Blumenkrantz <michael.blumenkrantz@gmail.com> | 2021-04-16 10:21:39 -0400 |
---|---|---|
committer | Marge Bot <eric+marge@anholt.net> | 2021-06-24 22:34:46 +0000 |
commit | 8a345adf208c46c3a551500015a432f11358ef44 (patch) | |
tree | 88c30ebebc14eee3f8e2ddcb705b6146f004b6fb | |
parent | e8a188a86e463c2eab41fc7e813663c9952e8a93 (diff) |
zink: use bind counts to more accurately determine image descriptor's exact layout
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11590>
-rw-r--r-- | src/gallium/drivers/zink/zink_context.c | 8 |
1 files 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; |