diff options
author | Alex Smith <asmith@feralinteractive.com> | 2018-03-12 14:30:05 +0000 |
---|---|---|
committer | Alex Smith <asmith@feralinteractive.com> | 2018-03-14 09:59:21 +0000 |
commit | fcf267ba087dd00c48ceaf9277424dac079f9319 (patch) | |
tree | 27457c660bc5e625e75dae885c6c26eaed39cb1c | |
parent | 38f34117dd11ec92e9fda0157b52fa215e310275 (diff) |
radv: Fix CmdCopyImage between uncompressed and compressed images
From the spec:
"When copying between compressed and uncompressed formats the
extent members represent the texel dimensions of the source
image and not the destination."
However, as per 7b890a36, we must still use the destination image type
when clamping the extent so that we copy the correct number of layers
for 2D to 3D copies.
Fixes: 7b890a36 "radv: Fix vkCmdCopyImage for 2d slices into 3d Images"
Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Alex Smith <asmith@feralinteractive.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
-rw-r--r-- | src/amd/vulkan/radv_meta_copy.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/amd/vulkan/radv_meta_copy.c b/src/amd/vulkan/radv_meta_copy.c index 2a3faa64f1..a0ef18ee70 100644 --- a/src/amd/vulkan/radv_meta_copy.c +++ b/src/amd/vulkan/radv_meta_copy.c @@ -37,10 +37,11 @@ meta_image_block_size(const struct radv_image *image) */ static struct VkExtent3D meta_region_extent_el(const struct radv_image *image, + const VkImageType imageType, const struct VkExtent3D *extent) { const VkExtent3D block = meta_image_block_size(image); - return radv_sanitize_image_extent(image->type, (VkExtent3D) { + return radv_sanitize_image_extent(imageType, (VkExtent3D) { .width = DIV_ROUND_UP(extent->width , block.width), .height = DIV_ROUND_UP(extent->height, block.height), .depth = DIV_ROUND_UP(extent->depth , block.depth), @@ -146,11 +147,11 @@ meta_copy_buffer_to_image(struct radv_cmd_buffer *cmd_buffer, pRegions[r].bufferImageHeight : pRegions[r].imageExtent.height, }; const VkExtent3D buf_extent_el = - meta_region_extent_el(image, &bufferExtent); + meta_region_extent_el(image, image->type, &bufferExtent); /* Start creating blit rect */ const VkExtent3D img_extent_el = - meta_region_extent_el(image, &pRegions[r].imageExtent); + meta_region_extent_el(image, image->type, &pRegions[r].imageExtent); struct radv_meta_blit2d_rect rect = { .width = img_extent_el.width, .height = img_extent_el.height, @@ -259,11 +260,11 @@ meta_copy_image_to_buffer(struct radv_cmd_buffer *cmd_buffer, pRegions[r].bufferImageHeight : pRegions[r].imageExtent.height, }; const VkExtent3D buf_extent_el = - meta_region_extent_el(image, &bufferExtent); + meta_region_extent_el(image, image->type, &bufferExtent); /* Start creating blit rect */ const VkExtent3D img_extent_el = - meta_region_extent_el(image, &pRegions[r].imageExtent); + meta_region_extent_el(image, image->type, &pRegions[r].imageExtent); struct radv_meta_blit2d_rect rect = { .width = img_extent_el.width, .height = img_extent_el.height, @@ -408,8 +409,18 @@ meta_copy_image(struct radv_cmd_buffer *cmd_buffer, meta_region_offset_el(dest_image, &pRegions[r].dstOffset); const VkOffset3D src_offset_el = meta_region_offset_el(src_image, &pRegions[r].srcOffset); + + /* + * From Vulkan 1.0.68, "Copying Data Between Images": + * "When copying between compressed and uncompressed formats + * the extent members represent the texel dimensions of the + * source image and not the destination." + * However, we must use the destination image type to avoid + * clamping depth when copying multiple layers of a 2D image to + * a 3D image. + */ const VkExtent3D img_extent_el = - meta_region_extent_el(dest_image, &pRegions[r].extent); + meta_region_extent_el(src_image, dest_image->type, &pRegions[r].extent); /* Start creating blit rect */ struct radv_meta_blit2d_rect rect = { |