[Mesa-dev] [PATCH 1/2] radv: always use view format when performing subpass resolves
Samuel Pitoiset
samuel.pitoiset at gmail.com
Wed May 29 06:43:33 UTC 2019
On 5/29/19 2:00 AM, Bas Nieuwenhuizen wrote:
> Don't you also need to change it in the pipeline selection? (e.g. your
> newly added radv_get_resolve_pipeline())
Good catch.
I will update radv_get_resolve_pipeline() and push, thanks!
>
> Otherwise r-b for the eries.
>
> On Tue, May 28, 2019 at 11:02 AM Samuel Pitoiset
> <samuel.pitoiset at gmail.com> wrote:
>> It makes sense to use the image view formats when resolving
>> inside subpasses, while we have to use the image formats for
>> normal resolves.
>>
>> Original patch by Philip Rebohle.
>>
>> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110348
>> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
>> ---
>> src/amd/vulkan/radv_meta.h | 2 ++
>> src/amd/vulkan/radv_meta_resolve.c | 9 ++++++---
>> src/amd/vulkan/radv_meta_resolve_cs.c | 8 ++++++--
>> 3 files changed, 14 insertions(+), 5 deletions(-)
>>
>> diff --git a/src/amd/vulkan/radv_meta.h b/src/amd/vulkan/radv_meta.h
>> index 0bd75d6c207..4a7c37be9b3 100644
>> --- a/src/amd/vulkan/radv_meta.h
>> +++ b/src/amd/vulkan/radv_meta.h
>> @@ -183,8 +183,10 @@ void radv_expand_fmask_image_inplace(struct radv_cmd_buffer *cmd_buffer,
>>
>> void radv_meta_resolve_compute_image(struct radv_cmd_buffer *cmd_buffer,
>> struct radv_image *src_image,
>> + VkFormat src_format,
>> VkImageLayout src_image_layout,
>> struct radv_image *dest_image,
>> + VkFormat dest_format,
>> VkImageLayout dest_image_layout,
>> uint32_t region_count,
>> const VkImageResolve *regions);
>> diff --git a/src/amd/vulkan/radv_meta_resolve.c b/src/amd/vulkan/radv_meta_resolve.c
>> index 1544513a9bc..b4551a98637 100644
>> --- a/src/amd/vulkan/radv_meta_resolve.c
>> +++ b/src/amd/vulkan/radv_meta_resolve.c
>> @@ -439,8 +439,10 @@ void radv_CmdResolveImage(
>> if (resolve_method == RESOLVE_COMPUTE) {
>> radv_meta_resolve_compute_image(cmd_buffer,
>> src_image,
>> + src_image->vk_format,
>> src_image_layout,
>> dest_image,
>> + dest_image->vk_format,
>> dest_image_layout,
>> region_count, regions);
>> return;
>> @@ -658,7 +660,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 *dest_iview = cmd_buffer->state.framebuffer->attachments[dest_att.attachment].attachment;
>> + struct radv_image *dst_img = dest_iview->image;
>>
>> if (radv_image_has_dcc(dst_img)) {
>> radv_initialize_dcc(cmd_buffer, dst_img, 0xffffffff);
>> @@ -673,14 +676,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(dest_iview->vk_format));
>> if (ret != VK_SUCCESS) {
>> cmd_buffer->record_result = ret;
>> continue;
>> }
>>
>> emit_resolve(cmd_buffer,
>> - dst_img->vk_format,
>> + dest_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 67df4800023..506e4139e93 100644
>> --- a/src/amd/vulkan/radv_meta_resolve_cs.c
>> +++ b/src/amd/vulkan/radv_meta_resolve_cs.c
>> @@ -413,8 +413,10 @@ emit_resolve(struct radv_cmd_buffer *cmd_buffer,
>>
>> void radv_meta_resolve_compute_image(struct radv_cmd_buffer *cmd_buffer,
>> struct radv_image *src_image,
>> + VkFormat src_format,
>> VkImageLayout src_image_layout,
>> struct radv_image *dest_image,
>> + VkFormat dest_format,
>> VkImageLayout dest_image_layout,
>> uint32_t region_count,
>> const VkImageResolve *regions)
>> @@ -460,7 +462,7 @@ void radv_meta_resolve_compute_image(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_format,
>> .subresourceRange = {
>> .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
>> .baseMipLevel = region->srcSubresource.mipLevel,
>> @@ -476,7 +478,7 @@ void radv_meta_resolve_compute_image(struct radv_cmd_buffer *cmd_buffer,
>> .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
>> .image = radv_image_to_handle(dest_image),
>> .viewType = radv_meta_get_view_type(dest_image),
>> - .format = vk_to_non_srgb_format(dest_image->vk_format),
>> + .format = vk_to_non_srgb_format(dest_format),
>> .subresourceRange = {
>> .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
>> .baseMipLevel = region->dstSubresource.mipLevel,
>> @@ -544,8 +546,10 @@ radv_cmd_buffer_resolve_subpass_cs(struct radv_cmd_buffer *cmd_buffer)
>>
>> radv_meta_resolve_compute_image(cmd_buffer,
>> src_iview->image,
>> + src_iview->vk_format,
>> src_att.layout,
>> dst_iview->image,
>> + dst_iview->vk_format,
>> dst_att.layout,
>> 1, ®ion);
>> }
>> --
>> 2.21.0
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list