From b1c12ce1aedc3da6511f66a9084e1146bd880f8d Mon Sep 17 00:00:00 2001 From: baldurk Date: Mon, 7 Sep 2020 17:56:16 +0100 Subject: [PATCH] Don't re-order chunks for indirect draws. Closes #2042 * If we insert chunks next to the recorded commands for indirect draws we need to update all other commands which are recorded but not submitted which have chunk indices. Updating this could be very complex if the command buffer record is only partially complete when the submit happens (which is quite possible if it's not submitted until later), so instead we abandon trying to have indirect chunks next to the recorded command chunks since it's not strictly necessary. --- renderdoc/driver/vulkan/wrappers/vk_queue_funcs.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/renderdoc/driver/vulkan/wrappers/vk_queue_funcs.cpp b/renderdoc/driver/vulkan/wrappers/vk_queue_funcs.cpp index e48d6dca5..93977418d 100644 --- a/renderdoc/driver/vulkan/wrappers/vk_queue_funcs.cpp +++ b/renderdoc/driver/vulkan/wrappers/vk_queue_funcs.cpp @@ -637,10 +637,7 @@ void WrappedVulkan::InsertDrawsAndRefreshIDs(BakedCmdBufferInfo &cmdBufInfo) cmdBufNodes[j].draw.drawcallId += eidShift; for(APIEvent &ev : cmdBufNodes[j].draw.events) - { ev.eventId += eidShift; - ev.chunkIndex += eidShift; - } for(rdcpair &use : cmdBufNodes[j].resourceUsage) use.second.eventId += eidShift; @@ -683,9 +680,6 @@ void WrappedVulkan::InsertDrawsAndRefreshIDs(BakedCmdBufferInfo &cmdBufInfo) if(indirectCount == 0) { // i is the pushmarker, which we leave. i+1 is the subdraw - - m_StructuredFile->chunks.erase(chunkIndex); - cmdBufNodes.erase(i + 1); } else @@ -693,8 +687,9 @@ void WrappedVulkan::InsertDrawsAndRefreshIDs(BakedCmdBufferInfo &cmdBufInfo) // duplicate the fake structured data chunk N times SDChunk *chunk = m_StructuredFile->chunks[chunkIndex]; + uint32_t baseAddedChunk = (uint32_t)m_StructuredFile->chunks.size(); for(int32_t e = 0; e < eidShift; e++) - m_StructuredFile->chunks.insert(chunkIndex, chunk->Duplicate()); + m_StructuredFile->chunks.push_back(chunk->Duplicate()); // now copy the subdraw so we're not inserting into the array from itself VulkanDrawcallTreeNode node = cmdBufNodes[i + 1]; @@ -708,7 +703,7 @@ void WrappedVulkan::InsertDrawsAndRefreshIDs(BakedCmdBufferInfo &cmdBufInfo) for(APIEvent &ev : node.draw.events) { ev.eventId++; - ev.chunkIndex++; + ev.chunkIndex = baseAddedChunk + e; } for(rdcpair &use : node.resourceUsage)