diff options
author | Oskar Rundgren <oskar.rundgren@imgtec.com> | 2023-05-10 11:45:17 +0100 |
---|---|---|
committer | Marge Bot <emma+marge@anholt.net> | 2023-05-17 08:18:26 +0000 |
commit | 2e5fb910900dec25407177eb6dedd71a93515445 (patch) | |
tree | 6663c099d5f9644bfa039c5cacef3e4b58638e0c | |
parent | 9e91e06d452f597eb06edd05579aa5bb8b82069c (diff) | |
download | mesa-2e5fb910900dec25407177eb6dedd71a93515445.tar.gz |
pvr: Transfer image to buffer dest rect
In copy to buffer region, set dest rect to region size.
The rectangle must be block size adjusted in case of block compressed
format.
Fix test: dEQP-VK.api.copy_and_blit.core.image_to_buffer.regions
Signed-off-by: Oskar Rundgren <oskar.rundgren@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22958>
-rw-r--r-- | src/imagination/vulkan/pvr_blit.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/imagination/vulkan/pvr_blit.c b/src/imagination/vulkan/pvr_blit.c index a9dc1f3305a..bbc3c64a067 100644 --- a/src/imagination/vulkan/pvr_blit.c +++ b/src/imagination/vulkan/pvr_blit.c @@ -823,6 +823,7 @@ pvr_copy_image_to_buffer_region(struct pvr_device *device, const VkBufferImageCopy2 *region) { const VkImageAspectFlags aspect_mask = region->imageSubresource.aspectMask; + enum pipe_format pformat = vk_format_to_pipe_format(image->vk.format); VkFormat image_format = pvr_get_copy_format(image->vk.format); struct pvr_transfer_cmd_surface dst_surface = { 0 }; VkImageSubresource sub_resource; @@ -889,6 +890,14 @@ pvr_copy_image_to_buffer_region(struct pvr_device *device, dst_rect.extent.width = region->imageExtent.width; dst_rect.extent.height = region->imageExtent.height; + if (util_format_is_compressed(pformat)) { + uint32_t block_width = util_format_get_blockwidth(pformat); + uint32_t block_height = util_format_get_blockheight(pformat); + + dst_rect.extent.width = MAX2(1U, dst_rect.extent.width / block_width); + dst_rect.extent.height = MAX2(1U, dst_rect.extent.height / block_height); + } + sub_resource = (VkImageSubresource){ .aspectMask = region->imageSubresource.aspectMask, .mipLevel = region->imageSubresource.mipLevel, |