From f2cb40edc010f13b8235fac9189be2efdd7a1eeb Mon Sep 17 00:00:00 2001 From: Jake Turner Date: Wed, 13 May 2026 15:00:54 +0100 Subject: [PATCH] For Vk DrawIndirectCount APIs add resource usage for zero draw counts - vkCmdDrawInirectCount, vkCmdDrawIndexedIndirectCount, vkCmdDrawMeshTasksIndirectCountEXT - zero maxDrawCount - zero draw count from the count buffer --- .../driver/vulkan/wrappers/vk_draw_funcs.cpp | 25 ++++++++++++++++--- .../driver/vulkan/wrappers/vk_queue_funcs.cpp | 7 ++++++ 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/renderdoc/driver/vulkan/wrappers/vk_draw_funcs.cpp b/renderdoc/driver/vulkan/wrappers/vk_draw_funcs.cpp index 3d8916e05..45fcc6486 100644 --- a/renderdoc/driver/vulkan/wrappers/vk_draw_funcs.cpp +++ b/renderdoc/driver/vulkan/wrappers/vk_draw_funcs.cpp @@ -2987,15 +2987,21 @@ bool WrappedVulkan::Serialise_vkCmdDrawIndirectCount(SerialiserType &ser, ActionDescription action; action.customName = name; - action.flags = ActionFlags::MultiAction | ActionFlags::PushMarker; + ActionFlags flags = ActionFlags::MultiAction | ActionFlags::PushMarker; + action.flags = flags; + // Add flags to force resource usage to get computed for special case if(maxDrawCount == 0) + { action.customName = name + "(0)"; + action.flags |= ActionFlags::Drawcall | ActionFlags::Instanced | ActionFlags::Indirect; + } AddEvent(); AddAction(action); VulkanActionTreeNode &actionNode = GetActionStack().back()->children.back(); + actionNode.action.flags = flags; actionNode.indirectPatch = indirectPatch; @@ -3337,15 +3343,22 @@ bool WrappedVulkan::Serialise_vkCmdDrawIndexedIndirectCount( ActionDescription action; action.customName = name; - action.flags = ActionFlags::MultiAction | ActionFlags::PushMarker; + ActionFlags flags = ActionFlags::MultiAction | ActionFlags::PushMarker; + action.flags = flags; + // Add flags to force resource usage to get computed for special case if(maxDrawCount == 0) + { action.customName = name + "(0)"; + action.flags |= ActionFlags::Drawcall | ActionFlags::Instanced | ActionFlags::Indexed | + ActionFlags::Indirect; + } AddEvent(); AddAction(action); VulkanActionTreeNode &actionNode = GetActionStack().back()->children.back(); + actionNode.action.flags = flags; actionNode.indirectPatch = indirectPatch; @@ -5120,15 +5133,21 @@ bool WrappedVulkan::Serialise_vkCmdDrawMeshTasksIndirectCountEXT( ActionDescription action; action.customName = name; - action.flags = ActionFlags::MultiAction | ActionFlags::PushMarker; + ActionFlags flags = ActionFlags::MultiAction | ActionFlags::PushMarker; + action.flags = flags; + // Add flags to force resource usage to get computed for special case if(maxDrawCount == 0) + { action.customName = name + "(0)"; + action.flags |= ActionFlags::MeshDispatch | ActionFlags::Indirect; + } AddEvent(); AddAction(action); VulkanActionTreeNode &actionNode = GetActionStack().back()->children.back(); + actionNode.action.flags = flags; actionNode.indirectPatch = indirectPatch; diff --git a/renderdoc/driver/vulkan/wrappers/vk_queue_funcs.cpp b/renderdoc/driver/vulkan/wrappers/vk_queue_funcs.cpp index 25886d5c3..e4931b608 100644 --- a/renderdoc/driver/vulkan/wrappers/vk_queue_funcs.cpp +++ b/renderdoc/driver/vulkan/wrappers/vk_queue_funcs.cpp @@ -751,6 +751,13 @@ void WrappedVulkan::InsertActionsAndRefreshIDs(BakedCmdBufferInfo &cmdBufInfo) // everything afterwards is adjusted. Now see if we need to remove the subdraw or clone it if(indirectCount == 0) { + // Copy the resource usage from the subdraw to the indirect action (push marker) + n.resourceUsage.swap(cmdBufNodes[i + 1].resourceUsage); + for(rdcpair &use : n.resourceUsage) + use.second.eventId += eidShift; + for(const rdcpair &use : cmdBufNodes[i + 1].resourceUsage) + n.resourceUsage.push_back(use); + // i is the pushmarker, which we leave. i+1 is the subdraw cmdBufNodes.erase(i + 1); }