From d103d31f55994c2ee1805557a549312ec36e40ad Mon Sep 17 00:00:00 2001 From: baldurk Date: Fri, 20 May 2022 15:51:01 +0100 Subject: [PATCH] Don't replay past end of indirect draws on vulkan. Closes #2590 * If the popmarker inserted at the end of an indirect multi-draw is selected this points past the end of the normal draws, but we don't want to replay that extra draw. --- renderdoc/driver/vulkan/wrappers/vk_draw_funcs.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/renderdoc/driver/vulkan/wrappers/vk_draw_funcs.cpp b/renderdoc/driver/vulkan/wrappers/vk_draw_funcs.cpp index d677f73ca..b374bdd86 100644 --- a/renderdoc/driver/vulkan/wrappers/vk_draw_funcs.cpp +++ b/renderdoc/driver/vulkan/wrappers/vk_draw_funcs.cpp @@ -914,6 +914,8 @@ bool WrappedVulkan::Serialise_vkCmdDrawIndexedIndirect(SerialiserType &ser, { uint32_t drawidx = 0; + ActionDescription *action = m_Actions[curEID]; + if(m_FirstEventID <= 1) { // if we're replaying part-way into a multidraw, we can replay the first part @@ -922,6 +924,12 @@ bool WrappedVulkan::Serialise_vkCmdDrawIndexedIndirect(SerialiserType &ser, // works if we're replaying from the first multidraw to the nth (n less than Count) count = RDCMIN(count, m_LastEventID - baseEventID); } + else if(action->flags & ActionFlags::PopMarker) + { + // if the popmarker is selected (most likely implicitly by a parent marker) + // don't replay anything and don't try to set up the indirect buffer. + count = 0; + } else { // otherwise we do the 'hard' case, draw only one multidraw @@ -996,7 +1004,7 @@ bool WrappedVulkan::Serialise_vkCmdDrawIndexedIndirect(SerialiserType &ser, stride = sizeof(VkDrawIndexedIndirectCommand); } - if(IsDrawInRenderPass()) + if(IsDrawInRenderPass() && count > 0) { uint32_t eventId = HandlePreCallback(commandBuffer, ActionFlags::Drawcall, drawidx + 1);