From dc68a1d5e118704471bf9fd2061e3f83194c2278 Mon Sep 17 00:00:00 2001 From: baldurk Date: Thu, 29 Jul 2021 15:37:13 +0100 Subject: [PATCH] Fix off-by-one error with indirect count draws on vulkan --- renderdoc/driver/vulkan/wrappers/vk_draw_funcs.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/renderdoc/driver/vulkan/wrappers/vk_draw_funcs.cpp b/renderdoc/driver/vulkan/wrappers/vk_draw_funcs.cpp index 767b2521e..54b9633f7 100644 --- a/renderdoc/driver/vulkan/wrappers/vk_draw_funcs.cpp +++ b/renderdoc/driver/vulkan/wrappers/vk_draw_funcs.cpp @@ -2728,7 +2728,12 @@ bool WrappedVulkan::Serialise_vkCmdDrawIndirectCount(SerialiserType &ser, uint32_t baseEventID = it->eventId; // get the number of draws by looking at how many children the parent action has. - count = (uint32_t)GetAction(it->eventId)->children.size(); + const rdcarray &children = GetAction(it->eventId)->children; + count = (uint32_t)children.size(); + + // don't count the popmarker child + if(!children.empty() && children.back().flags & ActionFlags::PopMarker) + count--; // when we have a callback, submit every action individually to the callback if(m_ActionCallback && IsDrawInRenderPass()) @@ -3043,7 +3048,12 @@ bool WrappedVulkan::Serialise_vkCmdDrawIndexedIndirectCount( uint32_t baseEventID = it->eventId; // get the number of draws by looking at how many children the parent action has. - count = (uint32_t)GetAction(it->eventId)->children.size(); + const rdcarray &children = GetAction(it->eventId)->children; + count = (uint32_t)children.size(); + + // don't count the popmarker child + if(!children.empty() && children.back().flags & ActionFlags::PopMarker) + count--; // when we have a callback, submit every action individually to the callback if(m_ActionCallback && IsDrawInRenderPass())