From eee8db250de7ffd2a0431c5d8d0318a29fe23af4 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 5 Apr 2022 14:57:01 -0400 Subject: [PATCH] zink: delete some code in get_layout_for_binding() should be no functional changes Reviewed-by: Dave Airlie Part-of: --- src/gallium/drivers/zink/zink_context.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index 4e38cbc979c..4ff56b3aa45 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -414,22 +414,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, bool is_compute) +get_layout_for_binding(const struct zink_context *ctx, 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->image_bind_count[is_compute] ? - VK_IMAGE_LAYOUT_GENERAL : - res->aspect & (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT) ? - //Vulkan-Docs#1490 - //(res->aspect == VK_IMAGE_ASPECT_DEPTH_BIT ? VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL : - //res->aspect == VK_IMAGE_ASPECT_STENCIL_BIT ? VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL : - (res->aspect == VK_IMAGE_ASPECT_DEPTH_BIT ? VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL : - res->aspect == VK_IMAGE_ASPECT_STENCIL_BIT ? VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL : - VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL) : - VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL; + return zink_descriptor_util_image_layout_eval(ctx, res, is_compute); case ZINK_DESCRIPTOR_TYPE_IMAGE: return VK_IMAGE_LAYOUT_GENERAL; default: @@ -536,7 +527,7 @@ update_descriptor_state_sampler(struct zink_context *ctx, enum pipe_shader_type 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, shader == PIPE_SHADER_COMPUTE); + ctx->di.textures[shader][slot].imageLayout = get_layout_for_binding(ctx, 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; @@ -1249,7 +1240,7 @@ zink_set_shader_buffers(struct pipe_context *pctx, static void update_binds_for_samplerviews(struct zink_context *ctx, struct zink_resource *res, bool is_compute) { - VkImageLayout layout = get_layout_for_binding(res, ZINK_DESCRIPTOR_TYPE_SAMPLER_VIEW, is_compute); + VkImageLayout layout = get_layout_for_binding(ctx, res, ZINK_DESCRIPTOR_TYPE_SAMPLER_VIEW, is_compute); if (is_compute) { u_foreach_bit(slot, res->sampler_binds[PIPE_SHADER_COMPUTE]) { if (ctx->di.textures[PIPE_SHADER_COMPUTE][slot].imageLayout != layout) {