GPU: skip pipeline demand for empty direct draws #2654

Open
github-bot wants to merge 1 commit from github-bot/gh-2654 into main AGit
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-25 17:38 UTC · original
andrewpozdnakov7-jpg:codex1/skip-empty-draws → main · +69 −0 · 2 files · 1 commits · open

Direct 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. On 5a603b0, 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 63bcca43c6a00a758510398fa43096ce7e4f7df0 requests a pipeline for all four empty cases. The same test with 5a603b00b1343bea8188de74bfb7a5521161b9b3 merged 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.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-25 17:38 UTC · [original](https://github.com/Marvisak/VIctory/pull/2654) `andrewpozdnakov7-jpg:codex1/skip-empty-draws` → `main` · +69 −0 · 2 files · 1 commits · open Direct 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. On 5a603b0, 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](https://git.gtahub.st/github/Marvisak--VIctory/issues/1633) 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 `63bcca43c6a00a758510398fa43096ce7e4f7df0` requests a pipeline for all four empty cases. The same test with `5a603b00b1343bea8188de74bfb7a5521161b9b3` merged 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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:11:17 +00:00
Author
Owner

@⁠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.

**@⁠kotekompotek** on GitHub · 2026-11-25 17:54 UTC · [original](https://github.com/Marvisak/VIctory/pull/2654#issuecomment-7170159969) 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.
Author
Owner

@⁠oni-swr on GitHub · 2026-11-25 18:13 UTC · original

Independent verification of head 5a603b00b1343bea8188de74bfb7a5521161b9b3 on origin/main 13f91caee25f2fdf2c062be5f7a27f058e51cbca (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=1 and VICTORY_D3D12_WARP=1 set for every run; victory-gpu tests 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.

  • Focused: cargo test -j 4 --locked -p victory-gpu --features diagnostics empty_draws_do_not_request -> pipeline::make::tests::empty_draws_do_not_request_graphics_pipelines 1 passed (ran, not skipped: it needs a D3D12 device and WARP provided one).
  • Full crate: 199 passed, 0 failed, 1 ignored. origin/main baseline (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 touch memory.rs.
  • cargo clippy -j 4 --locked -p victory-gpu --all-targets [--features diagnostics | --all-features] -- -D warnings: clean.
  • Negative control: restored draw.rs from origin/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.
  • Code read: both guards sit before the diagnostics trace, so empty draws no longer show up in the trace either; that looks intended but is a visible change.
  • Nit, not blocking: the test is in pipeline/make.rs but exercises draw.rs through 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.

**@⁠oni-swr** on GitHub · 2026-11-25 18:13 UTC · [original](https://github.com/Marvisak/VIctory/pull/2654#issuecomment-7170611402) **Independent verification of head `5a603b00b1343bea8188de74bfb7a5521161b9b3`** on `origin/main` `13f91caee25f2fdf2c062be5f7a27f058e51cbca` (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=1` and `VICTORY_D3D12_WARP=1` set for every run; `victory-gpu` tests 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. - Focused: `cargo test -j 4 --locked -p victory-gpu --features diagnostics empty_draws_do_not_request` -> `pipeline::make::tests::empty_draws_do_not_request_graphics_pipelines` 1 passed (ran, not skipped: it needs a D3D12 device and WARP provided one). - Full crate: 199 passed, 0 failed, 1 ignored. `origin/main` baseline (`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 touch `memory.rs`. - `cargo clippy -j 4 --locked -p victory-gpu --all-targets [--features diagnostics | --all-features] -- -D warnings`: clean. - **Negative control:** restored `draw.rs` from `origin/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. - Code read: both guards sit before the diagnostics trace, so empty draws no longer show up in the trace either; that looks intended but is a visible change. - Nit, not blocking: the test is in `pipeline/make.rs` but exercises `draw.rs` through 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.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 22:18 UTC · original

Automated triage for the maintainers.

Merge candidate. State::draw and State::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 in pipeline/make.rs drives 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; CI check: passing.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 22:18 UTC · [original](https://github.com/Marvisak/VIctory/pull/2654#issuecomment-7176206340) <!-- victory-triage v1 head=5a603b00b1343bea8188de74bfb7a5521161b9b3 verdict=merge-candidate at=2026-11-25T22:18:40Z --> Automated triage for the maintainers. **Merge candidate.** `State::draw` and `State::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 in `pipeline/make.rs` drives 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; CI `check`: passing. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠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 new empty_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).

**@⁠Dukestar69** on GitHub · 2026-11-26 04:49 UTC · [original](https://github.com/Marvisak/VIctory/pull/2654#pullrequestreview-6068699999) · **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 new `empty_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).
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 12:54 UTC · original · approved these changes

Reviewed and verified 5a603b00 merged locally onto origin/main (63bcca43) on Windows 11 x64 (NVIDIA GeForce RTX 5090 and WARP, Rust 1.98.1 MSVC, Windows SDK 10.0.26100.0 dxil.dll; synthetic tests only, no game files).

Verification

  • git merge-tree against origin/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.
  • RTX 5090 (merged, default): cargo test --locked -p victory-gpu --lib -- pipeline::make::tests draw::tests — 23 passed, 0 failed (including empty_draws_do_not_request_graphics_pipelines).
  • RTX 5090 (VICTORY_D3D12_DEBUG=1, --features diagnostics): 24 passed, 0 failed.
  • WARP (VICTORY_D3D12_WARP=1, VICTORY_D3D12_DEBUG=1, --features diagnostics): 24 passed, 0 failed.
  • Combined #2654 + #2696 on 63bcca43 (RTX 5090): Clippy clean in both feature modes; pipeline::tests, pipeline::make::tests, and draw::tests — 27 passed, 0 failed.

Review Notes

  • Early-returning in State::draw (crates/victory-gpu/src/draw.rs:1486-1496) and State::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 before self.prepare avoids queuing host PSO work or burning pipeline wait budget while leaving draw::State untouched for subsequent non-empty draws.
  • The guest-vtable regression test in crates/victory-gpu/src/pipeline/make.rs:340-401 cleanly covers all four zero-count combinations plus both non-empty controls.

Looks good to merge.

**@⁠fuzeofficlal** on GitHub · 2026-11-26 12:54 UTC · [original](https://github.com/Marvisak/VIctory/pull/2654#pullrequestreview-6074470846) · **approved these changes** Reviewed and verified `5a603b00` merged locally onto `origin/main` (`63bcca43`) on Windows 11 x64 (NVIDIA GeForce RTX 5090 and WARP, Rust `1.98.1` MSVC, Windows SDK `10.0.26100.0` `dxil.dll`; synthetic tests only, no game files). ### Verification - `git merge-tree` against `origin/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. - **RTX 5090 (merged, default):** `cargo test --locked -p victory-gpu --lib -- pipeline::make::tests draw::tests` — **23 passed, 0 failed** (including `empty_draws_do_not_request_graphics_pipelines`). - **RTX 5090 (`VICTORY_D3D12_DEBUG=1`, `--features diagnostics`):** **24 passed, 0 failed**. - **WARP (`VICTORY_D3D12_WARP=1`, `VICTORY_D3D12_DEBUG=1`, `--features diagnostics`):** **24 passed, 0 failed**. - **Combined `#2654 + #2696` on `63bcca43` (RTX 5090):** Clippy clean in both feature modes; `pipeline::tests`, `pipeline::make::tests`, and `draw::tests` — **27 passed, 0 failed**. ### Review Notes - Early-returning in `State::draw` (`crates/victory-gpu/src/draw.rs:1486-1496`) and `State::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 before `self.prepare` avoids queuing host PSO work or burning pipeline wait budget while leaving `draw::State` untouched for subsequent non-empty draws. - The guest-vtable regression test in `crates/victory-gpu/src/pipeline/make.rs:340-401` cleanly covers all four zero-count combinations plus both non-empty controls. Looks good to merge.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2654/head:github-bot/gh-2654'
git switch 'github-bot/gh-2654'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2654'
git switch 'github-bot/gh-2654'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2654'
git switch 'github-bot/gh-2654'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2654'
git switch 'main'
git merge --squash 'github-bot/gh-2654'
git switch 'main'
git merge --ff-only 'github-bot/gh-2654'
git switch 'main'
git merge 'github-bot/gh-2654'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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/Marvisak--VIctory!2654
No description provided.