Missing pipeline barriers from fragment variants of dEQP-VK.subgroups.*
authorPanagiotis Apostolou <panagiotis.apostolou@arm.com>
Mon, 26 Mar 2018 11:21:26 +0000 (13:21 +0200)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Tue, 24 Apr 2018 13:51:15 +0000 (09:51 -0400)
This commit adds a missing image pipeline barrier in the fragment variant
of the subgroups test group. After the end of the renderpass and before the
vkCmdCopyImageToBuffer, a pipeline barrier is required to delay the copy
command so that all the writes to the color attachment are complete.

Tests affected:
dEQP-VK.subgroups.*

Components: Vulkan

VK-GL-CTS issue: 1135

Change-Id: I82a5179f97cf4435f96dd378f123f37bc26bd082

external/vulkancts/modules/vulkan/subgroups/vktSubgroupsTestsUtils.cpp

index 11490d7..410089f 100644 (file)
@@ -2528,8 +2528,21 @@ tcu::TestStatus vkt::subgroups::makeFragmentTest(
 
                        vk::VkBufferImageCopy region = {0, 0, 0,
                                {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1}, {0, 0, 0},
-                               {width, height, 1}
-                       };
+                               {width, height, 1}};
+
+                       const vk::VkImageSubresourceRange subresourceRange = {
+                               VK_IMAGE_ASPECT_COLOR_BIT, 0u, 1u, 0u, 1u};
+
+                       const VkImageMemoryBarrier prepareForTransferBarrier = makeImageMemoryBarrier(
+                                                                                                                                       VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, VK_ACCESS_TRANSFER_READ_BIT,
+                                                                                                                                       VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
+                                                                                                                                       resultImage.getImage(), subresourceRange);
+
+                       context.getDeviceInterface().cmdPipelineBarrier(*cmdBuffer,
+                                       VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT,
+                                       (VkDependencyFlags)0, 0u, (const VkMemoryBarrier*)DE_NULL, 0u,
+                                       (const VkBufferMemoryBarrier*)DE_NULL, 1u, &prepareForTransferBarrier);
+
                        context.getDeviceInterface().cmdCopyImageToBuffer(*cmdBuffer,
                                        resultImage.getImage(), VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
                                        resultBuffer.getBuffer(), 1, &region);