radv: Emit pending flushes before executing a secondary command buffer
authorAlex Smith <asmith@feralinteractive.com>
Mon, 6 Mar 2017 14:54:28 +0000 (14:54 +0000)
committerBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Mon, 6 Mar 2017 18:46:14 +0000 (19:46 +0100)
If we have any pending flushes on the primary command buffer, these
must be performed before executing the secondary buffer.

This fixes potential corruption when the contents of a subpass which
clears any of its render targets are given in a secondary buffer: the
flushes after a fast clear would not have been performed until the
vkCmdEndRenderPass call.

Signed-off-by: Alex Smith <asmith@feralinteractive.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Cc: 13.0 17.0 <mesa-stable@lists.freedesktop.org>
src/amd/vulkan/radv_cmd_buffer.c

index 3ff52502ffe7de65dc05ebbde68ccdeae80638f1..d99288a67223d1871de5f390616dcf946afcb540 100644 (file)
@@ -2110,6 +2110,9 @@ void radv_CmdExecuteCommands(
 {
        RADV_FROM_HANDLE(radv_cmd_buffer, primary, commandBuffer);
 
+       /* Emit pending flushes on primary prior to executing secondary */
+       si_emit_cache_flush(primary);
+
        for (uint32_t i = 0; i < commandBufferCount; i++) {
                RADV_FROM_HANDLE(radv_cmd_buffer, secondary, pCmdBuffers[i]);