Fix image barriers in image to image copy tests
authorziga-lunarg <ziga@lunarg.com>
Sat, 17 Sep 2022 13:08:43 +0000 (15:08 +0200)
committerMatthew Netsch <quic_mnetsch@quicinc.com>
Thu, 6 Oct 2022 15:46:40 +0000 (15:46 +0000)
The same image barriers are used twice if clearDestination is used,
the oldLayout of the second barrier does not match the current layout of
the image

Components: Vulkan

VK-GL-CTS issue: 3956

Affected tests:
dEQP-VK.api.copy_and_blit.*.image_to_image.*

Change-Id: I2623e70f3d4f0b97f9f941e4e6cb2760fd2c9d74

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

index 6fc04a1..9232d99 100644 (file)
@@ -1118,7 +1118,7 @@ tcu::TestStatus CopyImageToImage::iterate (void)
                }
        }
 
-       const VkImageMemoryBarrier      imageBarriers[]         =
+       VkImageMemoryBarrier    imageBarriers[]         =
        {
                // source image
                {
@@ -1173,6 +1173,8 @@ tcu::TestStatus CopyImageToImage::iterate (void)
                clearColor.float32[2] = 1.0f;
                clearColor.float32[3] = 1.0f;
                vk.cmdClearColorImage(*m_cmdBuffer, m_destination.get(), VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, &clearColor, 1u, &range);
+               imageBarriers[0].oldLayout = imageBarriers[0].newLayout;
+               imageBarriers[1].oldLayout = imageBarriers[1].newLayout;
                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);
        }