GPU: skip empty direct draw calls #2939

Closed
github-bot wants to merge 1 commit from gh-pr/2939/head into gh-pr/2939/base
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-26 00:56 UTC · original
andrewpozdnakov7-jpg:codex1/skip-zero-count-draws → main · +50 −0 · 2 files · 1 commits · closed without merging

A direct DrawInstanced or DrawIndexedInstanced with zero vertices, indices, or instances still requests a pending graphics pipeline today. Return before preparation when either count is zero. The list still counts the guest call, and nonempty draws keep requesting their pipeline. This is the direct-graphics counterpart of #2556, and the two branches merge cleanly.

The same Windows/WARP test exercises both entry points, with a fresh pending pipeline per case. For each entry point the cases are zero vertices or indices, zero instances, and a nonempty draw.

Revision Unindexed demand Indexed demand
63bcca43c6a00a758510398fa43096ce7e4f7df0 yes, yes, yes yes, yes, yes
1440d8c711364b85914ad0cc7a4c788e9921e7c9 no, no, yes no, no, yes

The regression failed on main and passed with the patch in all six paired runs. Full WARP GPU suite passed with 247 tests and one ignored under both D3D12 debug settings. Strict GPU Clippy in both configurations and asset policy passed.

Coordination · DrawInstanced · DrawIndexedInstanced

Please retain the Git author if cherry-picking the change. If folding the fix or test into another commit, please include Co-authored-by: andrewpozdnakov7-jpg <[email protected]>.

AI-assisted with Codex. Synthetic tests only.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-26 00:56 UTC · [original](https://github.com/Marvisak/VIctory/pull/2939) `andrewpozdnakov7-jpg:codex1/skip-zero-count-draws` → `main` · +50 −0 · 2 files · 1 commits · closed without merging A direct `DrawInstanced` or `DrawIndexedInstanced` with zero vertices, indices, or instances still requests a pending graphics pipeline today. Return before preparation when either count is zero. The list still counts the guest call, and nonempty draws keep requesting their pipeline. This is the direct-graphics counterpart of #2556, and the two branches merge cleanly. The same Windows/WARP test exercises both entry points, with a fresh pending pipeline per case. For each entry point the cases are zero vertices or indices, zero instances, and a nonempty draw. | Revision | Unindexed demand | Indexed demand | | --- | --- | --- | | `63bcca43c6a00a758510398fa43096ce7e4f7df0` | yes, yes, yes | yes, yes, yes | | `1440d8c711364b85914ad0cc7a4c788e9921e7c9` | no, no, yes | no, no, yes | The regression failed on main and passed with the patch in all six paired runs. Full WARP GPU suite passed with 247 tests and one ignored under both D3D12 debug settings. Strict GPU Clippy in both configurations and asset policy passed. [Coordination](https://git.gtahub.st/github/Marvisak--VIctory/issues/1633) · [DrawInstanced](https://learn.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12graphicscommandlist-drawinstanced) · [DrawIndexedInstanced](https://learn.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12graphicscommandlist-drawindexedinstanced) Please retain the Git author if cherry-picking the change. If folding the fix or test into another commit, please include `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>`. AI-assisted with Codex. Synthetic tests only.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:18:01 +00:00
github-bot closed this pull request 2026-11-26 05:18:01 +00:00
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 01:08 UTC · original

Code review and RTX 5090 + WARP verification at head 1440d8c71136 merged cleanly onto main (63bcca43c6a0):

  • Code review (crates/victory-gpu/src/draw.rs:1563-1565, 1670-1672):
    • Returning early on vertices == 0 || instances == 0 in State::draw and indices == 0 || instances == 0 in State::draw_indexed skips trace, completes_rectangles (host_pipeline), and prepare so zero-count direct draws never push unused graphics pipelines into on-demand compilation (host.used).
    • Title state fields remain independently tracked on State and lazily sync against host snapshots on the next non-empty draw, with no state desync or missed resource transitions.
  • Verified (Windows 11, NVIDIA RTX 5090 + WARP, VICTORY_D3D12_DEBUG=1, Rust 1.98.1):
    • cargo xtask policy: 191 files ok; cargo clippy (default + --features diagnostics): 0 warnings
    • draw::tests pipeline:: list::: 48/48 passed on RTX 5090 (default) and 51/51 passed on WARP (--features diagnostics), including zero_count_draws_do_not_request_graphics_pipelines.

LGTM.

**@⁠fuzeofficlal** on GitHub · 2026-11-26 01:08 UTC · [original](https://github.com/Marvisak/VIctory/pull/2939#issuecomment-7179469934) Code review and RTX 5090 + WARP verification at head `1440d8c71136` merged cleanly onto `main` (`63bcca43c6a0`): - **Code review (`crates/victory-gpu/src/draw.rs:1563-1565, 1670-1672`)**: - Returning early on `vertices == 0 || instances == 0` in `State::draw` and `indices == 0 || instances == 0` in `State::draw_indexed` skips `trace`, `completes_rectangles` (`host_pipeline`), and `prepare` so zero-count direct draws never push unused graphics pipelines into on-demand compilation (`host.used`). - Title state fields remain independently tracked on `State` and lazily sync against host snapshots on the next non-empty draw, with no state desync or missed resource transitions. - **Verified (Windows 11, NVIDIA RTX 5090 + WARP, `VICTORY_D3D12_DEBUG=1`, Rust 1.98.1)**: - `cargo xtask policy`: `191 files ok`; `cargo clippy` (default + `--features diagnostics`): 0 warnings - `draw::tests pipeline:: list::`: **48/48 passed** on RTX 5090 (default) and **51/51 passed** on WARP (`--features diagnostics`), including `zero_count_draws_do_not_request_graphics_pipelines`. LGTM.
Author
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-26 01:12 UTC · original

Closing the duplicate in favor of #2654, which already has the same fix and covers both graphics entry points through the guest list vtable.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-26 01:12 UTC · [original](https://github.com/Marvisak/VIctory/pull/2939#issuecomment-7179539347) Closing the duplicate in favor of #2654, which already has the same fix and covers both graphics entry points through the guest list vtable.

Pull request closed

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!2939
No description provided.