From 747d9357daa60b37bd63292025892569626df9ea Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Sun, 7 Apr 2019 22:50:02 +0200 Subject: [PATCH] radv: Use view format when resolving subpass on the cs/hw paths Otherwise, the HW path breaks completely if the view format is not the same as the image format, and the CS path produces unexpected results. The FS path works correctly. --- src/amd/vulkan/radv_meta_resolve.c | 7 ++++--- src/amd/vulkan/radv_meta_resolve_cs.c | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/amd/vulkan/radv_meta_resolve.c b/src/amd/vulkan/radv_meta_resolve.c index fa441285371..2b76f58ada0 100644 --- a/src/amd/vulkan/radv_meta_resolve.c +++ b/src/amd/vulkan/radv_meta_resolve.c @@ -663,7 +663,8 @@ radv_cmd_buffer_resolve_subpass(struct radv_cmd_buffer *cmd_buffer) if (dest_att.attachment == VK_ATTACHMENT_UNUSED) continue; - struct radv_image *dst_img = cmd_buffer->state.framebuffer->attachments[dest_att.attachment].attachment->image; + struct radv_image_view *dst_iview = cmd_buffer->state.framebuffer->attachments[dest_att.attachment].attachment; + struct radv_image *dst_img = dst_iview->image; if (radv_image_has_dcc(dst_img)) { radv_initialize_dcc(cmd_buffer, dst_img, 0xffffffff); @@ -678,14 +679,14 @@ radv_cmd_buffer_resolve_subpass(struct radv_cmd_buffer *cmd_buffer) radv_cmd_buffer_set_subpass(cmd_buffer, &resolve_subpass); - VkResult ret = build_resolve_pipeline(cmd_buffer->device, radv_format_meta_fs_key(dst_img->vk_format)); + VkResult ret = build_resolve_pipeline(cmd_buffer->device, radv_format_meta_fs_key(dst_iview->vk_format)); if (ret != VK_SUCCESS) { cmd_buffer->record_result = ret; continue; } emit_resolve(cmd_buffer, - dst_img->vk_format, + dst_iview->vk_format, &(VkOffset2D) { 0, 0 }, &(VkExtent2D) { fb->width, fb->height }); } diff --git a/src/amd/vulkan/radv_meta_resolve_cs.c b/src/amd/vulkan/radv_meta_resolve_cs.c index e56df7f8a59..cb08798e60c 100644 --- a/src/amd/vulkan/radv_meta_resolve_cs.c +++ b/src/amd/vulkan/radv_meta_resolve_cs.c @@ -531,7 +531,7 @@ radv_cmd_buffer_resolve_subpass_cs(struct radv_cmd_buffer *cmd_buffer) .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO, .image = radv_image_to_handle(src_image), .viewType = radv_meta_get_view_type(src_image), - .format = src_image->vk_format, + .format = src_iview->vk_format, .subresourceRange = { .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT, .baseMipLevel = src_iview->base_mip, @@ -547,7 +547,7 @@ radv_cmd_buffer_resolve_subpass_cs(struct radv_cmd_buffer *cmd_buffer) .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO, .image = radv_image_to_handle(dst_image), .viewType = radv_meta_get_view_type(dst_image), - .format = vk_to_non_srgb_format(dst_image->vk_format), + .format = vk_to_non_srgb_format(dst_iview->vk_format), .subresourceRange = { .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT, .baseMipLevel = dst_iview->base_mip, -- 2.21.0