From 790f6e47182d4f1b1b85b449f29b6fdd4954074f Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Fri, 13 Apr 2018 19:14:46 +0200 Subject: [PATCH] radv: clean up radv_handle_image_transition() a bit Signed-off-by: Samuel Pitoiset Reviewed-by: Bas Niuwenhuizen --- src/amd/vulkan/radv_cmd_buffer.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c index 270dcd5a9e0..a74bad19817 100644 --- a/src/amd/vulkan/radv_cmd_buffer.c +++ b/src/amd/vulkan/radv_cmd_buffer.c @@ -3718,6 +3718,9 @@ static void radv_handle_depth_image_transition(struct radv_cmd_buffer *cmd_buffe const VkImageSubresourceRange *range, VkImageAspectFlags pending_clears) { + if (!radv_image_has_htile(image)) + return; + if (dst_layout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL && (pending_clears & vk_format_aspects(image->vk_format)) == vk_format_aspects(image->vk_format) && cmd_buffer->state.render_area.offset.x == 0 && cmd_buffer->state.render_area.offset.y == 0 && @@ -3867,18 +3870,24 @@ static void radv_handle_image_transition(struct radv_cmd_buffer *cmd_buffer, return; } - unsigned src_queue_mask = radv_image_queue_family_mask(image, src_family, cmd_buffer->queue_family_index); - unsigned dst_queue_mask = radv_image_queue_family_mask(image, dst_family, cmd_buffer->queue_family_index); + unsigned src_queue_mask = + radv_image_queue_family_mask(image, src_family, + cmd_buffer->queue_family_index); + unsigned dst_queue_mask = + radv_image_queue_family_mask(image, dst_family, + cmd_buffer->queue_family_index); - if (radv_image_has_htile(image)) - radv_handle_depth_image_transition(cmd_buffer, image, src_layout, - dst_layout, src_queue_mask, - dst_queue_mask, range, - pending_clears); - - radv_handle_color_image_transition(cmd_buffer, image, src_layout, - dst_layout, src_queue_mask, - dst_queue_mask, range); + if (vk_format_is_depth(image->vk_format)) { + radv_handle_depth_image_transition(cmd_buffer, image, + src_layout, dst_layout, + src_queue_mask, dst_queue_mask, + range, pending_clears); + } else { + radv_handle_color_image_transition(cmd_buffer, image, + src_layout, dst_layout, + src_queue_mask, dst_queue_mask, + range); + } } void radv_CmdPipelineBarrier( -- 2.30.2