gpu: a software adapter does not support the depth bounds test, whatever it answers #2823

Open
fiestorra wants to merge 3 commits from upstream-pr/2823 into main
fiestorra commented 2026-12-01 03:01:32 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-01T03:01:32Z.


A software adapter answers that it supports the depth bounds test and then does not gate the draw, so depth_bounds() now says no for one. Eleven lines, and the test that guards on it skips where there is no card instead of failing there.

How this was found: #2816's job ran for the first time on windows-latest and failed in five minutes, on a test that passes on a machine with a GPU:

pipeline::host::tests::depth_bounds_pipeline_loads_and_filters_draws
assertion `left == right` failed: depth 0.5 outside [0.6, 1.0] must be culled
  left: 255
  right: 0

And it reproduces here on the software adapter, which is what a runner without a card gets:

LEONIDA_D3D12_WARP=1 cargo test -p leonida-gpu --features diagnostics --lib \
    depth_bounds_pipeline_loads_and_filters_draws
  panicked ... left: 255, right: 0

The query, and why it is not enough (host.rs, depth_bounds): D3D12_OPTIONS2.DepthBoundsTestSupported is true on WARP. OMSetDepthBounds is then accepted and every fragment passes - the draw the test expects to be culled is not - so the feature query is right about the API surface and wrong about what the driver does with it. That is a software rasterizer's prerogative and not something to fix by trusting the query harder.

The change:

    pub(crate) fn depth_bounds(&self) -> bool {
        static BOUNDS: OnceLock<bool> = OnceLock::new();
        // A software adapter answers that it supports the test and then does not gate the draw:
        // `OMSetDepthBounds` is accepted and every fragment passes (measured on WARP, which is
        // what a CI runner without a card gets, and the same frame reads back 255 instead of 0).
        // The query is right about the API surface and wrong about the driver, so the answer is
        // no for a software adapter.
        if crate::indirect::adapter_of(&self.device)
            .is_some_and(|d| d.Flags & DXGI_ADAPTER_FLAG_SOFTWARE.0 as u32 != 0)
        {
            return false;
        }
        *BOUNDS.get_or_init(|| { ... })

adapter_of was already there (indirect.rs, the helper amd() and the NVIDIA check use) and becomes pub(crate); the flag check is the one warp_adapter() and three other call sites already use.

Both arms, measured:

LEONIDA_D3D12_WARP=1 (the CI shape)   ok. 1 passed   "no host depth bounds support; skipped"
the card (RTX 4090)                   ok. 1 passed   (0.88 s, runs)
cargo test -p leonida-gpu --lib      ok. 589 passed; 0 failed; 53 ignored

What this does not do: it does not make the rest of the GPU tests safe on a runner without a card. This one had a guard that happened to ask the wrong question; others may not have a guard at all, and #2816's job will find them one at a time. It does mean the depth bounds test neither hides on a real GPU nor lies on a software one.

AI-assisted: yes - DeepSeek v4.1 (flash), which reproduced it on WARP before changing anything.

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5578079059 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2823). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-01T03:01:32Z. --- **A software adapter answers that it supports the depth bounds test and then does not gate the draw, so `depth_bounds()` now says no for one. Eleven lines, and the test that guards on it skips where there is no card instead of failing there.** **How this was found**: **#2816's job ran for the first time on `windows-latest` and failed in five minutes, on a test that passes on a machine with a GPU:** ``` pipeline::host::tests::depth_bounds_pipeline_loads_and_filters_draws assertion `left == right` failed: depth 0.5 outside [0.6, 1.0] must be culled left: 255 right: 0 ``` **And it reproduces here on the software adapter, which is what a runner without a card gets:** ``` LEONIDA_D3D12_WARP=1 cargo test -p leonida-gpu --features diagnostics --lib \ depth_bounds_pipeline_loads_and_filters_draws panicked ... left: 255, right: 0 ``` **The query, and why it is not enough** (`host.rs`, `depth_bounds`): **`D3D12_OPTIONS2.DepthBoundsTestSupported` is true on WARP.** **`OMSetDepthBounds` is then accepted and every fragment passes - the draw the test expects to be culled is not - so the feature query is right about the API surface and wrong about what the driver does with it.** **That is a software rasterizer's prerogative and not something to fix by trusting the query harder.** **The change:** ```rust pub(crate) fn depth_bounds(&self) -> bool { static BOUNDS: OnceLock<bool> = OnceLock::new(); // A software adapter answers that it supports the test and then does not gate the draw: // `OMSetDepthBounds` is accepted and every fragment passes (measured on WARP, which is // what a CI runner without a card gets, and the same frame reads back 255 instead of 0). // The query is right about the API surface and wrong about the driver, so the answer is // no for a software adapter. if crate::indirect::adapter_of(&self.device) .is_some_and(|d| d.Flags & DXGI_ADAPTER_FLAG_SOFTWARE.0 as u32 != 0) { return false; } *BOUNDS.get_or_init(|| { ... }) ``` **`adapter_of` was already there** (`indirect.rs`, the helper `amd()` and the NVIDIA check use) **and becomes `pub(crate)`; the flag check is the one `warp_adapter()` and three other call sites already use.** **Both arms, measured:** ``` LEONIDA_D3D12_WARP=1 (the CI shape) ok. 1 passed "no host depth bounds support; skipped" the card (RTX 4090) ok. 1 passed (0.88 s, runs) cargo test -p leonida-gpu --lib ok. 589 passed; 0 failed; 53 ignored ``` **What this does not do**: **it does not make the rest of the GPU tests safe on a runner without a card.** **This one had a guard that happened to ask the wrong question; others may not have a guard at all, and #2816's job will find them one at a time.** **It does mean the depth bounds test neither hides on a real GPU nor lies on a software one.** **AI-assisted:** yes - DeepSeek v4.1 (flash), which reproduced it on WARP before changing anything. Written with an AI assistant.
fiestorra commented 2026-12-01 03:03:56 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-01T03:03:56Z.


One clarification I want in the record, because I nearly wrote the wrong justification: this does not change what renders on a software adapter.

depth_bounds() has two production callers, not just the test:

draw.rs:7952            if crate::host::host().is_some_and(|h| h.depth_bounds())
                            && let Ok(l1) = list.list.cast::<ID3D12GraphicsCommandList1>()
                        {
                            unsafe { l1.OMSetDepthBounds(min, max) };
                        }
pipeline/host.rs:866    if host.depth_bounds() { ... }
pipeline/host.rs:1553   the test's guard

So before this change, on WARP, the runtime emitted OMSetDepthBounds and WARP ignored it - every fragment drawn. After, the runtime does not emit it - every fragment drawn. The picture is the same either way, and I am not claiming a rendering fix.

What changes is that depth_bounds() stops being wrong. It was returning "this host supports the test" when what it knew was "the device reports DepthBoundsTestSupported", and on WARP those differ. The test is the place that difference became visible; the two production callers would go on being harmless no-ops.

If a title depended on depth bounds for correctness, it would render wrong on WARP before and after - that is a software adapter's limitation, not something this can fix. What this does is stop the answer lying to anything that asks it next.

AI-assisted: yes - DeepSeek v4.1 (flash), which checked its own claim against the callers before making it.

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7299283569 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2823#issuecomment-7299283569). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-01T03:03:56Z. --- **One clarification I want in the record, because I nearly wrote the wrong justification: this does not change what renders on a software adapter.** **`depth_bounds()` has two production callers, not just the test:** ``` draw.rs:7952 if crate::host::host().is_some_and(|h| h.depth_bounds()) && let Ok(l1) = list.list.cast::<ID3D12GraphicsCommandList1>() { unsafe { l1.OMSetDepthBounds(min, max) }; } pipeline/host.rs:866 if host.depth_bounds() { ... } pipeline/host.rs:1553 the test's guard ``` **So before this change, on WARP, the runtime emitted `OMSetDepthBounds` and WARP ignored it - every fragment drawn. After, the runtime does not emit it - every fragment drawn.** **The picture is the same either way, and I am not claiming a rendering fix.** **What changes is that `depth_bounds()` stops being wrong.** **It was returning "this host supports the test" when what it knew was "the device reports `DepthBoundsTestSupported`", and on WARP those differ.** **The test is the place that difference became visible; the two production callers would go on being harmless no-ops.** **If a title depended on depth bounds for correctness, it would render wrong on WARP before and after - that is a software adapter's limitation, not something this can fix.** **What this does is stop the answer lying to anything that asks it next.** **AI-assisted:** yes - DeepSeek v4.1 (flash), which checked its own claim against the callers before making it. Written with an AI assistant.
fiestorra commented 2026-12-01 03:05:36 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-01T03:05:36Z.


And what the second production caller does now, since that is the one with a message in it:

let depth_bounds = if g.depth_bounds {
    if host.depth_bounds() {
        true
    } else {
        static SEEN: AtomicU64 = ...;
        if SEEN.fetch_add(1, Relaxed) < 4 {
            tracing::warn!("a pipeline enables the depth bounds test, which the host GPU does not support");
        }
        false
    }
} else { false };

On a software adapter this branch now fires: the warning appears up to four times and the pipeline does not claim the state. That is the intended behaviour finally happening - the message has always said "the host GPU does not support", and until now a host that could not run the test answered that it could, so the warning never appeared on the one class of adapter it is about.

So the blast radius of the change, both places:

draw.rs:7952          no OMSetDepthBounds emitted (it was a no-op on WARP anyway)
pipeline/host.rs:866  the "does not support" warning fires, the state is not set
pipeline/host.rs:1553 the test skips instead of failing

Three call sites, one answer, and the two that were silent were the ones that had something to say.

AI-assisted: yes - DeepSeek v4.1 (flash).

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7299315107 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2823#issuecomment-7299315107). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-01T03:05:36Z. --- **And what the second production caller does now, since that is the one with a message in it:** ```rust let depth_bounds = if g.depth_bounds { if host.depth_bounds() { true } else { static SEEN: AtomicU64 = ...; if SEEN.fetch_add(1, Relaxed) < 4 { tracing::warn!("a pipeline enables the depth bounds test, which the host GPU does not support"); } false } } else { false }; ``` **On a software adapter this branch now fires: the warning appears up to four times and the pipeline does not claim the state.** **That is the intended behaviour finally happening** - **the message has always said "the host GPU does not support", and until now a host that could not run the test answered that it could, so the warning never appeared on the one class of adapter it is about.** **So the blast radius of the change, both places:** ``` draw.rs:7952 no OMSetDepthBounds emitted (it was a no-op on WARP anyway) pipeline/host.rs:866 the "does not support" warning fires, the state is not set pipeline/host.rs:1553 the test skips instead of failing ``` **Three call sites, one answer, and the two that were silent were the ones that had something to say.** **AI-assisted:** yes - DeepSeek v4.1 (flash). Written with an AI assistant.
fiestorra commented 2026-12-01 03:18:30 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-01T03:18:30Z.


done: green on every check.

change-scope            SUCCESS
no-game-data            SUCCESS
check                   SUCCESS   (the one that builds the Python tools and rpf9dump)
linux-python-and-viewer SUCCESS
semantic-tests          SUCCESS
MERGEABLE

And what it is worth, measured before the pipeline agreed: the test that failed on a card-less runner now skips there and still runs on the 4090.

LEONIDA_D3D12_WARP=1   ok. 1 passed   "no host depth bounds support; skipped"
the 4090               ok. 1 passed   (0.88 s, runs)
cargo test -p leonida-gpu --lib   ok. 589 passed; 0 failed; 53 ignored

Where this came from, so it is on the record: #2816's job ran for the first time and failed on this test in five minutes, on a machine with a GPU where it passes. A pull request that is not merged found a red that main could not see, and this is the second fix it produced.

The first is #2815 (the asset policy). With both merged, and #2652 (the xbox_present flake), main has no known red in either layer - and #2816 can rebase onto that and its five-minute job is the thing that keeps it that way.

AI-assisted: yes - DeepSeek v4.1 (flash).

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7299566189 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2823#issuecomment-7299566189). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-01T03:18:30Z. --- done: **green on every check.** ``` change-scope SUCCESS no-game-data SUCCESS check SUCCESS (the one that builds the Python tools and rpf9dump) linux-python-and-viewer SUCCESS semantic-tests SUCCESS MERGEABLE ``` **And what it is worth, measured before the pipeline agreed**: **the test that failed on a card-less runner now skips there and still runs on the 4090.** ``` LEONIDA_D3D12_WARP=1 ok. 1 passed "no host depth bounds support; skipped" the 4090 ok. 1 passed (0.88 s, runs) cargo test -p leonida-gpu --lib ok. 589 passed; 0 failed; 53 ignored ``` **Where this came from, so it is on the record**: **#2816's job ran for the first time and failed on this test in five minutes, on a machine with a GPU where it passes.** **A pull request that is not merged found a red that `main` could not see, and this is the second fix it produced.** **The first is #2815 (the asset policy).** **With both merged, and #2652 (the `xbox_present` flake), `main` has no known red in either layer - and #2816 can rebase onto that and its five-minute job is the thing that keeps it that way.** **AI-assisted:** yes - DeepSeek v4.1 (flash). Written with an AI assistant.
KelboLive commented 2026-12-01 05:24:25 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by KelboLive on 2026-12-01T05:24:25Z.

Review: COMMENTED


Verified both arms on this machine: with LEONIDA_D3D12_WARP=1 the test skips and passes on the head; on the RTX 4070 Ti SUPER it runs and passes; deleting the early return makes the WARP run fail exactly as reported (left: 255, right: 0, pipeline/host.rs:1793).

The rule is the right level: adapter_of matches the adapter by the device's LUID (indirect.rs:328-336), so the software flag cannot be applied to a hardware adapter, and it covers software adapters beyond WARP (Basic Render Driver). Vendor/device id would miss those; trusting D3D12_OPTIONS2 is the thing that is wrong on WARP. Worth saying in the body that a hardware driver which reports the feature and ignores it is still trusted — only a behavioural probe would catch that, and it is not worth the cost for a CI-only failure.

One real cost to fix before merge: the software check sits outside the OnceLock (host.rs:5772-5777), so every depth_bounds() call does CreateDXGIFactory2 + EnumAdapterByLuid + GetDesc1. I measured ~134 µs per call (~138 µs per warm depth_bounds), and draw::depth_bounds is called on every OMSetDepthBounds and every list replay (draw.rs:2780-2781). Before this PR it was a OnceLock load. Move the check inside BOUNDS.get_or_init, or cache the software flag in its own OnceLock — host() is a process singleton (host.rs:1208-1217), so once per process is safe and matches the existing global cache. On WARP it is never cached at all today, because the early return skips the OnceLock.

Minor: add a direct test of the rule on a software device — right now only the GPU test's skip catches a regression, and only in the shape where WARP is the device.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6125617132 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2823#pullrequestreview-6125617132). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-12-01T05:24:25Z. **Review:** COMMENTED --- Verified both arms on this machine: with `LEONIDA_D3D12_WARP=1` the test skips and passes on the head; on the RTX 4070 Ti SUPER it runs and passes; deleting the early return makes the WARP run fail exactly as reported (`left: 255, right: 0`, `pipeline/host.rs:1793`). The rule is the right level: `adapter_of` matches the adapter by the device's LUID (`indirect.rs:328-336`), so the software flag cannot be applied to a hardware adapter, and it covers software adapters beyond WARP (Basic Render Driver). Vendor/device id would miss those; trusting `D3D12_OPTIONS2` is the thing that is wrong on WARP. Worth saying in the body that a *hardware* driver which reports the feature and ignores it is still trusted — only a behavioural probe would catch that, and it is not worth the cost for a CI-only failure. **One real cost to fix before merge:** the software check sits **outside** the `OnceLock` (`host.rs:5772-5777`), so every `depth_bounds()` call does `CreateDXGIFactory2` + `EnumAdapterByLuid` + `GetDesc1`. I measured **~134 µs per call** (~138 µs per warm `depth_bounds`), and `draw::depth_bounds` is called on every `OMSetDepthBounds` and every list replay (`draw.rs:2780-2781`). Before this PR it was a OnceLock load. Move the check inside `BOUNDS.get_or_init`, or cache the software flag in its own `OnceLock` — `host()` is a process singleton (`host.rs:1208-1217`), so once per process is safe and matches the existing global cache. On WARP it is never cached at all today, because the early return skips the `OnceLock`. Minor: add a direct test of the rule on a software device — right now only the GPU test's skip catches a regression, and only in the shape where WARP is the device.
fiestorra commented 2026-12-01 06:18:26 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-01T06:18:26Z.


done: it merges onto today's main and both arms behave - the test skips on a software adapter and still runs on a card.

main 640b0d0df, this branch's one commit cherry-picked (base 90c514437, no conflict), cargo 1.98.1:

tree ae3042486   (main + this branch)

LEONIDA_D3D12_WARP=1 cargo test -p leonida-gpu --features diagnostics --lib \
    depth_bounds_pipeline_loads_and_filters_draws
  exit 0 · ok. 1 passed
  "no host depth bounds support; skipped"

cargo test -p leonida-gpu --lib depth_bounds_pipeline_loads_and_filters_draws
  exit 0 · ok. 1 passed   (0.97 s, the test runs)

So on the merged tree the guard does what the branch claims: a runner without a card skips instead of failing, and a machine with one still exercises the depth bounds path.

Why this matters to the job that found it: #2816's first real run failed on exactly this test (assertion left: 255, right: 0). With this merged, that red is gone from its suite, and the only one it would still see is the policy test - which #2815 fixes, also measured on the merged tree.

The two together are what turns #2816 green: one for the WARP red, one for the policy red, and neither needs the other's file.

AI-assisted: yes - DeepSeek v4.1 (flash), both arms on the merged tree.

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7302722993 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2823#issuecomment-7302722993). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-01T06:18:26Z. --- done: **it merges onto today's `main` and both arms behave - the test skips on a software adapter and still runs on a card.** **`main` `640b0d0df`, this branch's one commit cherry-picked (base `90c514437`, no conflict), `cargo 1.98.1`:** ``` tree ae3042486 (main + this branch) LEONIDA_D3D12_WARP=1 cargo test -p leonida-gpu --features diagnostics --lib \ depth_bounds_pipeline_loads_and_filters_draws exit 0 · ok. 1 passed "no host depth bounds support; skipped" cargo test -p leonida-gpu --lib depth_bounds_pipeline_loads_and_filters_draws exit 0 · ok. 1 passed (0.97 s, the test runs) ``` **So on the merged tree the guard does what the branch claims**: **a runner without a card skips instead of failing, and a machine with one still exercises the depth bounds path.** **Why this matters to the job that found it**: **#2816's first real run failed on exactly this test** (`assertion left: 255, right: 0`). **With this merged, that red is gone from its suite, and the only one it would still see is the policy test - which #2815 fixes, also measured on the merged tree.** **The two together are what turns #2816 green**: **one for the WARP red, one for the policy red, and neither needs the other's file.** **AI-assisted:** yes - DeepSeek v4.1 (flash), both arms on the merged tree. Written with an AI assistant.
MoonEyes commented 2026-12-01 15:20:31 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-01T15:20:31Z.


fc96e20b2: the adapter is asked inside get_or_init, so once, not at every OMSetDepthBounds and every replayed list (KelboLive measured about 134 µs a call). On main cd0c52fcf: cargo test -p leonida-gpu --lib 631 passed, 0 failed.

Pushed to your branch by MoonEyes (maintainer, the branch allows it), on top of your head, nothing rewritten. Say so if you would rather have it another way, and I take it out. The earlier verdicts are for the head before this one.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7315748915 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2823#issuecomment-7315748915). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-01T15:20:31Z. --- `fc96e20b2`: the adapter is asked inside `get_or_init`, so once, not at every `OMSetDepthBounds` and every replayed list (KelboLive measured about 134 µs a call). On `main` `cd0c52fcf`: `cargo test -p leonida-gpu --lib` 631 passed, 0 failed. Pushed to your branch by MoonEyes (maintainer, the branch allows it), on top of your head, nothing rewritten. Say so if you would rather have it another way, and I take it out. The earlier verdicts are for the head before this one. AI-assisted (Claude Code).
fiestorra commented 2026-12-01 21:37:59 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-01T21:37:59Z.


Red on d3d12 (windows-latest), and not this branch. The test that failed is descriptor::tests::records_copi… (assertion failed: host.made(5)), and it is not the code this branch changes — which is depth_bounds and the WARP adapter's support for it.

It passes on a real card. Running every descriptor:: test on an RTX 4090 with this tree: 85 passed, 1 failed — and the one that fails here is a different test, descriptor::host::tests::views_are_made_beside_the_heap_and_copied_in ("copied as it was made"), which is a real failure of main reported in #2570.

So the runner and this card disagree in opposite directions on the descriptor host, on two different tests, which points at the WARP path rather than at either PR. #2923 is the fix proposed for this class: the workspace tests share one WARP device across every core, and this crate flakes about one run in eight that way.

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7326553708 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2823#issuecomment-7326553708). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-01T21:37:59Z. --- **Red on `d3d12 (windows-latest)`, and not this branch.** The test that failed is `descriptor::tests::records_copi…` (`assertion failed: host.made(5)`), and it is not the code this branch changes — which is `depth_bounds` and the WARP adapter's support for it. **It passes on a real card.** Running every `descriptor::` test on an RTX 4090 with this tree: 85 passed, 1 failed — and the one that fails here is a *different* test, `descriptor::host::tests::views_are_made_beside_the_heap_and_copied_in` ("copied as it was made"), which is a real failure of `main` reported in #2570. **So the runner and this card disagree in opposite directions on the descriptor host, on two different tests**, which points at the WARP path rather than at either PR. **#2923 is the fix proposed for this class**: the workspace tests share one WARP device across every core, and this crate flakes about one run in eight that way. Written with an AI assistant.
merzleckeier commented 2026-12-01 22:04:37 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-01T22:04:37Z.


The current head resolves the adapter once across repeated depth-bounds queries.

I tested b60a7294a9a94847ac721746a68d89edbba9fa94 integrated onto main c4ca5761508f136c5530482093bb3053b0bad4fa in Wine 11.22 / VKD3D-Proton 3.1.0 on an RTX 4070 SUPER and AMD Raphael/RADV. Each row ran in a fresh process on both adapters with D3D12_OPTIONS2.DepthBoundsTestSupported == true. The probe counted entries to indirect::adapter_of during calls to depth_bounds().

Tree DXGI description Return value Lookups after 1 / 64 queries
Main Physical adapter true 0 / 0
Main Software flag injected true 0 / 0
PR Physical adapter true 1 / 1
PR Software flag injected false 1 / 1

The fixture ORs DXGI_ADAPTER_FLAG_SOFTWARE into the successfully retrieved DXGI description of the same physical adapter. This isolates the classification branch. Native WARP was outside this run.

The stock depth_bounds_pipeline_loads_and_filters_draws test also passed on both physical GPUs in both trees, with no printed skips. I included #2654 at f4ae7b9 in both arms of that test for the Wine pipeline-library path.

AI-assisted local testing, independently checked against the raw logs.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7327232241 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2823#issuecomment-7327232241). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-01T22:04:37Z. --- The current head resolves the adapter once across repeated depth-bounds queries. I tested `b60a7294a9a94847ac721746a68d89edbba9fa94` integrated onto main `c4ca5761508f136c5530482093bb3053b0bad4fa` in Wine 11.22 / VKD3D-Proton 3.1.0 on an RTX 4070 SUPER and AMD Raphael/RADV. Each row ran in a fresh process on both adapters with `D3D12_OPTIONS2.DepthBoundsTestSupported == true`. The probe counted entries to `indirect::adapter_of` during calls to `depth_bounds()`. | Tree | DXGI description | Return value | Lookups after 1 / 64 queries | | --- | --- | --- | --- | | Main | Physical adapter | true | 0 / 0 | | Main | Software flag injected | true | 0 / 0 | | PR | Physical adapter | true | 1 / 1 | | PR | Software flag injected | false | 1 / 1 | The fixture ORs `DXGI_ADAPTER_FLAG_SOFTWARE` into the successfully retrieved DXGI description of the same physical adapter. This isolates the classification branch. Native WARP was outside this run. The stock `depth_bounds_pipeline_loads_and_filters_draws` test also passed on both physical GPUs in both trees, with no printed skips. I included #2654 at `f4ae7b9` in both arms of that test for the Wine pipeline-library path. AI-assisted local testing, independently checked against the raw logs.
fiestorra commented 2026-12-01 23:43:17 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-01T23:43:17Z.


The red d3d12 (windows-latest) was not this change: it was crash::tests::memory_at_names_what, in crates/leonida-loader, which this branch does not touch.

---- crash::tests::memory_at_names_what assertion left == right failed left: "read-write" right: "nothing mapped there"

I could not make it fail here: six runs of cargo test -p leonida-loader --lib crash::tests on this machine, in parallel like CI, 19 passed, 0 failed, six times out of six. It needs a page to be unmapped and read back as unmapped, and a parallel test taking that address between the two is the shape of it.

The branch is rebased onto main 913b88b90 (which also re-runs the jobs - gh run rerun needs admin rights I do not have), so this PR is current and its CI is fresh.

If it goes red on the same test again, that test is worth fixing on its own: it is in the same class as #2923 (the crate's tests on one thread for the same reason) and it will keep colouring unrelated pull requests.

AI-assisted: yes - DeepSeek v4.1 (flash).

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7329693710 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2823#issuecomment-7329693710). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-01T23:43:17Z. --- **The red d3d12 (windows-latest) was not this change: it was crash::tests::memory_at_names_what, in crates/leonida-loader, which this branch does not touch.** ` ---- crash::tests::memory_at_names_what assertion left == right failed left: "read-write" right: "nothing mapped there" ` **I could not make it fail here**: six runs of cargo test -p leonida-loader --lib crash::tests on this machine, in parallel like CI, **19 passed, 0 failed, six times out of six**. It needs a page to be unmapped and read back as unmapped, and a parallel test taking that address between the two is the shape of it. **The branch is rebased onto main 913b88b90** (which also re-runs the jobs - gh run rerun needs admin rights I do not have), so this PR is current and its CI is fresh. **If it goes red on the same test again**, that test is worth fixing on its own: it is in the same class as #2923 (the crate's tests on one thread for the same reason) and it will keep colouring unrelated pull requests. **AI-assisted:** yes - DeepSeek v4.1 (flash). Written with an AI assistant.
andrew-ai commented 2026-12-02 00:06:14 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by andrew-ai on 2026-12-02T00:06:14Z.


Verified 7adc427c3 on Windows with the diagnostics build, using fresh processes for hardware and WARP. On RTX 5070 / 616.92, depth_bounds_pipeline_loads_and_filters_draws passed. A second hardware run with a temporary print after the final assertion confirmed both readbacks executed: depth 0.5 produced 0 outside [0.6, 1.0] and 255 inside [0.4, 0.6]. With LEONIDA_D3D12_WARP=1 the unmodified test explicitly printed “no host depth bounds support; skipped”. Both invocations show one passed in the Rust summary, but only the hardware run verified pixels. Codex-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7330143932 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2823#issuecomment-7330143932). Originally posted by [andrew-ai](https://github.com/andrew-ai) on 2026-12-02T00:06:14Z. --- Verified 7adc427c3 on Windows with the diagnostics build, using fresh processes for hardware and WARP. On RTX 5070 / 616.92, depth_bounds_pipeline_loads_and_filters_draws passed. A second hardware run with a temporary print after the final assertion confirmed both readbacks executed: depth 0.5 produced 0 outside [0.6, 1.0] and 255 inside [0.4, 0.6]. With LEONIDA_D3D12_WARP=1 the unmodified test explicitly printed “no host depth bounds support; skipped”. Both invocations show one passed in the Rust summary, but only the hardware run verified pixels. Codex-assisted.
imShangLi commented 2026-12-02 11:25:15 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by imShangLi on 2026-12-02T11:25:15Z.


VERIFY-2823 — Linux, Fedora 45, Rust 1.98.1, cross-compiled for x86_64-pc-windows-gnu, Wine 11.21, no GPU device (only a VMware SVGA virtual adapter; Wine's D3D12 sees only the llvmpipe CPU device and the runtime still makes no host device), no game files

Verdict: PASS. depth_bounds() is made honest for a software adapter: where it answered "the device reports DepthBoundsTestSupported", which is true on WARP even though WARP does not gate the draw, it now answers no for an adapter with DXGI_ADAPTER_FLAG_SOFTWARE. The fix is at the root cause (the wrong answer, not the callers), it is confined to one function plus making an existing helper pub(crate), the software-flag test is the one five other call sites already use, the adapter is asked once (inside get_or_init), and on a real GPU the answer is unchanged — it still queries the feature. No test in the crate regresses: 703 tests on each side, 0 regressions; the only red→green is a watch flake.

head 7adc427c3f4fe9e3cb7efabe5e0c169b820e924f ("leonida-gpu: ask the adapter for the depth bounds once"), base origin/main = a917c54d6aff8c9ef5dda2d8ebf938cb5c693902, merge base 913b88b9054de123a78fae0aea5ee24e10b7cb1d (134 commits behind main). Two files, +13/−1: d3d12/crates/leonida-gpu/src/host.rs and d3d12/crates/leonida-gpu/src/indirect.rs.

1. What it changes

Host::depth_bounds() (host.rs:6276-6307) answers "does the host GPU support the depth bounds test" and is used by three places: draw.rs:8077 (emits OMSetDepthBounds when it is true), pipeline/host.rs:888-902 (claims the depth-bounds state on the pipeline when it is true, else warns "the host GPU does not support" up to four times), and the test's guard (pipeline/host.rs:1630).

The old body queried D3D12_FEATURE_D3D12_OPTIONS2 and returned DepthBoundsTestSupported. The new body, inside the OnceLock (so asked once per process), first answers false for a software adapter:

// host.rs:6285-6291
*BOUNDS.get_or_init(|| {
    if crate::indirect::adapter_of(&self.device)
        .is_some_and(|d| d.Flags & DXGI_ADAPTER_FLAG_SOFTWARE.0 as u32 != 0)
    {
        tracing::info!(supported = false, "host depth bounds support (a software adapter)");
        return false;
    }
    let mut options = ...; // the unchanged feature query
    ...
})

and indirect.rs:329 makes the existing adapter_of(device) (which matches the device's adapter by LUID through CreateDXGIFactory2 + EnumAdapterByLuid) pub(crate). No other code changes.

2. The claims, checked

The repository's own docs record no measured depth-bounds behaviour: d3d12/docs/findings.md and d3d12/docs/switches.md have nothing on it, and the port-status table in d3d12/docs/README-fxceless.md lists depth bounds only as still "missing" from the port — so there is no repository measurement to quote for this, and the author's WARP measurement is the only one.

  • "A software adapter answers that it supports the depth bounds test and then does not gate the draw, so depth_bounds() now says no for one." — The code change does exactly this. The premise (WARP reports DepthBoundsTestSupported true and does not gate) is the author's measured claim on WARP and is not something I can reproduce here; I checked the code structure, not the driver behaviour. The D3D12_OPTIONS2.DepthBoundsTestSupported query is at host.rs:6292-6303 and is unchanged — the software branch is added before it and short-circuits it.
  • "The query is right about the API surface and wrong about the driver." — A fair characterisation of the author's measurement, and the reason the fix is at the function that answers, not at the callers: there is no way to make the query return the truth for WARP, so the answer for a software adapter is "no". This is the root cause, not a workaround.
  • "adapter_of was already there and becomes pub(crate); the flag check is the one warp_adapter() and three other call sites already use." — Confirmed. adapter_of was fn (private) at indirect.rs:329 and is now pub(crate); the exact expression desc.Flags & DXGI_ADAPTER_FLAG_SOFTWARE.0 as u32 != 0 (or == 0) is used at host.rs:1653 (warp_adapter), indirect.rs:386, indirect.rs:1008, indirect.rs:4297 and inplace.rs:1475 — five call sites, so "three other" understates it.
  • "Asked once: every OMSetDepthBounds and every replayed list comes here." — Confirmed. adapter_of(&self.device) is inside *BOUNDS.get_or_init(|| ...), so the DXGI factory + LUID enumeration runs once per process, not per call. This is the maintainer's edit (MoonEyes) on top of the author's original, which had the software check outside get_or_init (i.e. per call); the head is the once-per-process version.
  • "This does not change what renders on a software adapter." — Confirmed from the callers. On WARP, draw.rs:8077 previously emitted OMSetDepthBounds (a no-op WARP ignored) and now does not — the picture is the same. pipeline/host.rs:888-902 previously took g.depth_bounds as true and claimed the state; now it takes the else branch and warns (up to four times) and does not claim the state. The author's own comment in the PR thread makes the same point. So the change only makes the answer truthful; it is not a rendering fix and does not claim one.
  • "The test that guards on it skips where there is no card instead of failing there." — The guard is pipeline/host.rs:1627-1633:
    let Some(host) = host() else { return; };
    if !host.depth_bounds() {
        eprintln!("no host depth bounds support; skipped");
        return;
    }
    
    With the change, on a WARP adapter depth_bounds() is false and the test prints "no host depth bounds support; skipped" instead of proceeding to the two-draw probe that fails left: 255, right: 0. On a real card depth_bounds() is the feature query and the test runs. This is exactly the author's measured both arms (WARP: skip; RTX 4090: runs in 0.88 s).

3. What the tests do here

I cross-compiled leonida-gpu for x86_64-pc-windows-gnu and ran the test binaries under Wine with python3 tools/wine_red_green.py 2823 --crate leonida-gpu (from /home/shangli/oc-workspace/gta6). The pull request changes only source, so the verifier's red side is the merge base and the green side is the head — it checks that the source change does not redden any test that passed on the base.

side commit tests regressions
red 913b88b90 (merge base) 703 —
green 7adc427c (PR head) 703 0

The tool printed "red then green", but its 1 red→green is a watch flake, not this change: watch::tests::what_is_put_in_beside_the_guards_is_told_at_every_view failed on the base and passed on the head. The PR touches host.rs/indirect.rs; watch.rs is a different module, and the same three watch tests that fail on the base fail identically on the head (holes_are_known_until_the_runtime_tells, no_mapping_is_lost_between_askers, what_is_left_alone_is_no_known_hole). So the real result is 0 regressions; the "red then green" verdict is the flaky watch guard-page machinery under Wine without a real GPU. 640 tests pass on both sides, 59 are ignored.

  • The depth-bounds test does not run here. pipeline::host::tests::depth_bounds_pipeline_loads_and_filters_draws reports ok on both sides, but it returns at pipeline/host.rs:1628 (let Some(host) = host() else { return; }) because host() is None on this machine. I confirmed this directly: Wine's D3D12 (DXVK 2.7.1) does find a Vulkan device — Found device: llvmpipe (LLVM 23.1.5, 256 bits), a CPU software device — but Host::create() still fails after D3D12CreateDevice (the ignored dump_buffer_view_descriptor_bytes probe, which requires a device, panics with "an active D3D12 device" at listed_raw_tests.rs:224), so host() is None and the test returns before depth_bounds() is ever called. Running the test alone under Wine with --nocapture printed ok in 0.05 s with no "no host depth bounds support; skipped" message — i.e. it did not reach the guard that message is in. So the skip-message half of the change is verified by reading the guard and by the author's WARP measurement, not by a run here.
  • The change is invisible to every test that does run. The 703 tests that ran are the device-free ones; depth_bounds() is only reached with a live Host, which this machine does not make. So the wine_red_green run confirms only that the change does not regress the device-free suite, not that it does what it claims.

4. Any failure I saw and why it is not this PR

  • The 3 watch failures (§3) fail on the merge base too and are environment failures of the guard-page/exception machinery under Wine without a real GPU; the PR touches none of watch.rs. The 1 red→green flake is the same class (a different watch test than in the #2911 run, so the flakiness is not a fixed set).

5. What I did not check

  • No real GPU, no WARP device: the whole point is WARP reporting DepthBoundsTestSupported == true and then not gating the draw. This machine has no hardware GPU and Wine's D3D12 makes no host device at all (see §3), so I could not measure either the red (left: 255, right: 0) or the green (skip) behaviour. The premise and both arms rest on the author's measurements (WARP and an RTX 4090, driver 621.24) and the commenters' (RTX 4070 Ti SUPER, RTX 5070/616.92, RTX 4070 SUPER + AMD RADV under Wine), which I read but did not reproduce.
  • The LEONIDA_D3D12_WARP=1 path: warp_adapter() (host.rs:1647) requires the WARP adapter and refuses a non-software one; I did not run it under Wine.
  • The 134-commit gap: the PR is based on 913b88b90, 134 commits behind today's main (a917c54d). The red/green run is against the merge base, not today's main; I did not check whether the change still applies cleanly to main (the author's and commenters' runs say it merged cleanly onto the mains of their times).
  • No Windows build, no MSVC: everything is cargo test --target x86_64-pc-windows-gnu under Wine 11.21 on Fedora 45; the #[cfg(windows)] path is compiled, but a real Windows driver/ABI is not exercised.
  • adapter_of on a hardware card: I verified the expression and that it matches by LUID (indirect.rs:329-338), but did not observe it return a hardware adapter's description; the amd()/NVIDIA paths that also use it are unchanged and were not re-run on a card.
  • The other crates (leonida-hle, leonida-loader) and the repository's Python suite were not run; the change is confined to leonida-gpu.
  • The 134 µs-per-call figure MoonEyes cites (why the adapter is asked once) — I did not measure it; I confirmed the once-per-process structure from the code.
<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7343895283 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2823#issuecomment-7343895283). Originally posted by [imShangLi](https://github.com/imShangLi) on 2026-12-02T11:25:15Z. --- ## VERIFY-2823 — Linux, Fedora 45, Rust 1.98.1, cross-compiled for x86_64-pc-windows-gnu, Wine 11.21, no GPU device (only a VMware SVGA virtual adapter; Wine's D3D12 sees only the llvmpipe CPU device and the runtime still makes no host device), no game files **Verdict: PASS.** `depth_bounds()` is made honest for a software adapter: where it answered "the device reports `DepthBoundsTestSupported`", which is true on WARP even though WARP does not gate the draw, it now answers no for an adapter with `DXGI_ADAPTER_FLAG_SOFTWARE`. The fix is at the root cause (the wrong answer, not the callers), it is confined to one function plus making an existing helper `pub(crate)`, the software-flag test is the one five other call sites already use, the adapter is asked once (inside `get_or_init`), and on a real GPU the answer is unchanged — it still queries the feature. No test in the crate regresses: 703 tests on each side, 0 regressions; the only red→green is a `watch` flake. head `7adc427c3f4fe9e3cb7efabe5e0c169b820e924f` ("leonida-gpu: ask the adapter for the depth bounds once"), base `origin/main` = `a917c54d6aff8c9ef5dda2d8ebf938cb5c693902`, merge base `913b88b9054de123a78fae0aea5ee24e10b7cb1d` (134 commits behind `main`). Two files, +13/−1: `d3d12/crates/leonida-gpu/src/host.rs` and `d3d12/crates/leonida-gpu/src/indirect.rs`. ### 1. What it changes `Host::depth_bounds()` (`host.rs:6276-6307`) answers "does the host GPU support the depth bounds test" and is used by three places: `draw.rs:8077` (emits `OMSetDepthBounds` when it is true), `pipeline/host.rs:888-902` (claims the depth-bounds state on the pipeline when it is true, else warns "the host GPU does not support" up to four times), and the test's guard (`pipeline/host.rs:1630`). The old body queried `D3D12_FEATURE_D3D12_OPTIONS2` and returned `DepthBoundsTestSupported`. The new body, inside the `OnceLock` (so asked once per process), first answers false for a software adapter: ```rust // host.rs:6285-6291 *BOUNDS.get_or_init(|| { if crate::indirect::adapter_of(&self.device) .is_some_and(|d| d.Flags & DXGI_ADAPTER_FLAG_SOFTWARE.0 as u32 != 0) { tracing::info!(supported = false, "host depth bounds support (a software adapter)"); return false; } let mut options = ...; // the unchanged feature query ... }) ``` and `indirect.rs:329` makes the existing `adapter_of(device)` (which matches the device's adapter by LUID through `CreateDXGIFactory2` + `EnumAdapterByLuid`) `pub(crate)`. No other code changes. ### 2. The claims, checked The repository's own docs record no measured depth-bounds behaviour: `d3d12/docs/findings.md` and `d3d12/docs/switches.md` have nothing on it, and the port-status table in `d3d12/docs/README-fxceless.md` lists depth bounds only as still "missing" from the port — so there is no repository measurement to quote for this, and the author's WARP measurement is the only one. - **"A software adapter answers that it supports the depth bounds test and then does not gate the draw, so `depth_bounds()` now says no for one."** — The code change does exactly this. The premise (WARP reports `DepthBoundsTestSupported` true and does not gate) is the author's measured claim on WARP and is not something I can reproduce here; I checked the code structure, not the driver behaviour. The `D3D12_OPTIONS2.DepthBoundsTestSupported` query is at `host.rs:6292-6303` and is unchanged — the software branch is added *before* it and short-circuits it. - **"The query is right about the API surface and wrong about the driver."** — A fair characterisation of the author's measurement, and the reason the fix is at the function that answers, not at the callers: there is no way to make the query return the truth for WARP, so the answer for a software adapter is "no". This is the root cause, not a workaround. - **"`adapter_of` was already there and becomes `pub(crate)`; the flag check is the one `warp_adapter()` and three other call sites already use."** — Confirmed. `adapter_of` was `fn` (private) at `indirect.rs:329` and is now `pub(crate)`; the exact expression `desc.Flags & DXGI_ADAPTER_FLAG_SOFTWARE.0 as u32 != 0` (or `== 0`) is used at `host.rs:1653` (`warp_adapter`), `indirect.rs:386`, `indirect.rs:1008`, `indirect.rs:4297` and `inplace.rs:1475` — five call sites, so "three other" understates it. - **"Asked once: every `OMSetDepthBounds` and every replayed list comes here."** — Confirmed. `adapter_of(&self.device)` is inside `*BOUNDS.get_or_init(|| ...)`, so the DXGI factory + LUID enumeration runs once per process, not per call. This is the maintainer's edit (MoonEyes) on top of the author's original, which had the software check outside `get_or_init` (i.e. per call); the head is the once-per-process version. - **"This does not change what renders on a software adapter."** — Confirmed from the callers. On WARP, `draw.rs:8077` previously emitted `OMSetDepthBounds` (a no-op WARP ignored) and now does not — the picture is the same. `pipeline/host.rs:888-902` previously took `g.depth_bounds` as true and claimed the state; now it takes the `else` branch and warns (up to four times) and does not claim the state. The author's own comment in the PR thread makes the same point. So the change only makes the answer truthful; it is not a rendering fix and does not claim one. - **"The test that guards on it skips where there is no card instead of failing there."** — The guard is `pipeline/host.rs:1627-1633`: ```rust let Some(host) = host() else { return; }; if !host.depth_bounds() { eprintln!("no host depth bounds support; skipped"); return; } ``` With the change, on a WARP adapter `depth_bounds()` is false and the test prints "no host depth bounds support; skipped" instead of proceeding to the two-draw probe that fails `left: 255, right: 0`. On a real card `depth_bounds()` is the feature query and the test runs. This is exactly the author's measured both arms (WARP: skip; RTX 4090: runs in 0.88 s). ### 3. What the tests do here I cross-compiled `leonida-gpu` for `x86_64-pc-windows-gnu` and ran the test binaries under Wine with `python3 tools/wine_red_green.py 2823 --crate leonida-gpu` (from `/home/shangli/oc-workspace/gta6`). The pull request changes only source, so the verifier's red side is the merge base and the green side is the head — it checks that the source change does not redden any test that passed on the base. | side | commit | tests | regressions | |---|---|---|---| | red | `913b88b90` (merge base) | 703 | — | | green | `7adc427c` (PR head) | 703 | **0** | The tool printed "red then green", but its 1 red→green is a `watch` flake, not this change: `watch::tests::what_is_put_in_beside_the_guards_is_told_at_every_view` failed on the base and passed on the head. The PR touches `host.rs`/`indirect.rs`; `watch.rs` is a different module, and the same three `watch` tests that fail on the base fail identically on the head (`holes_are_known_until_the_runtime_tells`, `no_mapping_is_lost_between_askers`, `what_is_left_alone_is_no_known_hole`). So the real result is **0 regressions**; the "red then green" verdict is the flaky `watch` guard-page machinery under Wine without a real GPU. 640 tests pass on both sides, 59 are `ignored`. - **The depth-bounds test does not run here.** `pipeline::host::tests::depth_bounds_pipeline_loads_and_filters_draws` reports `ok` on both sides, but it returns at `pipeline/host.rs:1628` (`let Some(host) = host() else { return; }`) because `host()` is `None` on this machine. I confirmed this directly: Wine's D3D12 (DXVK 2.7.1) does find a Vulkan device — `Found device: llvmpipe (LLVM 23.1.5, 256 bits)`, a CPU software device — but `Host::create()` still fails after `D3D12CreateDevice` (the ignored `dump_buffer_view_descriptor_bytes` probe, which requires a device, panics with "an active D3D12 device" at `listed_raw_tests.rs:224`), so `host()` is `None` and the test returns before `depth_bounds()` is ever called. Running the test alone under Wine with `--nocapture` printed `ok` in 0.05 s with no "no host depth bounds support; skipped" message — i.e. it did not reach the guard that message is in. So the skip-message half of the change is verified by reading the guard and by the author's WARP measurement, not by a run here. - **The change is invisible to every test that does run.** The 703 tests that ran are the device-free ones; `depth_bounds()` is only reached with a live `Host`, which this machine does not make. So the wine_red_green run confirms only that the change does not regress the device-free suite, not that it does what it claims. ### 4. Any failure I saw and why it is not this PR - The 3 `watch` failures (§3) fail on the merge base too and are environment failures of the guard-page/exception machinery under Wine without a real GPU; the PR touches none of `watch.rs`. The 1 red→green flake is the same class (a different `watch` test than in the #2911 run, so the flakiness is not a fixed set). ### 5. What I did not check - **No real GPU, no WARP device**: the whole point is WARP reporting `DepthBoundsTestSupported == true` and then not gating the draw. This machine has no hardware GPU and Wine's D3D12 makes no host device at all (see §3), so I could not measure either the red (`left: 255, right: 0`) or the green (skip) behaviour. The premise and both arms rest on the author's measurements (WARP and an RTX 4090, driver 621.24) and the commenters' (RTX 4070 Ti SUPER, RTX 5070/616.92, RTX 4070 SUPER + AMD RADV under Wine), which I read but did not reproduce. - **The `LEONIDA_D3D12_WARP=1` path**: `warp_adapter()` (`host.rs:1647`) requires the WARP adapter and refuses a non-software one; I did not run it under Wine. - **The 134-commit gap**: the PR is based on `913b88b90`, 134 commits behind today's `main` (`a917c54d`). The red/green run is against the merge base, not today's `main`; I did not check whether the change still applies cleanly to `main` (the author's and commenters' runs say it merged cleanly onto the `main`s of their times). - **No Windows build, no MSVC**: everything is `cargo test --target x86_64-pc-windows-gnu` under Wine 11.21 on Fedora 45; the `#[cfg(windows)]` path is compiled, but a real Windows driver/ABI is not exercised. - **`adapter_of` on a hardware card**: I verified the expression and that it matches by LUID (`indirect.rs:329-338`), but did not observe it return a hardware adapter's description; the `amd()`/NVIDIA paths that also use it are unchanged and were not re-run on a card. - **The other crates** (`leonida-hle`, `leonida-loader`) and the repository's Python suite were not run; the change is confined to `leonida-gpu`. - **The 134 µs-per-call figure** MoonEyes cites (why the adapter is asked once) — I did not measure it; I confirmed the once-per-process structure from the code.
MoonEyes commented 2026-12-02 18:28:53 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T18:28:53Z.


Verification triage of #2823

Head 7adc427c3 is already verified on this exact head: andrew-ai (Windows, diagnostics build) and imShangLi (VERIFY-2823). CI passes (6/6) and the PR merges cleanly. No new run here (Windows-only). The in-game run the maintainer asked for is not linked from this thread. Verdict: ready (already verified on this head).

AI-assisted verification: Claude Opus (Claude Code), separate agent per batch.


Generated by Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7354657869 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2823#issuecomment-7354657869). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T18:28:53Z. --- **Verification triage of #2823** Head `7adc427c3` is already verified on this exact head: andrew-ai (Windows, diagnostics build) and imShangLi (VERIFY-2823). CI passes (6/6) and the PR merges cleanly. No new run here (Windows-only). The in-game run the maintainer asked for is not linked from this thread. **Verdict: ready (already verified on this head).** AI-assisted verification: Claude Opus (Claude Code), separate agent per batch. --- _Generated by [Claude Code](https://claude.ai/code)_
MoonEyes commented 2026-12-02 21:34:53 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T21:34:53Z.


RUN (independent run on Windows, head 7adc427c3f4fe9e3cb7efabe5e0c169b820e924f, merged into main b41763227aeed2d23c98af84bcbc1bddc7acdc90 with git merge --no-ff)

Merge: clean, no conflict. The PR changes two files in d3d12/crates/leonida-gpu/src/: host.rs (+12) and indirect.rs (adapter_of becomes pub(crate)). No Python test is touched and no diagnostics-only code is added (the test it protects is built with --features diagnostics). Machine: RTX 4060, driver 610.88, Windows 11 10.0.26300, cargo release.

Green

  • cargo test -p leonida-gpu --release --locked --lib: 703 passed, 0 failed, 59 ignored.
  • --features diagnostics --lib depth_bounds on the card: 3 passed. depth_bounds_pipeline_loads_and_filters_draws ran (0.34 s, no "skipped" line), so the real-GPU arm still draws and filters.
  • Same with LEONIDA_D3D12_WARP=1: 3 passed, and the test prints "no host SM 6.0 depth bounds support; skipped", i.e. the new early return is taken on the software adapter.

Red

The PR adds no test. I mutated the new code (each run on WARP and on the card, then restored):

Mutation Result
M1: software check never true (the PR's change removed) survives: 3 passed on WARP and on the card
M2: flag test inverted (== 0) survives
M3: answer is always "no" survives

Why M1 survives here, measured with a temporary probe: with the check removed, the WARP run goes past the guards, compiles the shaders and draws, and passes. So the WARP on this machine (10.0.26300) gates the draw correctly, and the failure the PR describes (left: 255, right: 0) does not reproduce here. I could not confirm the bug, and I could not make the fix observable either. M2 and M3 survive because the only test of this path accepts "skipped" as a pass, so nothing pins the software branch.

Review

  • Default-off switches: none added. docs/switches.md does not exist in this tree and nothing needed regenerating.
  • Ordering: the software check now sits inside get_or_init, so the adapter is looked up once, not per OMSetDepthBounds. This is the later commit on the head, and it is the right place. adapter_of matches the adapter by the device's LUID, so the flag cannot come from a different adapter.
  • Lifetimes, fences: nothing touched.
  • Callers: draw.rs (OMSetDepthBounds) and the pipeline build path both go through depth_bounds(), so on a software adapter a pipeline asking for the test now takes the "host does not support it" warning branch. The PR thread already says this.
  • Claim: the body names no item ID and no issues/14, 1608 or 2570 link in the text I read; the thread cites #2816 and #2570 as context. Worth adding.
  • Open reviewer questions: none unanswered in the thread. The red d3d12 (windows-latest) runs noted there were other tests, not this change.
  • Overlap: #2855 also touches the depth bounds test (root signature flags), a different line; no conflicting edit seen.
  • In-game runs on this exact head: none posted. Test-only verifications on this head exist (a Windows diagnostics build on an RTX 5070, and a Linux/Wine run), none in game.

Not covered

  • No in-game run (none requested by this checker; no render path other than the WARP flag is changed).
  • A WARP that really leaves the test culling nothing (the windows-latest runner): not available here, so the fix itself is not confirmed.
  • The ubuntu/Wine arm was not run.

Verdict

PARTIAL. The merge is clean, the lib suite and the depth bounds tests are green on the card and on WARP, and the change is small and correctly placed. But the PR has no test that fails without it, all three mutations survive, and the bug did not reproduce on this WARP, so the fix is not independently confirmed. In-game run still required (none posted on this head).

AI-assisted (Claude Code), models: Claude Opus 5.5 (checker), separate Claude Opus 5.5 judge.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7359482656 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2823#issuecomment-7359482656). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T21:34:53Z. --- RUN (independent run on Windows, head `7adc427c3f4fe9e3cb7efabe5e0c169b820e924f`, merged into `main` `b41763227aeed2d23c98af84bcbc1bddc7acdc90` with `git merge --no-ff`) Merge: clean, no conflict. The PR changes two files in `d3d12/crates/leonida-gpu/src/`: `host.rs` (+12) and `indirect.rs` (`adapter_of` becomes `pub(crate)`). No Python test is touched and no diagnostics-only code is added (the test it protects is built with `--features diagnostics`). Machine: RTX 4060, driver 610.88, Windows 11 10.0.26300, cargo release. ## Green - `cargo test -p leonida-gpu --release --locked --lib`: 703 passed, 0 failed, 59 ignored. - `--features diagnostics --lib depth_bounds` on the card: 3 passed. `depth_bounds_pipeline_loads_and_filters_draws` ran (0.34 s, no "skipped" line), so the real-GPU arm still draws and filters. - Same with `LEONIDA_D3D12_WARP=1`: 3 passed, and the test prints "no host SM 6.0 depth bounds support; skipped", i.e. the new early return is taken on the software adapter. ## Red The PR adds no test. I mutated the new code (each run on WARP and on the card, then restored): | Mutation | Result | | --- | --- | | M1: software check never true (the PR's change removed) | survives: 3 passed on WARP and on the card | | M2: flag test inverted (`== 0`) | survives | | M3: answer is always "no" | survives | Why M1 survives here, measured with a temporary probe: with the check removed, the WARP run goes past the guards, compiles the shaders and draws, and passes. So the WARP on this machine (10.0.26300) gates the draw correctly, and the failure the PR describes (`left: 255, right: 0`) does not reproduce here. I could not confirm the bug, and I could not make the fix observable either. M2 and M3 survive because the only test of this path accepts "skipped" as a pass, so nothing pins the software branch. ## Review - Default-off switches: none added. `docs/switches.md` does not exist in this tree and nothing needed regenerating. - Ordering: the software check now sits inside `get_or_init`, so the adapter is looked up once, not per `OMSetDepthBounds`. This is the later commit on the head, and it is the right place. `adapter_of` matches the adapter by the device's LUID, so the flag cannot come from a different adapter. - Lifetimes, fences: nothing touched. - Callers: `draw.rs` (`OMSetDepthBounds`) and the pipeline build path both go through `depth_bounds()`, so on a software adapter a pipeline asking for the test now takes the "host does not support it" warning branch. The PR thread already says this. - Claim: the body names no item ID and no `issues/14`, 1608 or 2570 link in the text I read; the thread cites #2816 and #2570 as context. Worth adding. - Open reviewer questions: none unanswered in the thread. The red `d3d12 (windows-latest)` runs noted there were other tests, not this change. - Overlap: #2855 also touches the depth bounds test (root signature flags), a different line; no conflicting edit seen. - In-game runs on this exact head: none posted. Test-only verifications on this head exist (a Windows diagnostics build on an RTX 5070, and a Linux/Wine run), none in game. ## Not covered - No in-game run (none requested by this checker; no render path other than the WARP flag is changed). - A WARP that really leaves the test culling nothing (the `windows-latest` runner): not available here, so the fix itself is not confirmed. - The `ubuntu`/Wine arm was not run. ## Verdict PARTIAL. The merge is clean, the lib suite and the depth bounds tests are green on the card and on WARP, and the change is small and correctly placed. But the PR has no test that fails without it, all three mutations survive, and the bug did not reproduce on this WARP, so the fix is not independently confirmed. In-game run still required (none posted on this head). AI-assisted (Claude Code), models: Claude Opus 5.5 (checker), separate Claude Opus 5.5 judge.
fiestorra commented 2026-12-02 22:10:02 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-02T22:10:02Z.


Taken, and fixed in 854796496. You were right that nothing failed without the change: all three mutations survived. The decision is now two pure functions, and a unit test drives them:

fn is_software_adapter(flags: Option<u32>) -> bool { flags.is_some_and(|f| f & SOFTWARE != 0) }
fn depth_bounds_answer(flags: Option<u32>, queried: bool) -> bool { queried && !is_software_adapter(flags) }

Host::depth_bounds reads the adapter flags and hands the query's answer to depth_bounds_answer, so the guard is testable without a WARP. Your three mutations, re-run against it:

M1 (software check removed)   -> FAILED: a software adapter's yes is not believed
M2 (flag test inverted)       -> FAILED: is_software_adapter says a software adapter is not one
M3 (answer always "no")       -> FAILED: a hardware adapter's yes stands

With the change: 644 passed, 1 failed, 59 ignored (the failure is this machine's views_are_made_beside_the_heap_and_copied_in, unchanged on main).

One thing about my own rigour, since you measured mutations yourself: my first full-suite run after the controls showed a second failure in the new test, and it was mine — I restored the file with Copy-Item, which preserves the backup's timestamp, so cargo reused the binary built from M3 and I read a stale mutant as a regression. Touching the file fixed it. A control that restores a file has to restore its build too.

What the test still does not cover: the WARP behaviour itself. This card is not WARP, so the driver lie the change is about is unreproduced here; the test pins the decision, not the driver.

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7360316406 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2823#issuecomment-7360316406). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-02T22:10:02Z. --- **Taken, and fixed in `854796496`.** You were right that nothing failed without the change: all three mutations survived. The decision is now two pure functions, and a unit test drives them: ```rust fn is_software_adapter(flags: Option<u32>) -> bool { flags.is_some_and(|f| f & SOFTWARE != 0) } fn depth_bounds_answer(flags: Option<u32>, queried: bool) -> bool { queried && !is_software_adapter(flags) } ``` `Host::depth_bounds` reads the adapter flags and hands the query's answer to `depth_bounds_answer`, so the guard is testable without a WARP. **Your three mutations, re-run against it:** ``` M1 (software check removed) -> FAILED: a software adapter's yes is not believed M2 (flag test inverted) -> FAILED: is_software_adapter says a software adapter is not one M3 (answer always "no") -> FAILED: a hardware adapter's yes stands ``` With the change: **644 passed, 1 failed, 59 ignored** (the failure is this machine's `views_are_made_beside_the_heap_and_copied_in`, unchanged on `main`). **One thing about my own rigour, since you measured mutations yourself**: my first full-suite run after the controls showed a *second* failure in the new test, and it was mine — I restored the file with `Copy-Item`, which preserves the backup's timestamp, so cargo reused the binary built from **M3** and I read a stale mutant as a regression. Touching the file fixed it. A control that restores a file has to restore its build too. **What the test still does not cover**: the WARP behaviour itself. This card is not WARP, so the driver lie the change is about is unreproduced here; the test pins the decision, not the driver. Written with an AI assistant.
fiestorra commented 2026-12-02 22:52:09 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-02T22:52:09Z.


The UNSTABLE here is main's, not this pull request's: d3d12 (windows-latest) fails at Build on a line this branch does not touch — crates/leonida-lua/src/tests.rs:1089 does .unwrap() on Runtime::new, which no longer returns a Result since 057cc94d8. main (16243cd6e) does not compile its leonida-lua tests at all, so every pull request fails that job, and a red check says nothing about this one. I confirmed it with cargo test -p leonida-lua on origin/main: the same error, exit 101.

The one-line fix is pushed to the fork as fix-main-lua-test-unwrap (cf29393a1, 46 passed after it), with the finding in #2570 — this account cannot open pull requests.

My evidence for this change stands: 644 passed, 1 failed, 59 ignored on the branch head, the failure being this machine's views_are_made_beside_the_heap_and_copied_in, and the three mutations MoonEyes reported now fail the new unit test.

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7361264848 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2823#issuecomment-7361264848). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-02T22:52:09Z. --- **The `UNSTABLE` here is `main`'s, not this pull request's**: `d3d12 (windows-latest)` fails at **Build** on a line this branch does not touch — `crates/leonida-lua/src/tests.rs:1089` does `.unwrap()` on `Runtime::new`, which no longer returns a `Result` since 057cc94d8. `main` (16243cd6e) does not compile its `leonida-lua` tests at all, so **every pull request fails that job**, and a red check says nothing about this one. I confirmed it with `cargo test -p leonida-lua` on `origin/main`: the same error, exit 101. **The one-line fix is pushed** to the fork as `fix-main-lua-test-unwrap` (`cf29393a1`, `46 passed` after it), with the finding in #2570 — this account cannot open pull requests. My evidence for this change stands: **644 passed, 1 failed, 59 ignored** on the branch head, the failure being this machine's `views_are_made_beside_the_heap_and_copied_in`, and the three mutations MoonEyes reported now fail the new unit test. Written with an AI assistant.
fiestorra commented 2026-12-02 23:35:09 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-02T23:35:09Z.


Rebased onto the fixed main (81efe4566), pushed as 1191462f8. The UNSTABLE was main's — leonida-lua's tests did not compile for a few hours (057cc94d8's .unwrap() on Runtime::new), so every d3d12 (windows-latest) job failed at Build; #3244 fixed it with a22fa26d6.

On the new base: cargo test -p leonida-gpu --lib depth_bounds → 4 passed, including the unit test that now kills MoonEyes' three surviving mutations.

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7362183480 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2823#issuecomment-7362183480). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-02T23:35:09Z. --- **Rebased onto the fixed `main` (`81efe4566`), pushed as `1191462f8`.** The `UNSTABLE` was `main`'s — `leonida-lua`'s tests did not compile for a few hours (057cc94d8's `.unwrap()` on `Runtime::new`), so every `d3d12 (windows-latest)` job failed at Build; #3244 fixed it with `a22fa26d6`. On the new base: **`cargo test -p leonida-gpu --lib depth_bounds`** → **4 passed**, including the unit test that now kills MoonEyes' three surviving mutations. Written with an AI assistant.
enlight3d commented 2026-12-03 00:54:21 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by enlight3d on 2026-12-03T00:54:21Z.


RUN (in game, gate-style): head 854796496 tested in a batch of nine pull requests: #2609 (3fbcacc4e), #2654 (f4ae7b922), #2686 (4ce795127), #2823 (854796496), #2841 (24ff8f24c), #2890 (262439781), #3154 (854fc3441), #2588 (598930e5b) and #3119 (6097c033c), merged in that order with git merge --no-ff onto main f3865cae8. One conflict, in the credit table of d3d12/README.md when #2588 went in (both rows kept); no code conflict. Files touched by more than one of the nine: d3d12/docs/switches.md (#2686, #3119, #3154) and d3d12/README.md (#2588, #3119). Built with diagnostics,mimalloc, target x86_64-pc-windows-msvc. RTX 3090 24 GB, NVIDIA 621.40, Windows 11 Pro (build 26300).

Launcher defaults except -PrecompileUsed, Series S settings, -NoDlss -NoFrameGen, standing at the save. On this main the launcher precompiles every recorded pipeline by default (88,671 here: a first warm-up with the plain defaults had made 9,000 of them after 660 s when it was stopped), so the runs use -PrecompileUsed (the 2,455 pipelines earlier runs drew with). A warm-up run first (#2686 changes the translator, so everything was translated again), then one run with the memory safety stop, ended 330 s after reaching the world:

Reached the world 75 s
Time in the world 331 s
Device losses 0
Crashes 0
Frame median 35.0 ms (28.2 fps rendered)
Card busy 85 %
Private memory, max 28.1 GB

Warnings: only kinds that a run on the same main with another pull request (#3128) printed too, in about the same numbers; no new kind. No pipeline refused other than the 29 "creation method that is not implemented" lines that run has as well. The last frame saved (8192) shows the world drawn normally.

This pull request's own lines: on this card the depth bounds answer is unchanged (host depth bounds support, supported=true): the change is for a software adapter only. Tested at head 854796496; the current head 1191462f8 is the same three commits rebased onto a newer main (same git patch-id).

Verdict: PASS for the batch (a pass covers each of the nine; a failure would not have said which). Not covered here: -RayTracing, DLSS and frame generation, other GPUs, Wine/Proton.

AI-assisted: Claude Code (Claude Opus 5.5)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7363728482 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2823#issuecomment-7363728482). Originally posted by [enlight3d](https://github.com/enlight3d) on 2026-12-03T00:54:21Z. --- RUN (in game, gate-style): head 854796496 tested **in a batch** of nine pull requests: #2609 (3fbcacc4e), #2654 (f4ae7b922), #2686 (4ce795127), #2823 (854796496), #2841 (24ff8f24c), #2890 (262439781), #3154 (854fc3441), #2588 (598930e5b) and #3119 (6097c033c), merged in that order with `git merge --no-ff` onto `main` f3865cae8. One conflict, in the credit table of `d3d12/README.md` when #2588 went in (both rows kept); no code conflict. Files touched by more than one of the nine: `d3d12/docs/switches.md` (#2686, #3119, #3154) and `d3d12/README.md` (#2588, #3119). Built with `diagnostics,mimalloc`, target `x86_64-pc-windows-msvc`. RTX 3090 24 GB, NVIDIA 621.40, Windows 11 Pro (build 26300). Launcher defaults except `-PrecompileUsed`, Series S settings, `-NoDlss -NoFrameGen`, standing at the save. On this `main` the launcher precompiles every recorded pipeline by default (88,671 here: a first warm-up with the plain defaults had made 9,000 of them after 660 s when it was stopped), so the runs use `-PrecompileUsed` (the 2,455 pipelines earlier runs drew with). A warm-up run first (#2686 changes the translator, so everything was translated again), then one run with the memory safety stop, ended 330 s after reaching the world: | | | |---|---| | Reached the world | 75 s | | Time in the world | 331 s | | Device losses | 0 | | Crashes | 0 | | Frame median | 35.0 ms (28.2 fps rendered) | | Card busy | 85 % | | Private memory, max | 28.1 GB | Warnings: only kinds that a run on the same `main` with another pull request (#3128) printed too, in about the same numbers; no new kind. No pipeline refused other than the 29 "creation method that is not implemented" lines that run has as well. The last frame saved (8192) shows the world drawn normally. This pull request's own lines: on this card the depth bounds answer is unchanged (`host depth bounds support`, `supported=true`): the change is for a software adapter only. Tested at head 854796496; the current head 1191462f8 is the same three commits rebased onto a newer `main` (same `git patch-id`). Verdict: **PASS** for the batch (a pass covers each of the nine; a failure would not have said which). Not covered here: `-RayTracing`, DLSS and frame generation, other GPUs, Wine/Proton. AI-assisted: Claude Code (Claude Opus 5.5)
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/2823:upstream-pr/2823'
git switch 'upstream-pr/2823'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/2823'
git switch 'upstream-pr/2823'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2823'
git switch 'upstream-pr/2823'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2823'
git switch 'main'
git merge --squash 'upstream-pr/2823'
git switch 'main'
git merge --ff-only 'upstream-pr/2823'
git switch 'main'
git merge 'upstream-pr/2823'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
ProjectLeonida/mandy!2823
No description provided.