native: run ExecuteIndirect with a count buffer, gated on the GPU #116
No reviewers
Labels
No labels
accessibility
bug
claimed
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
tester report
urgent
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LakshanSivakumar--Native-Victory-macOS!116
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-116"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Olima34 on GitHub · 2026-11-26 17:15 UTC · original
Olima34:feat/native-indirect-count-buffer→main· +410 −27 · 13 files · 1 commits · merged 2026-11-26 18:09 UTCTakes "count buffers for ExecuteIndirect" from your free-to-take list, on top of
8765326.Why. D3D12 runs
min(*count, MaxCommandCount)records, with the count read on the GPU when the work runs. A culling pass usually writes it earlier in the same submission. The native host dropped every ExecuteIndirect with a count buffer.What.
NativeList::dispatch_indirect_counted,draw_indirect_counted). The count is resolved like the record, so a count at unmapped memory drops only that command (as #102 does).gfx.rs,GATE) runs before each counted record. It copies the record into a small Metal-tracked buffer, or writes zeros there when the index is not below the count. The indirect command reads that buffer, so a zeroed record dispatches no groups and draws nothing.count_offsetis applied on both the macOS and Windows paths.Why not an indirect command buffer. Encoding the converted shaders' argument-buffer bindings into an ICB is much larger than one gate per record.
Known limit (marked
shortcut:in the code). There is one gate dispatch and one small buffer per record. If a largeMaxCommandCountshows up in profiles, all records of one ExecuteIndirect can be gated in a single dispatch.Tests.
a_count_buffer_limits_the_indirect_draws_that_run,a_count_buffer_limits_the_indirect_dispatches_that_run.a_count_written_earlier_on_the_gpu_limits_the_indirect_dispatches(the count is written by a copy earlier in the same list). It fails when the gate ignores the count.victory-gpu (arm64) and victory-metal tests, Windows clippy and
cargo xtask policypass. Not checked in game.35b1fa6d67toc8f2f0722b@Olima34 on GitHub · 2026-11-26 17:31 UTC · original
Rebased on main for
ce35cbc(metal.rs: kept both the new failure-trace fields and the gate pipeline). victory-gpu and victory-metal tests, Windows clippy and policy pass.@LakshanSivakumar on GitHub · 2026-11-26 18:09 UTC · original
Merged, thanks. The per-record gate is a clean fit, and the count tests pass on Metal.