Use transfer queue with vkCmdFillBuffer
authorMaciej Jesionowski <maciej.jesionowski@amd.com>
Tue, 30 May 2017 08:27:34 +0000 (10:27 +0200)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Fri, 30 Jun 2017 11:56:32 +0000 (07:56 -0400)
Due to an error in the condition, the transfer-only queue wasn't
selected for the fill buffer write operation.

Also fixed a validation error with barrier used inside a render pass
in read vertex input operation. This should have no effect on behavior.

Affects:

dEQP-VK.synchronization.op.multi_queue.*fill_buffer*
dEQP-VK.synchronization.op.*read_vertex_input*

Components: Vulkan
VK-GL-CTS issue: 481

Change-Id: Ibed24824532c0e35aba61238809f34717f431b6f
(cherry picked from commit 83af72c04b8723a33855fafc38b3f0a28537a124)

external/vulkancts/modules/vulkan/synchronization/vktSynchronizationOperation.cpp

index 0b6015f7b52ddf44b6c0e4626d622e3c0ca6a124..18ecc7ee7a05ae3bd35a0f2a8d0a546d030c537c 100644 (file)
@@ -560,9 +560,11 @@ public:
 
        VkQueueFlags getQueueFlags (const OperationContext& context) const
        {
-               if (std::find(context.getDeviceExtensions().begin(), context.getDeviceExtensions().end(), "VK_KHR_maintenance1") == context.getDeviceExtensions().end() ||
-                       BUFFER_OP_UPDATE != m_bufferOp)
+               if (m_bufferOp == BUFFER_OP_FILL &&
+                       !de::contains(context.getDeviceExtensions().begin(), context.getDeviceExtensions().end(), "VK_KHR_maintenance1"))
+               {
                        return VK_QUEUE_COMPUTE_BIT | VK_QUEUE_GRAPHICS_BIT;
+               }
 
                return VK_QUEUE_TRANSFER_BIT;
        }
@@ -3288,10 +3290,13 @@ public:
 
                vk.cmdDraw(cmdBuffer, static_cast<deUint32>(dataSizeBytes / sizeof(tcu::UVec4)), 1u, 0u, 0u);
 
-               const VkBufferMemoryBarrier     barrier = makeBufferMemoryBarrier(VK_ACCESS_SHADER_WRITE_BIT, VK_ACCESS_HOST_READ_BIT, **m_outputBuffer, 0u, m_resource.getBuffer().size);
-               vk.cmdPipelineBarrier(cmdBuffer, VK_PIPELINE_STAGE_VERTEX_SHADER_BIT, VK_PIPELINE_STAGE_HOST_BIT, (VkDependencyFlags)0, 0u, DE_NULL, 1u, &barrier, 0u, DE_NULL);
-
                endRenderPass(vk, cmdBuffer);
+
+               // Insert a barrier so data written by the shader is available to the host
+               {
+                       const VkBufferMemoryBarrier     barrier = makeBufferMemoryBarrier(VK_ACCESS_SHADER_WRITE_BIT, VK_ACCESS_HOST_READ_BIT, **m_outputBuffer, 0u, m_resource.getBuffer().size);
+                       vk.cmdPipelineBarrier(cmdBuffer, VK_PIPELINE_STAGE_VERTEX_SHADER_BIT, VK_PIPELINE_STAGE_HOST_BIT, (VkDependencyFlags)0, 0u, DE_NULL, 1u, &barrier, 0u, DE_NULL);
+               }
        }
 
        SyncInfo getSyncInfo (void) const