Validation errors fix in copying 3d images
authorMarcin Rogucki <marcin.rogucki@mobica.com>
Thu, 18 Jan 2018 09:55:07 +0000 (10:55 +0100)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Fri, 2 Mar 2018 09:42:54 +0000 (04:42 -0500)
A minor chages to fix validation errors.
Two tests are not passing currently!

Affected tests:
dEQP-VK.api.copy_and_blit.dedicated_allocation.image_to_image.3d_images.*

Components: Vulkan

VK-GL-CTS issue: 208

Change-Id: Id3c5ec869d52db6b1229f45bbeacf24e35e75e48
(cherry picked from commit c23ba94d7978ba84f9ffd2e75b6afbf8e3395633)

external/vulkancts/modules/vulkan/api/vktApiCopiesAndBlittingTests.cpp

index d446c66dbd66c62751d160eb2ee38df51bb225a3..0392f3aa67c1e2acab384242c176e374ac931145 100644 (file)
@@ -943,6 +943,7 @@ tcu::TestStatus CopyImageToImage::iterate (void)
 {
        const tcu::TextureFormat        srcTcuFormat            = mapVkFormat(m_params.src.image.format);
        const tcu::TextureFormat        dstTcuFormat            = mapVkFormat(m_params.dst.image.format);
+
        m_sourceTextureLevel = de::MovePtr<tcu::TextureLevel>(new tcu::TextureLevel(srcTcuFormat,
                                                                                                                                                                (int)m_params.src.image.extent.width,
                                                                                                                                                                (int)m_params.src.image.extent.height,
@@ -964,7 +965,10 @@ tcu::TestStatus CopyImageToImage::iterate (void)
 
        std::vector<VkImageCopy>        imageCopies;
        for (deUint32 i = 0; i < m_params.regions.size(); i++)
-               imageCopies.push_back(m_params.regions[i].imageCopy);
+       {
+               const VkImageCopy& ic = m_params.regions[i].imageCopy;
+               imageCopies.push_back(ic);
+       }
 
        const VkImageMemoryBarrier      imageBarriers[]         =
        {
@@ -1018,7 +1022,7 @@ tcu::TestStatus CopyImageToImage::iterate (void)
 
        VK_CHECK(vk.beginCommandBuffer(*m_cmdBuffer, &cmdBufferBeginInfo));
        vk.cmdPipelineBarrier(*m_cmdBuffer, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, (VkDependencyFlags)0, 0, (const VkMemoryBarrier*)DE_NULL, 0, (const VkBufferMemoryBarrier*)DE_NULL, DE_LENGTH_OF_ARRAY(imageBarriers), imageBarriers);
-       vk.cmdCopyImage(*m_cmdBuffer, m_source.get(), m_params.src.image.operationLayout, m_destination.get(), m_params.dst.image.operationLayout, (deUint32)m_params.regions.size(), imageCopies.data());
+       vk.cmdCopyImage(*m_cmdBuffer, m_source.get(), m_params.src.image.operationLayout, m_destination.get(), m_params.dst.image.operationLayout, (deUint32)imageCopies.size(), imageCopies.data());
        VK_CHECK(vk.endCommandBuffer(*m_cmdBuffer));
 
        submitCommandsAndWait (vk, vkDevice, queue, *m_cmdBuffer);
@@ -1120,7 +1124,10 @@ void CopyImageToImage::copyRegionToTextureLevel (tcu::ConstPixelBufferAccess src
        VkExtent3D      extent          = region.imageCopy.extent;
 
        if (m_params.src.image.imageType == VK_IMAGE_TYPE_3D && m_params.dst.image.imageType == VK_IMAGE_TYPE_2D)
+       {
                dstOffset.z = srcOffset.z;
+               extent.depth = std::max(region.imageCopy.extent.depth, region.imageCopy.dstSubresource.layerCount);
+       }
        if (m_params.src.image.imageType == VK_IMAGE_TYPE_2D && m_params.dst.image.imageType == VK_IMAGE_TYPE_3D)
        {
                srcOffset.z = dstOffset.z;
@@ -4905,7 +4912,6 @@ void addImageToImage3dImagesTests (tcu::TestCaseGroup* group, AllocationKind all
                params3DTo2D.dst.image.operationLayout  = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
                params3DTo2D.allocationKind                             = allocationKind;
 
-               for (deUint32 slicesLayersNdx = 0; slicesLayersNdx < slicesLayers; ++slicesLayersNdx)
                {
                        const VkImageSubresourceLayers  sourceLayer     =
                        {
@@ -4978,7 +4984,7 @@ void addImageToImage3dImagesTests (tcu::TestCaseGroup* group, AllocationKind all
                                {0, 0, 0},                                              // VkOffset3D                           srcOffset;
                                destinationLayer,                               // VkImageSubresourceLayers     dstSubresource;
                                {0, 0, 0},                                              // VkOffset3D                           dstOffset;
-                               params2DTo3D.dst.image.extent,  // VkExtent3D                           extent;
+                               params2DTo3D.src.image.extent,  // VkExtent3D                           extent;
                        };
 
                        CopyRegion      imageCopy;