For Vk DrawIndirectCount APIs add resource usage for zero draw counts

- vkCmdDrawInirectCount, vkCmdDrawIndexedIndirectCount, vkCmdDrawMeshTasksIndirectCountEXT
- zero maxDrawCount
- zero draw count from the count buffer
This commit is contained in:
Jake Turner
2026-05-13 16:10:28 +01:00
parent 7ab87fbe8e
commit f2cb40edc0
2 changed files with 29 additions and 3 deletions
@@ -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;
@@ -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<ResourceId, EventUsage> &use : n.resourceUsage)
use.second.eventId += eidShift;
for(const rdcpair<ResourceId, EventUsage> &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);
}