From 9fe7d4753721d10235cbf38194cf7c8cf2eb7d19 Mon Sep 17 00:00:00 2001 From: Panagiotis Apostolou Date: Thu, 7 Sep 2017 13:54:51 +0200 Subject: [PATCH] Serialize region copies for YCbCr copy tests As the generated regions can overlap - force all calls of vkCmdCopyImage() to be executed sequentially by adding a pipeline barrier between each call to avoid producing undefined results. Affects: dEQP-VK.ycbcr.copy.* Components: Vulkan VK-GL-CTS issue: 716 Change-Id: Ifed67cdc077a8c03630b36f8aa59bd6dae0578a3 --- .../modules/vulkan/ycbcr/vktYCbCrCopyTests.cpp | 30 +++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/external/vulkancts/modules/vulkan/ycbcr/vktYCbCrCopyTests.cpp b/external/vulkancts/modules/vulkan/ycbcr/vktYCbCrCopyTests.cpp index 3a3df70..49c9318 100644 --- a/external/vulkancts/modules/vulkan/ycbcr/vktYCbCrCopyTests.cpp +++ b/external/vulkancts/modules/vulkan/ycbcr/vktYCbCrCopyTests.cpp @@ -809,7 +809,35 @@ tcu::TestStatus imageCopyTest (Context& context, const TestConfig config) VK_CHECK(vkd.beginCommandBuffer(*cmdBuffer, &beginInfo)); } - vkd.cmdCopyImage(*cmdBuffer, *srcImage, vk::VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, *dstImage, vk::VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, (deUint32)copies.size(), &copies[0]); + for (size_t i = 0; i < copies.size(); i++) + { + vkd.cmdCopyImage(*cmdBuffer, *srcImage, vk::VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, *dstImage, vk::VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, &copies[i]); + + const vk::VkImageMemoryBarrier preCopyBarrier = + { + vk::VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, + DE_NULL, + vk::VK_ACCESS_TRANSFER_WRITE_BIT, + vk::VK_ACCESS_TRANSFER_WRITE_BIT, + vk::VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, + vk::VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, + VK_QUEUE_FAMILY_IGNORED, + VK_QUEUE_FAMILY_IGNORED, + *dstImage, + { vk::VK_IMAGE_ASPECT_COLOR_BIT, 0u, 1u, 0u, 1u } + }; + + vkd.cmdPipelineBarrier(*cmdBuffer, + (vk::VkPipelineStageFlags)vk::VK_PIPELINE_STAGE_TRANSFER_BIT, + (vk::VkPipelineStageFlags)vk::VK_PIPELINE_STAGE_TRANSFER_BIT, + (vk::VkDependencyFlags)0u, + 0u, + (const vk::VkMemoryBarrier*)DE_NULL, + 0u, + (const vk::VkBufferMemoryBarrier*)DE_NULL, + 1u, + &preCopyBarrier); + } VK_CHECK(vkd.endCommandBuffer(*cmdBuffer)); -- 2.7.4