Diagnostics: VICTORY_D3D12_WARP=0 still selects the software adapter #610

Closed
opened 2026-11-26 04:09:54 +00:00 by github-bot · 3 comments
Owner

@⁠Fluxxer763664 on GitHub · 2026-11-24 05:35 UTC · original

While comparing hardware and WARP results for #533, a run with VICTORY_D3D12_WARP=0 still showed d3d10warp.dll in the crash stack. Removing the variable was the workaround.

At d2a4bae, crates/victory-gpu/src/host.rs checks only whether the variable exists with var_os(...).is_some(). The adapter-selection proposal in #208 retains that behavior.

I tested a small patch that treats 0 like an unset variable and preserves the documented 1 and existing behavior for other values. Keep the diagnostics feature gate and change the predicate to:

std::env::var_os("VICTORY_D3D12_WARP").is_some_and(|value| value != "0")

On Windows, cargo test --locked -p victory-gpu --features diagnostics warp_ passed both the setting regression test (unset, 0, 1, empty) and the existing adapter test. This addresses adapter selection for diagnostics. The world-rendering crash is tracked in #533.

AI-assisted.

**@⁠Fluxxer763664** on GitHub · 2026-11-24 05:35 UTC · [original](https://github.com/Marvisak/VIctory/issues/610) While comparing hardware and WARP results for #533, a run with `VICTORY_D3D12_WARP=0` still showed `d3d10warp.dll` in the crash stack. Removing the variable was the workaround. At `d2a4bae`, `crates/victory-gpu/src/host.rs` checks only whether the variable exists with `var_os(...).is_some()`. The adapter-selection proposal in #208 retains that behavior. I tested a small patch that treats `0` like an unset variable and preserves the documented `1` and existing behavior for other values. Keep the diagnostics feature gate and change the predicate to: ```rust std::env::var_os("VICTORY_D3D12_WARP").is_some_and(|value| value != "0") ``` On Windows, `cargo test --locked -p victory-gpu --features diagnostics warp_` passed both the setting regression test (unset, `0`, `1`, empty) and the existing adapter test. This addresses adapter selection for diagnostics. The world-rendering crash is tracked in #533. AI-assisted.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:09:54 +00:00
Author
Owner

@⁠LAKSHYA-cmd-tech on GitHub · 2026-11-24 08:30 UTC · original

Implemented and verified:
std::env::var_os("VICTORY_D3D12_WARP").is_some_and(|value| value != "0") now correctly treats VICTORY_D3D12_WARP=0 as unset, preserving the software adapter only when set to 1 or other truthy values.
Added unit test warp_adapter_setting_ignores_zero.

Verification on Windows 11 MSVC:

  • cargo test -p victory-gpu --features diagnostics passed (53 passed, 1 ignored benchmark).
  • cargo clippy -p victory-gpu --features diagnostics --all-targets -- -D warnings clean with zero warnings.
  • cargo xtask policy verified (152 files ok).

Branch:
https://github.com/LAKSHYA-cmd-tech/VIctory/tree/fix/diagnostics-warp-zero-check

**@⁠LAKSHYA-cmd-tech** on GitHub · 2026-11-24 08:30 UTC · [original](https://github.com/Marvisak/VIctory/issues/610#issuecomment-7126214542) Implemented and verified: `std::env::var_os("VICTORY_D3D12_WARP").is_some_and(|value| value != "0")` now correctly treats `VICTORY_D3D12_WARP=0` as unset, preserving the software adapter only when set to `1` or other truthy values. Added unit test `warp_adapter_setting_ignores_zero`. Verification on Windows 11 MSVC: - `cargo test -p victory-gpu --features diagnostics` passed (53 passed, 1 ignored benchmark). - `cargo clippy -p victory-gpu --features diagnostics --all-targets -- -D warnings` clean with zero warnings. - `cargo xtask policy` verified (152 files ok). Branch: https://github.com/LAKSHYA-cmd-tech/VIctory/tree/fix/diagnostics-warp-zero-check
Author
Owner

@⁠0xmp3 on GitHub · 2026-11-24 09:57 UTC · original

Still present at 8e79c80: crates/victory-gpu/src/host.rs:179 checks var_os(..).is_some(), so VICTORY_D3D12_WARP=0 selects the software adapter.

I took the route you described, but gave the setting its own predicate so it can have a regression test rather than only the adapter probe:

-        if cfg!(feature = "diagnostics") && std::env::var_os("VICTORY_D3D12_WARP").is_some() {
+        if cfg!(feature = "diagnostics")
+            && warp_requested(std::env::var_os("VICTORY_D3D12_WARP").as_deref())
+        {
             let adapter = warp_adapter()?;
/// Diagnostics: whether `VICTORY_D3D12_WARP` asked for the software adapter.
/// `0` reads as unset, so a script that sets every switch can turn this one
/// off; an empty value still selects WARP, as it always has.
fn warp_requested(value: Option<&std::ffi::OsStr>) -> bool {
    value.is_some_and(|value| value != "0")
}
#[test]
fn warp_switch_reads_zero_as_off() {
    use std::ffi::OsStr;
    assert!(!warp_requested(None), "unset selects the hardware adapter");
    assert!(!warp_requested(Some(OsStr::new("0"))), "0 must mean off");
    assert!(warp_requested(Some(OsStr::new("1"))), "1 selects WARP");
    assert!(warp_requested(Some(OsStr::new(""))), "empty selects WARP, as before");
}

Evidence on this machine (Windows 11, RX 9070 XT / gfx1201, Ryzen 5 5600, Rust 1.98.1, MSVC):

  • With the old is_some() predicate put back, the test fails at host.rs:270 (0 must mean off); with the fix it passes. So the test pins the behaviour rather than the helper's existence.
  • cargo clippy -p victory-gpu --all-targets --locked -- -D warnings: clean. Same with --all-features: clean.
  • cargo test --workspace: 312 passed, 0 failed (311 before this test).

An empty value still selects WARP, so no existing script changes meaning. Scope: this covers the predicate and its test; I did not run the title under either setting, so adapter selection itself is unobserved here.

Not opening a PR because external creation is collaborators_only right now (#712). If a linked branch is more useful than a patch in a comment, say so and I will push it to a fork — the whole change is crates/victory-gpu/src/host.rs, 12 added lines.

AI-assisted (Hermes Agent).

**@⁠0xmp3** on GitHub · 2026-11-24 09:57 UTC · [original](https://github.com/Marvisak/VIctory/issues/610#issuecomment-7128117105) Still present at `8e79c80`: `crates/victory-gpu/src/host.rs:179` checks `var_os(..).is_some()`, so `VICTORY_D3D12_WARP=0` selects the software adapter. I took the route you described, but gave the setting its own predicate so it can have a regression test rather than only the adapter probe: ```diff - if cfg!(feature = "diagnostics") && std::env::var_os("VICTORY_D3D12_WARP").is_some() { + if cfg!(feature = "diagnostics") + && warp_requested(std::env::var_os("VICTORY_D3D12_WARP").as_deref()) + { let adapter = warp_adapter()?; ``` ```rust /// Diagnostics: whether `VICTORY_D3D12_WARP` asked for the software adapter. /// `0` reads as unset, so a script that sets every switch can turn this one /// off; an empty value still selects WARP, as it always has. fn warp_requested(value: Option<&std::ffi::OsStr>) -> bool { value.is_some_and(|value| value != "0") } ``` ```rust #[test] fn warp_switch_reads_zero_as_off() { use std::ffi::OsStr; assert!(!warp_requested(None), "unset selects the hardware adapter"); assert!(!warp_requested(Some(OsStr::new("0"))), "0 must mean off"); assert!(warp_requested(Some(OsStr::new("1"))), "1 selects WARP"); assert!(warp_requested(Some(OsStr::new(""))), "empty selects WARP, as before"); } ``` Evidence on this machine (Windows 11, RX 9070 XT / gfx1201, Ryzen 5 5600, Rust 1.98.1, MSVC): - With the old `is_some()` predicate put back, the test **fails** at `host.rs:270` (`0 must mean off`); with the fix it passes. So the test pins the behaviour rather than the helper's existence. - `cargo clippy -p victory-gpu --all-targets --locked -- -D warnings`: clean. Same with `--all-features`: clean. - `cargo test --workspace`: 312 passed, 0 failed (311 before this test). An empty value still selects WARP, so no existing script changes meaning. Scope: this covers the predicate and its test; I did not run the title under either setting, so adapter selection itself is unobserved here. Not opening a PR because external creation is `collaborators_only` right now (#712). If a linked branch is more useful than a patch in a comment, say so and I will push it to a fork — the whole change is `crates/victory-gpu/src/host.rs`, 12 added lines. AI-assisted (Hermes Agent).
Author
Owner

@⁠Sunkiller-qc on GitHub · 2026-11-24 12:54 UTC · original

Two open PRs fix this: #615 (any VICTORY_* switch set to 0 counts as off) and #695 (only VICTORY_D3D12_WARP=0). Bug confirmed again at 8e79c80 (host.rs:179 checks is_some()). #615 is the broader one. Merging one of them and closing the other would close this.

**@⁠Sunkiller-qc** on GitHub · 2026-11-24 12:54 UTC · [original](https://github.com/Marvisak/VIctory/issues/610#issuecomment-7132074251) Two open PRs fix this: #615 (any `VICTORY_*` switch set to 0 counts as off) and #695 (only `VICTORY_D3D12_WARP=0`). Bug confirmed again at `8e79c80` (`host.rs:179` checks `is_some()`). #615 is the broader one. Merging one of them and closing the other would close this.
This discussion has been locked. Commenting is limited to contributors.
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#610
No description provided.