Mesh draw batching beyond strict state adjacency: per-draw parameter SRV table & Vulkan DGC path #1239

Open
opened 2026-11-26 04:00:08 +00:00 by github-bot · 0 comments
Owner

@⁠Marukooh on GitHub · 2026-11-26 01:29 UTC · original

Summary & Measurements (RTX 5070 Ti + Proton / vkd3d-proton)

With VICTORY_VIDEO_BUDGET_MB=10500 and VICTORY_HOIST_CLAMPS=1, GPU time in heavy prologue scenes (2,500–6,000 draws/frame) is ~41–46 ms, of which ~2,400+ indirect mesh draws/frame (mostly single-record, no declared UAVs) still cost ~19–28 µs/draw (~45 ms total including remaining per-draw overhead).

Two key local observations:

  1. Strict state-adjacency probing (VICTORY_MESH_RUN_PROBE): across ~2,400 mesh draws/frame, 0 adjacent pairs matched identical-state adjacency — because root constants / CBV bindings change between consecutive draws, even when PSO, render targets, and barriers stay unchanged.
  2. Isolated Vulkan mesh-batch benchmark on RTX 5070 Ti (4,096 mesh draws):
    • CPU recording: 0.118 ms → 0.0016 ms (~70× faster)
    • GPU execution: 0.068 ms → 0.035 ms (~2× faster)
    • Also confirmed via vulkaninfo on RTX 5070 Ti (driver 620.73.04) that VK_EXT_device_generated_commands (DGC) with task/mesh pipeline binding is supported natively.

Proposals

  1. Per-draw parameter table (draw_id SRV) + multi-count ExecuteIndirect:
    For runs that share the same PSO, attachments, and barrier/UAV boundaries and only vary root constants or CBV/buffer pointers, pack those per-draw parameters into an SRV ring buffer indexed by draw_id (SV_DrawIndex / indirect counter) and emit a single multi-count ExecuteIndirect for the whole run. This bypasses the 0-pair strict-adjacency limitation and removes per-draw State::replay + hoist overhead.
  2. Long-term native Vulkan / DGC fast-path:
    Under vkd3d-proton, resource-scoped UAV barriers still lower to global Vulkan barriers and every ExecuteIndirect pays D3D12→Vulkan translation overhead. A native Vulkan / VK_EXT_device_generated_commands fast-path (starting with the main mesh pass) would remove both translation overhead and unnecessary global drains.
**@⁠Marukooh** on GitHub · 2026-11-26 01:29 UTC · [original](https://github.com/fxceless/victory-fork/issues/1239) ### Summary & Measurements (RTX 5070 Ti + Proton / vkd3d-proton) With `VICTORY_VIDEO_BUDGET_MB=10500` and `VICTORY_HOIST_CLAMPS=1`, GPU time in heavy prologue scenes (2,500–6,000 draws/frame) is **~41–46 ms**, of which **~2,400+ indirect mesh draws/frame** (mostly single-record, no declared UAVs) still cost ~19–28 µs/draw (~45 ms total including remaining per-draw overhead). Two key local observations: 1. **Strict state-adjacency probing (`VICTORY_MESH_RUN_PROBE`):** across ~2,400 mesh draws/frame, **0 adjacent pairs** matched identical-state adjacency — because root constants / CBV bindings change between consecutive draws, even when PSO, render targets, and barriers stay unchanged. 2. **Isolated Vulkan `mesh-batch` benchmark on RTX 5070 Ti (4,096 mesh draws):** - CPU recording: **0.118 ms → 0.0016 ms** (~70× faster) - GPU execution: **0.068 ms → 0.035 ms** (~2× faster) - Also confirmed via `vulkaninfo` on RTX 5070 Ti (driver 620.73.04) that `VK_EXT_device_generated_commands` (DGC) with task/mesh pipeline binding is supported natively. ### Proposals 1. **Per-draw parameter table (`draw_id` SRV) + multi-count `ExecuteIndirect`:** For runs that share the same PSO, attachments, and barrier/UAV boundaries and only vary root constants or CBV/buffer pointers, pack those per-draw parameters into an SRV ring buffer indexed by `draw_id` (`SV_DrawIndex` / indirect counter) and emit a single multi-count `ExecuteIndirect` for the whole run. This bypasses the 0-pair strict-adjacency limitation and removes per-draw `State::replay` + `hoist` overhead. 2. **Long-term native Vulkan / DGC fast-path:** Under `vkd3d-proton`, resource-scoped UAV barriers still lower to global Vulkan barriers and every `ExecuteIndirect` pays D3D12→Vulkan translation overhead. A native Vulkan / `VK_EXT_device_generated_commands` fast-path (starting with the main mesh pass) would remove both translation overhead and unnecessary global drains.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:00:08 +00:00
This discussion has been locked. Commenting is limited to contributors.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/fxceless--victory-fork#1239
No description provided.