@@ -3258,7 +3258,6 @@ static void resetCB(layer_data *dev_data, const VkCommandBuffer cb) {
32583258 pCB->drawData.clear();
32593259 pCB->currentDrawData.buffers.clear();
32603260 pCB->vertex_buffer_used = false;
3261- pCB->primaryCommandBuffer = VK_NULL_HANDLE;
32623261 // If secondary, invalidate any primary command buffer that may call us.
32633262 if (pCB->createInfo.level == VK_COMMAND_BUFFER_LEVEL_SECONDARY) {
32643263 invalidateCommandBuffers(dev_data,
@@ -4022,6 +4021,8 @@ static bool validatePrimaryCommandBufferState(layer_data *dev_data, GLOBAL_CB_NO
40224021 // Track in-use for resources off of primary and any secondary CBs
40234022 bool skip = false;
40244023
4024+ // TODO: inline this function into sole caller
4025+
40254026 // If USAGE_SIMULTANEOUS_USE_BIT not set then CB cannot already be executing
40264027 // on device
40274028 skip |= validateCommandBufferSimultaneousUse(dev_data, pCB, current_submit_count);
@@ -4030,17 +4031,6 @@ static bool validatePrimaryCommandBufferState(layer_data *dev_data, GLOBAL_CB_NO
40304031
40314032 for (auto pSubCB : pCB->linkedCommandBuffers) {
40324033 skip |= validateResources(dev_data, pSubCB);
4033- // TODO: replace with invalidateCommandBuffers() at recording.
4034- if ((pSubCB->primaryCommandBuffer != pCB->commandBuffer) &&
4035- !(pSubCB->beginInfo.flags & VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT)) {
4036- log_msg(
4037- dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, 0,
4038- __LINE__, VALIDATION_ERROR_00135, "DS",
4039- "Commandbuffer 0x%p was submitted with secondary buffer 0x%p but that buffer has subsequently been bound to "
4040- "primary cmd buffer 0x%p and it does not have VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT set. %s",
4041- pCB->commandBuffer, pSubCB->commandBuffer, pSubCB->primaryCommandBuffer,
4042- validation_error_map[VALIDATION_ERROR_00135]);
4043- }
40444034 }
40454035
40464036 skip |= validateCommandBufferState(dev_data, pCB, "vkQueueSubmit()", current_submit_count, VALIDATION_ERROR_00134);
@@ -9550,6 +9540,12 @@ VKAPI_ATTR void VKAPI_CALL CmdExecuteCommands(VkCommandBuffer commandBuffer, uin
95509540 pCommandBuffers[i], pCB->commandBuffer);
95519541 pCB->beginInfo.flags &= ~VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT;
95529542 }
9543+ if (pSubCB->linkedCommandBuffers.size()) {
9544+ // TODO: adjust message support so we can report an accurate error message for this.
9545+ invalidateCommandBuffers(dev_data, pSubCB->linkedCommandBuffers,
9546+ {HandleToUint64(pCommandBuffers[i]), kVulkanObjectTypeCommandBuffer});
9547+ // TODO: consistent strategy for removing links.
9548+ }
95539549 }
95549550 if (!pCB->activeQueries.empty() && !dev_data->enabled_features.inheritedQueries) {
95559551 skip |=
@@ -9566,7 +9562,6 @@ VKAPI_ATTR void VKAPI_CALL CmdExecuteCommands(VkCommandBuffer commandBuffer, uin
95669562 for (auto ilm_entry : pSubCB->imageLayoutMap) {
95679563 SetLayout(dev_data, pCB, ilm_entry.first, ilm_entry.second);
95689564 }
9569- pSubCB->primaryCommandBuffer = pCB->commandBuffer;
95709565 pCB->linkedCommandBuffers.insert(pSubCB);
95719566 pSubCB->linkedCommandBuffers.insert(pCB);
95729567 for (auto &function : pSubCB->queryUpdates) {
0 commit comments