layers:Handle secondary cmd buffer transitions
authorTobin Ehlis <tobine@google.com>
Thu, 3 Nov 2016 16:46:44 +0000 (10:46 -0600)
committerTobin Ehlis <tobine@google.com>
Fri, 4 Nov 2016 16:46:16 +0000 (10:46 -0600)
When recording a secondary command buffer into a primary command buffer
record any image layout transitions from the secondary cb into the
primary cb.

At QueueSubmit time we validate the layouts at the primary cmd buffer
level so this change will allow that code to correctly work if
layout transitions occur in the secondary command buffer.

layers/core_validation.cpp

index e035445..09d41a9 100644 (file)
@@ -11008,6 +11008,10 @@ CmdExecuteCommands(VkCommandBuffer commandBuffer, uint32_t commandBuffersCount,
                             "supported on this device.",
                             reinterpret_cast<uint64_t>(pCommandBuffers[i]));
             }
+            // Propagate layout transitions to the primary cmd buffer
+            for (auto ilm_entry : pSubCB->imageLayoutMap) {
+                SetLayout(pCB, ilm_entry.first, ilm_entry.second);
+            }
             pSubCB->primaryCommandBuffer = pCB->commandBuffer;
             pCB->secondaryCommandBuffers.insert(pSubCB->commandBuffer);
             dev_data->globalInFlightCmdBuffers.insert(pSubCB->commandBuffer);