GPU: skip pipeline demand for empty direct draws #2654
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2654
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2654"
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?
@andrewpozdnakov7-jpg on GitHub · 2026-11-25 17:38 UTC · original
andrewpozdnakov7-jpg:codex1/skip-empty-draws→main· +69 −0 · 2 files · 1 commits · openDirect DrawInstanced and DrawIndexedInstanced with no vertices, indices or instances still request a host PSO. That can queue work and consume pipeline wait budget before the next draw. Return before preparing state for these empty calls. This covers the two graphics entry points. The related compute change is #2556.
The same WARP test calls the normal VIctory list vtable with a fresh pending pipeline for each case. On
13f91ca, all four empty cases mark the pipeline as used. On5a603b0, none marks it. The nonempty instanced and indexed controls still request their pipelines. Six alternating A/B runs covered both D3D12 debug flag settings.The serial victory-gpu suite passed with 199 passed and 1 ignored in each setting. Strict GPU Clippy in both modes and repository policy passed. Local merge checks with #2556, #2624 and the offered #1254 rebase were clean. AI-assisted. Synthetic tests only.
Coordination claim
Please preserve the Git author when reapplying the change. If you fold the code or test into another commit, please add this trailer.
Co-authored-by: andrewpozdnakov7-jpg [email protected]
Current main retest
The original guest-vtable test on
63bcca43c6a00a758510398fa43096ce7e4f7df0requests a pipeline for all four empty cases. The same test with5a603b00b1343bea8188de74bfb7a5521161b9b3merged locally into that base requests none of them. Both nonempty controls request a pipeline. Six paired WARP runs, full GPU suite with 247 passed and one ignored under both D3D12 debug settings, strict GPU Clippy, and asset policy passed.@kotekompotek on GitHub · 2026-11-25 17:54 UTC · original
Reviewed: early-out on
vertices == 0 || instances == 0(and the indexed variant) is right — an empty draw demands nothing from the pipeline, and on titles that issue degenerate draws this avoids useless pipeline creation. The test creates a real allocator/list on the host device. CI green.@oni-swr on GitHub · 2026-11-25 18:13 UTC · original
Independent verification of head
5a603b00b1343bea8188de74bfb7a5521161b9b3onorigin/main13f91caee25f2fdf2c062be5f7a27f058e51cbca(the PR is based on it; merges cleanly, fast-forward).Environment: Windows 11 Pro 10.0.26100, WARP (d3d10warp 10.0.26100.9818) only, rustc/cargo 1.98.1 (per rust-toolchain.toml), DXC 1.8.2502.11 / dxil.dll 1.8.2502.11 (Windows SDK 10.0.26100.0 x64).
VICTORY_WARP=1andVICTORY_D3D12_WARP=1set for every run;victory-gputests were only run with--features diagnostics(without it the crate opens the default adapter). Limits: no physical GPU, no game files, no title-driven runs; this says nothing about behaviour on real hardware.cargo test -j 4 --locked -p victory-gpu --features diagnostics empty_draws_do_not_request->pipeline::make::tests::empty_draws_do_not_request_graphics_pipelines1 passed (ran, not skipped: it needs a D3D12 device and WARP provided one).origin/mainbaseline (cargo test -j 4 --locked -p victory-gpu --features diagnostics): 197 passed, 1 failed (memory::tests::a_submission_that_missed_leaves_the_copies_at_once,memory.rs:886), 1 ignored. That test passed in all four PR runs, so it looks flaky; I did not investigate it, and none of these PRs touchmemory.rs.cargo clippy -j 4 --locked -p victory-gpu --all-targets [--features diagnostics | --all-features] -- -D warnings: clean.draw.rsfromorigin/main(kept the test) -> the test fails:left: [true, true, true, true],right: [false, false, false, false](all four empty cases request a pipeline). With the fix it passes, and the two non-empty cases still request one.pipeline/make.rsbut exercisesdraw.rsthrough a raw vtable offset (0x60/0x68/0xc8), which breaks quietly if the list layout changes.AI disclosure: independent verification by Claude Code / Claude Sonnet 5.5, run for a user; no game files, dumps or hashes involved.
@Marvisak on GitHub · 2026-11-25 22:18 UTC · original
Automated triage for the maintainers.
Merge candidate.
State::drawandState::draw_indexed(crates/victory-gpu/src/draw.rs) now return before doing anything when the vertex/index or instance count is zero, so such draws no longer ask for a host pipeline or spend wait budget on one. A zero-count draw does nothing under D3D12 rules, and the next real draw still prepares all its state, so nothing visible is lost. The only side effect is that empty draws disappear from the diagnostics draw trace. The WARP test inpipeline/make.rsdrives the list through its vtable and checks that the empty cases leave the pipeline unrequested while the non-empty ones still request it; the IIDs it uses are the public PC D3D12 ones. It merges cleanly; CIcheck: passing.Generated by Claude Code
@Dukestar69 on GitHub · 2026-11-26 04:49 UTC · original · approved these changes
Tested merged onto
origin/main(63bcca4) on Windows 11 x64 (NVIDIA GeForce RTX 5090):cargo test -p victory-gpu --lib pipeline::make::tests: 3 passed, 0 failed (including newempty_draws_do_not_request_graphics_pipelines).cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
@fuzeofficlal on GitHub · 2026-11-26 12:54 UTC · original · approved these changes
Reviewed and verified
5a603b00merged locally ontoorigin/main(63bcca43) on Windows 11 x64 (NVIDIA GeForce RTX 5090 and WARP, Rust1.98.1MSVC, Windows SDK10.0.26100.0dxil.dll; synthetic tests only, no game files).Verification
git merge-treeagainstorigin/main(63bcca43) and combined with#2696: clean.cargo xtask policy(PR head):184 files ok.cargo clippy --locked -p victory-gpu --all-targets -- -D warnings(default and--all-features, both PR head and merged): 0 warnings.cargo test --locked -p victory-gpu --lib -- pipeline::make::tests draw::tests— 23 passed, 0 failed (includingempty_draws_do_not_request_graphics_pipelines).VICTORY_D3D12_DEBUG=1,--features diagnostics): 24 passed, 0 failed.VICTORY_D3D12_WARP=1,VICTORY_D3D12_DEBUG=1,--features diagnostics): 24 passed, 0 failed.#2654 + #2696on63bcca43(RTX 5090): Clippy clean in both feature modes;pipeline::tests,pipeline::make::tests, anddraw::tests— 27 passed, 0 failed.Review Notes
State::draw(crates/victory-gpu/src/draw.rs:1486-1496) andState::draw_indexed(crates/victory-gpu/src/draw.rs:1592-1603) when the vertex/index or instance count is zero is a strict D3D12 no-op. Skipping beforeself.prepareavoids queuing host PSO work or burning pipeline wait budget while leavingdraw::Stateuntouched for subsequent non-empty draws.crates/victory-gpu/src/pipeline/make.rs:340-401cleanly covers all four zero-count combinations plus both non-empty controls.Looks good to merge.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.