[Mesa-dev,6/7] radv: Fix vkCmdCopyImage for 2d slices into 3d Images

Submitted by Andres Rodriguez on Jan. 27, 2017, 5:03 a.m.

Details

Message ID 20170127050308.16584-7-andresx7@gmail.com
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Andres Rodriguez Jan. 27, 2017, 5:03 a.m.
Previously the z offset of the destination image was being ignored. It
should be taken into account when copying into a 3d target.

Also, img_extent_el.depth was being incorrectly clamped to 1 due to the
source image being VK_IMAGE_TYPE_2D. This would result in the blit
failing to iterate over all the 3d slices. Instead we clamp to the
destination image type.

Fixes failures in CTS tests:
dEQP-VK.api.copy_and_blit.image_to_image.3d_images.*
---
 src/amd/vulkan/radv_meta_copy.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/src/amd/vulkan/radv_meta_copy.c b/src/amd/vulkan/radv_meta_copy.c
index 64e0ea8..7258e0c 100644
--- a/src/amd/vulkan/radv_meta_copy.c
+++ b/src/amd/vulkan/radv_meta_copy.c
@@ -369,7 +369,7 @@  meta_copy_image(struct radv_cmd_buffer *cmd_buffer,
 		const VkOffset3D src_offset_el =
 			meta_region_offset_el(src_image, &pRegions[r].srcOffset);
 		const VkExtent3D img_extent_el =
-			meta_region_extent_el(src_image, &pRegions[r].extent);
+			meta_region_extent_el(dest_image, &pRegions[r].extent);
 
 		/* Start creating blit rect */
 		struct radv_meta_blit2d_rect rect = {
@@ -377,6 +377,9 @@  meta_copy_image(struct radv_cmd_buffer *cmd_buffer,
 			.height = img_extent_el.height,
 		};
 
+		if (dest_image->type == VK_IMAGE_VIEW_TYPE_3D)
+			b_dst.layer = dst_offset_el.z;
+
 		/* Loop through each 3D or array slice */
 		unsigned num_slices_3d = img_extent_el.depth;
 		unsigned num_slices_array = pRegions[r].dstSubresource.layerCount;