Add missing barrier to texel_view_compatible tests
authorMaciej Jesionowski <maciej.jesionowski@amd.com>
Mon, 23 Oct 2017 10:14:36 +0000 (12:14 +0200)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Tue, 31 Oct 2017 09:26:24 +0000 (05:26 -0400)
There was no GPU to Host barrier. GPU writes are not automatically
visible to the Host.

Affected tests: dEQP-VK.image.texel_view_compatible.compute.*
VK-GL-CTS issue: 786
Components: Vulkan

Change-Id: I47797add1c5e48dfa1a7c7be8897e822091c2044

external/vulkancts/modules/vulkan/image/vktImageCompressionTranscodingSupport.cpp

index 6ba834ea036e501ba6710636fd043ce3b419a6db..9c1345c3c3f6623c691aed3492e27251b9ed38ff 100644 (file)
@@ -1131,21 +1131,28 @@ bool BasicComputeTestInstance::decompressImage (const VkCommandBuffer&  cmdBuffer
                                                referenceImage.get(), subresourceRange)
                                };
 
-                                const VkBufferMemoryBarrier            preCopyBufferBarrier[]          =
+                               vk.cmdPipelineBarrier(cmdBuffer, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT,
+                                       (VkDependencyFlags)0, 0u, (const VkMemoryBarrier*)DE_NULL, 0u, (const VkBufferMemoryBarrier*)DE_NULL,
+                                       DE_LENGTH_OF_ARRAY(postShaderImageBarriers), postShaderImageBarriers);
+                       }
+
+                       vk.cmdCopyImageToBuffer(cmdBuffer, resultImage.get(), VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, resultBuffer.get(), 1u, &copyRegion);
+                       vk.cmdCopyImageToBuffer(cmdBuffer, referenceImage.get(), VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, referenceBuffer.get(), 1u, &copyRegion);
+
+                       {
+                               const VkBufferMemoryBarrier             postCopyBufferBarrier[]         =
                                {
-                                       makeBufferMemoryBarrier( 0, VK_BUFFER_USAGE_TRANSFER_DST_BIT,
+                                       makeBufferMemoryBarrier(VK_ACCESS_TRANSFER_WRITE_BIT, VK_ACCESS_HOST_READ_BIT,
                                                resultBuffer.get(), 0ull, bufferSize),
 
-                                       makeBufferMemoryBarrier( 0, VK_BUFFER_USAGE_TRANSFER_DST_BIT,
+                                       makeBufferMemoryBarrier(VK_ACCESS_TRANSFER_WRITE_BIT, VK_ACCESS_HOST_READ_BIT,
                                                referenceBuffer.get(), 0ull, bufferSize),
                                };
 
-                               vk.cmdPipelineBarrier(cmdBuffer, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT,
-                                       (VkDependencyFlags)0, 0u, (const VkMemoryBarrier*)DE_NULL, DE_LENGTH_OF_ARRAY(preCopyBufferBarrier), preCopyBufferBarrier,
-                                       DE_LENGTH_OF_ARRAY(postShaderImageBarriers), postShaderImageBarriers);
+                               vk.cmdPipelineBarrier(cmdBuffer, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_HOST_BIT,
+                                       (VkDependencyFlags)0, 0u, (const VkMemoryBarrier*)DE_NULL, DE_LENGTH_OF_ARRAY(postCopyBufferBarrier), postCopyBufferBarrier,
+                                       0u, (const VkImageMemoryBarrier*)DE_NULL);
                        }
-                       vk.cmdCopyImageToBuffer(cmdBuffer, resultImage.get(), VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, resultBuffer.get(), 1u, &copyRegion);
-                       vk.cmdCopyImageToBuffer(cmdBuffer, referenceImage.get(), VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, referenceBuffer.get(), 1u, &copyRegion);
                }
                endCommandBuffer(vk, cmdBuffer);
                submitCommandsAndWait(vk, device, queue, cmdBuffer);