Add barrier at start of each CB to order wrt previous CBs
authorChris Forbes <chrisforbes@google.com>
Tue, 13 Nov 2018 23:08:45 +0000 (15:08 -0800)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Fri, 30 Nov 2018 10:06:46 +0000 (05:06 -0500)
Currently, there is only the implicit ordering guarantee for the top of
pipe between batches of commands. This isn't adequate for implementations
that allow overlapping work from different CBs. Insert an explicit
fairly-full barrier at the beginning of each CB to make this safe.

(Suggested by ARM to Google to deal with some long-standing weird
behavior)

Change-Id: I254db5f1461d5ff7c0af73de9219f59c8154df7c
Affects: dEQP-VK.memory.pipeline_barrier.*
Components: Vulkan
Google bug: b/113601409
VK-GL-CTS Issue: 1468

external/vulkancts/modules/vulkan/memory/vktMemoryPipelineBarrierTests.cpp

index 3991067..aae94eb 100644 (file)
@@ -9029,6 +9029,14 @@ de::MovePtr<Command> createCmdCommands (const Memory&    memory,
 
        try
        {
+               // Insert a mostly-full barrier to order this work wrt previous command buffer.
+               commands.push_back(new PipelineBarrier(state.cache.getAllowedStages(),
+                                                                                          state.cache.getAllowedAcceses(),
+                                                                                          state.cache.getAllowedStages(),
+                                                                                          state.cache.getAllowedAcceses(),
+                                                                                          PipelineBarrier::TYPE_GLOBAL,
+                                                                                          tcu::nothing<vk::VkImageLayout>()));
+
                for (; opNdx < opCount; opNdx++)
                {
                        vector<Op>      ops;