layers: Fix CmdExecuteCommands simultaneous case
authorChris Forbes <chrisforbes@google.com>
Thu, 18 May 2017 23:04:50 +0000 (16:04 -0700)
committerChris Forbes <chrisf@ijw.co.nz>
Fri, 19 May 2017 02:08:01 +0000 (19:08 -0700)
layers/core_validation.cpp

index 9592df7..c36c9e3 100644 (file)
@@ -9542,7 +9542,7 @@ VKAPI_ATTR void VKAPI_CALL CmdExecuteCommands(VkCommandBuffer commandBuffer, uin
             skip |= validateSecondaryCommandBufferState(dev_data, pCB, pSubCB);
             skip |= validateCommandBufferState(dev_data, pSubCB, "vkCmdExecuteCommands()", 0, VALIDATION_ERROR_00155);
             if (!(pSubCB->beginInfo.flags & VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT)) {
-                if (pSubCB->in_use.load()) {
+                if (pSubCB->in_use.load() || pCB->linkedCommandBuffers.count(pSubCB)) {
                     skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
                                     VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, HandleToUint64(pCB->commandBuffer), __LINE__,
                                     VALIDATION_ERROR_00154, "DS",
@@ -9573,6 +9573,7 @@ VKAPI_ATTR void VKAPI_CALL CmdExecuteCommands(VkCommandBuffer commandBuffer, uin
                             "supported on this device. %s",
                             pCommandBuffers[i], validation_error_map[VALIDATION_ERROR_02062]);
             }
+            // TODO: separate validate from update! This is very tangled.
             // Propagate layout transitions to the primary cmd buffer
             for (auto ilm_entry : pSubCB->imageLayoutMap) {
                 SetLayout(dev_data, pCB, ilm_entry.first, ilm_entry.second);