Skip to content

GPU: skip empty direct draw calls - #2939

Closed
andrewpozdnakov7-jpg wants to merge 1 commit into
Marvisak:mainfrom
andrewpozdnakov7-jpg:codex1/skip-zero-count-draws
Closed

andrewpozdnakov7-jpg wants to merge 1 commit into
Marvisak:mainfrom
andrewpozdnakov7-jpg:codex1/skip-zero-count-draws

Conversation

@andrewpozdnakov7-jpg

Copy link
Copy Markdown
Contributor

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 <andrewpozdnakov7-jpg@users.noreply.github.com>.

AI-assisted with Codex. Synthetic tests only.

@fuzeofficlal

Copy link
Copy Markdown
Contributor

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.

@andrewpozdnakov7-jpg

Copy link
Copy Markdown
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants