Skip to content

gpu: VICTORY_D3D12_WARP=0 opts out of the software adapter - #695

Open
arthercz wants to merge 3 commits into
Marvisak:mainfrom
arthercz:warp-env-fix
Open

arthercz wants to merge 3 commits into
Marvisak:mainfrom
arthercz:warp-env-fix

Conversation

@arthercz

Copy link
Copy Markdown

Closes #610.

The diagnostics gate checked only the variable's presence, so VICTORY_D3D12_WARP=0 still created the device on WARP; the workaround was to remove the variable entirely.

This treats 0 like unset, keeps the documented 1 and presence-means-on for other values, and keeps the diagnostics feature gate. The predicate moves into warp_selected/warp_selected_at, covered by a table test (unset, 0, 1, empty); README documents the opt-out.

Verified: cargo test -p victory-gpu --features diagnostics --locked warp_ passes (both the new gate test and the existing adapter test); cargo test --workspace 265 passed; cargo clippy --workspace --all-features clean.

…with-default

- cargo fmt: 168 formatting differences in 32 files
- xmem.rs: initialize PERFORMANCE_INFORMATION cb in the struct literal
  (clippy::field_reassign_with_default)
Speech streams were valid empty WAVE files, so the title's narration
(accessibility menus and the like) was silent. Route text (0x68) and
SSML (0xa8) through Windows.Media.SpeechSynthesis and hand the title the
spoken RIFF stream; when the host has no voice (no voices installed,
WinRT unavailable), keep the empty-WAVE fallback so the title still
plays the stream and goes on.

- streams become boxed handles, reclaimed by close (0x70); the
  synthesizer handle stays a fixed address
- enumerate_voices stays a no-op: no title of ours asks, and the host's
  default voice speaks
- the windows crate moves out of the diagnostics-only feature so its
  WinRT bindings link in release builds too

Verified on Windows 11: the unit test now speaks "Hello" and validates
the returned WAVE (RIFF chunk walk, PCM 16 kHz mono 16-bit, non-empty
data); cargo test --workspace 264 passed.
The diagnostics gate checked only the variable's presence, so
VICTORY_D3D12_WARP=0 still created the device on WARP; the workaround was
to remove the variable entirely (issue Marvisak#610).

Treat "0" like unset, keep documented "1" and presence-means-on for
other values, and keep the diagnostics feature gate. The predicate moves
into warp_selected/warp_selected_at, covered by a table test (unset, 0,
1, empty); README documents the opt-out.

Verified: cargo test -p victory-gpu --features diagnostics --locked
warp_ passes; cargo clippy --workspace --all-features clean.

@LAKSHYA-cmd-tech LAKSHYA-cmd-tech left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on Windows 11 MSVC:

  • cargo test -p victory-gpu --features diagnostics warp_: 2 passed, 0 failed (host::tests::warp_env_gate table test and warp_adapter_accepts_only_software both pass)
  • cargo xtask policy: 151 files ok

Note: Stacked on #691 (and #692). Once those land, the diff will cleanly reduce to the 2 files (README.md and host.rs).

@catminou4 catminou4 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same branch-shape note as on #699: this PR carries #692's fmt commit and #691's speech commit; only the tip b91ff3c ("gpu: VICTORY_D3D12_WARP=0 opts out") is this PR's change (closes #610). Rebase/retarget before review.

Reviewed the tip commit itself (host.rs +25, README +1):

  • warp_selected() now parses the env value: =0 opts out like unset, 1 on, any other value keeps the historical presence-means-on behavior — backward compatible and documented in the README row.
  • The warp_selected_at(Option<&OsStr>) seam makes the decision unit-testable, and there's a #[test] for it. The cfg!(feature = "diagnostics") gate is preserved.
  • Static only — victory-gpu is Windows/D3D12, so the adapter-selection behavior itself needs the Windows diagnostics build; the parsing logic is the portable part and it's covered by the unit test.

@mercuryVM mercuryVM left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested b91ff3c on Windows 11, RTX 5070, MSVC: cargo test --workspace --exclude victory-shader 196 passed, and cargo test -p victory-gpu --features diagnostics warp_ 2 passed. Clippy shows 3 undocumented_unsafe_blocks warnings, at host.rs:294, list.rs:1452 and watch.rs:368. The same lines are already on main, so they aren't new here.

  • The change itself (warp_selected_at: 0 behaves like unset, any other value, including empty, turns WARP on, still under cfg!(feature = "diagnostics")) is correct, and the table test covers it.
  • Scope: this branch has three commits. It also carries the workspace cargo fmt (#692) and the WinRT speech narration (#691), which accounts for 38 files including the new windows-future dependency and the windows dependency in victory-hle becoming non-optional. Those belong to their own PRs. Please rebase this onto main so it holds only the WARP commit (host.rs and README). As it stands, approving this would also approve #691.

AI-assisted (Claude Code).

Copy link
Copy Markdown
Owner

Automated triage for the maintainers.

Needs rebase. This PR does not merge cleanly into current main (ac2525d). Conflicting files: README.md, crates/victory-gpu/src/capture.rs, crates/victory-gpu/src/descriptor/host.rs, crates/victory-gpu/src/draw.rs, crates/victory-gpu/src/host.rs, crates/victory-gpu/src/list.rs, crates/victory-gpu/src/pipeline/library.rs, crates/victory-gpu/src/pipeline/make.rs and 6 more.

The content has not been reviewed yet; it will be once the branch is rebased onto main.


Generated by Claude Code

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Diagnostics: VICTORY_D3D12_WARP=0 still selects the software adapter

5 participants