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
pull from: upstream-pr/2823
merge into: ProjectLeonida:main
ProjectLeonida:main
ProjectLeonida:claude/loop-total
ProjectLeonida:claude/pops-collision-seed
ProjectLeonida:claude/dstorage-hold-page-reads
ProjectLeonida:claude/host-image-copy-switch
ProjectLeonida:feat/gdk-lifecycle-window-hook
ProjectLeonida:claude/d16s8-uav-nvidia-fallback
ProjectLeonida:feat/mfplat-offline-shim
ProjectLeonida:claude/gameinput-slow-reader
ProjectLeonida:fix/rt-null-barrier-clear
ProjectLeonida:claude/depth-resolve-sample-positions
ProjectLeonida:integration/palmetto-parity
ProjectLeonida:claude/valu-literal-sext
ProjectLeonida:claude/slot74-pool-handle
ProjectLeonida:claude/rgb9e5-uint-alias-view
ProjectLeonida:claude/fssm-root-layout-tables
ProjectLeonida:feat/gdk-speech-display-lifecycle
ProjectLeonida:asset-audio-skip-current
ProjectLeonida:qemmhd/old-9940-rectangle-quad-lists
ProjectLeonida:feat/ws2-offline-shim
ProjectLeonida:qemmhd/rt-d16-unorm-uav
ProjectLeonida:feat/xs-device-stops-7-9
ProjectLeonida:qemmhd/rt-depth-same-base-shapes
ProjectLeonida:qemmhd/rt-lazy-attachment-variant
ProjectLeonida:feat/acphal-xma2-decoder
ProjectLeonida:asset-audio-skip
ProjectLeonida:codex/coord-claim-check-20261124-7e48
ProjectLeonida:feat/xs-frame-pacing-presentx
ProjectLeonida:feat/xs-device-vm-options
ProjectLeonida:old-pr/9844
ProjectLeonida:old-pr/9978
ProjectLeonida:old-pr/9815
ProjectLeonida:old-pr/10057
ProjectLeonida:old-pr/9874
ProjectLeonida:old-pr/9965
ProjectLeonida:old-pr/9863
ProjectLeonida:old-pr/10068
ProjectLeonida:old-pr/10066
ProjectLeonida:old-pr/10067
ProjectLeonida:old-pr/10007
ProjectLeonida:old-pr/10061
ProjectLeonida:old-pr/10065
ProjectLeonida:old-pr/10059
ProjectLeonida:old-pr/10063
ProjectLeonida:old-pr/10055
ProjectLeonida:old-pr/10062
ProjectLeonida:old-pr/10042
ProjectLeonida:old-pr/10041
ProjectLeonida:old-pr/10049
ProjectLeonida:old-pr/10047
ProjectLeonida:old-pr/10046
ProjectLeonida:old-pr/10045
ProjectLeonida:old-pr/10056
ProjectLeonida:old-pr/10043
ProjectLeonida:old-pr/10036
ProjectLeonida:old-pr/10034
ProjectLeonida:old-pr/9984
ProjectLeonida:old-pr/10052
ProjectLeonida:old-pr/10038
ProjectLeonida:old-pr/10033
ProjectLeonida:old-pr/10028
ProjectLeonida:old-pr/10050
ProjectLeonida:old-pr/9891
ProjectLeonida:old-pr/9889
ProjectLeonida:old-pr/10051
ProjectLeonida:old-pr/10019
ProjectLeonida:old-pr/10027
ProjectLeonida:old-pr/10029
ProjectLeonida:old-pr/10031
ProjectLeonida:old-pr/10026
ProjectLeonida:old-pr/9941
ProjectLeonida:old-pr/10030
ProjectLeonida:old-pr/10040
ProjectLeonida:old-pr/9990
ProjectLeonida:old-pr/10021
ProjectLeonida:old-pr/9962
ProjectLeonida:old-pr/10022
ProjectLeonida:old-pr/10020
ProjectLeonida:old-pr/10015
ProjectLeonida:old-pr/10025
ProjectLeonida:old-pr/9886
ProjectLeonida:old-pr/10048
ProjectLeonida:old-pr/10014
ProjectLeonida:old-pr/10011
ProjectLeonida:old-pr/9861
ProjectLeonida:old-pr/10010
ProjectLeonida:old-pr/10008
ProjectLeonida:old-pr/9860
ProjectLeonida:old-pr/10006
ProjectLeonida:old-pr/9920
ProjectLeonida:old-pr/9995
ProjectLeonida:old-pr/10000
ProjectLeonida:old-pr/10016
ProjectLeonida:old-pr/10004
ProjectLeonida:old-pr/10023
ProjectLeonida:old-pr/9982
ProjectLeonida:old-pr/9981
ProjectLeonida:old-pr/9983
ProjectLeonida:old-pr/9970
ProjectLeonida:old-pr/9969
ProjectLeonida:old-pr/9968
ProjectLeonida:old-pr/9971
ProjectLeonida:old-pr/9972
ProjectLeonida:old-pr/9942
ProjectLeonida:old-pr/9963
ProjectLeonida:old-pr/9960
ProjectLeonida:old-pr/9964
ProjectLeonida:old-pr/9985
ProjectLeonida:old-pr/9973
ProjectLeonida:old-pr/9862
ProjectLeonida:old-pr/9953
ProjectLeonida:old-pr/10017
ProjectLeonida:old-pr/9952
ProjectLeonida:old-pr/9955
ProjectLeonida:old-pr/9946
ProjectLeonida:old-pr/9954
ProjectLeonida:old-pr/9938
ProjectLeonida:old-pr/9956
ProjectLeonida:old-pr/9856
ProjectLeonida:old-pr/9947
ProjectLeonida:old-pr/9924
ProjectLeonida:old-pr/9961
ProjectLeonida:old-pr/9927
ProjectLeonida:old-pr/9979
ProjectLeonida:old-pr/10032
ProjectLeonida:old-pr/9926
ProjectLeonida:old-pr/5237
ProjectLeonida:old-pr/9951
ProjectLeonida:old-pr/9931
ProjectLeonida:old-pr/9902
ProjectLeonida:old-pr/9921
ProjectLeonida:old-pr/9994
ProjectLeonida:old-pr/9775
ProjectLeonida:old-pr/9768
ProjectLeonida:old-pr/9905
ProjectLeonida:old-pr/9936
ProjectLeonida:old-pr/9901
ProjectLeonida:old-pr/9904
ProjectLeonida:old-pr/9906
ProjectLeonida:old-pr/9988
ProjectLeonida:old-pr/9908
ProjectLeonida:old-pr/9909
ProjectLeonida:old-pr/9911
ProjectLeonida:old-pr/9912
ProjectLeonida:old-pr/9913
ProjectLeonida:old-pr/9887
ProjectLeonida:old-pr/9916
ProjectLeonida:old-pr/9919
ProjectLeonida:old-pr/9925
ProjectLeonida:old-pr/9933
ProjectLeonida:old-pr/9935
ProjectLeonida:old-pr/9918
ProjectLeonida:old-pr/9879
ProjectLeonida:old-pr/9880
ProjectLeonida:old-pr/9881
ProjectLeonida:old-pr/9996
ProjectLeonida:old-pr/9876
ProjectLeonida:old-pr/9892
ProjectLeonida:old-pr/9899
ProjectLeonida:old-pr/9915
ProjectLeonida:old-pr/9914
ProjectLeonida:old-pr/9872
ProjectLeonida:old-pr/9869
ProjectLeonida:old-pr/9866
ProjectLeonida:old-pr/9819
ProjectLeonida:old-pr/10012
ProjectLeonida:old-pr/9857
ProjectLeonida:old-pr/9893
ProjectLeonida:old-pr/9897
ProjectLeonida:old-pr/9928
ProjectLeonida:old-pr/9868
ProjectLeonida:old-pr/9917
ProjectLeonida:old-pr/9940
ProjectLeonida:old-pr/9873
ProjectLeonida:old-pr/9816
ProjectLeonida:old-pr/10009
ProjectLeonida:old-pr/9900
ProjectLeonida:old-pr/9966
ProjectLeonida:old-pr/9859
ProjectLeonida:old-pr/9843
ProjectLeonida:old-pr/9991
ProjectLeonida:old-pr/10058
ProjectLeonida:old-pr/9883
ProjectLeonida:old-pr/9838
ProjectLeonida:old-pr/9835
ProjectLeonida:old-pr/9959
ProjectLeonida:old-pr/9895
ProjectLeonida:old-pr/9837
ProjectLeonida:old-pr/9858
ProjectLeonida:old-pr/9865
ProjectLeonida:old-pr/9864
ProjectLeonida:old-pr/9840
ProjectLeonida:old-pr/9820
ProjectLeonida:old-pr/4669
ProjectLeonida:old-pr/9848
ProjectLeonida:old-pr/9850
ProjectLeonida:old-pr/9810
ProjectLeonida:old-pr/9799
ProjectLeonida:old-pr/9853
ProjectLeonida:old-pr/9875
ProjectLeonida:old-pr/9831
ProjectLeonida:old-pr/9796
ProjectLeonida:old-pr/9801
ProjectLeonida:old-pr/9813
ProjectLeonida:old-pr/9794
ProjectLeonida:old-pr/7417
ProjectLeonida:old-pr/9781
ProjectLeonida:old-pr/9806
ProjectLeonida:old-pr/9958
ProjectLeonida:old-pr/9809
ProjectLeonida:old-pr/9791
ProjectLeonida:old-pr/9792
ProjectLeonida:old-pr/10053
ProjectLeonida:old-pr/9784
ProjectLeonida:old-pr/9789
ProjectLeonida:old-pr/9849
ProjectLeonida:old-pr/9846
ProjectLeonida:old-pr/9773
ProjectLeonida:old-pr/9785
ProjectLeonida:old-pr/9803
ProjectLeonida:old-pr/9826
ProjectLeonida:old-pr/9839
ProjectLeonida:old-pr/9922
ProjectLeonida:old-pr/9948
ProjectLeonida:old-pr/7189
ProjectLeonida:old-pr/9957
ProjectLeonida:old-pr/9823
ProjectLeonida:old-pr/9807
ProjectLeonida:old-pr/9851
ProjectLeonida:old-pr/9774
ProjectLeonida:old-pr/9830
ProjectLeonida:old-pr/9836
ProjectLeonida:old-pr/9822
ProjectLeonida:old-pr/9783
ProjectLeonida:old-pr/9833
ProjectLeonida:old-pr/9890
ProjectLeonida:old-pr/9770
ProjectLeonida:old-pr/9769
ProjectLeonida:old-pr/9772
ProjectLeonida:old-pr/9787
ProjectLeonida:old-pr/9852
ProjectLeonida:old-pr/9834
ProjectLeonida:old-pr/9845
ProjectLeonida:old-pr/9871
ProjectLeonida:old-pr/9771
ProjectLeonida:old-pr/9776
ProjectLeonida:old-pr/10005
ProjectLeonida:old-pr/9949
ProjectLeonida:old-pr/9923
ProjectLeonida:old-pr/9805
ProjectLeonida:old-pr/9829
ProjectLeonida:old-pr/9790
ProjectLeonida:old-pr/9827
ProjectLeonida:old-pr/9929
ProjectLeonida:old-pr/9855
ProjectLeonida:old-pr/9934
ProjectLeonida:old-pr/9907
ProjectLeonida:old-pr/9910
ProjectLeonida:old-pr/9779
ProjectLeonida:old-pr/9780
ProjectLeonida:old-pr/9885
ProjectLeonida:old-pr/9882
ProjectLeonida:old-pr/9877
ProjectLeonida:old-pr/9998
ProjectLeonida:old-pr/4251
ProjectLeonida:old-pr/9987
ProjectLeonida:old-pr/9989
ProjectLeonida:old-pr/9950
ProjectLeonida:old-pr/9777
ProjectLeonida:old-pr/10044
ProjectLeonida:old-pr/9884
ProjectLeonida:old-pr/2906
ProjectLeonida:old-pr/5076
ProjectLeonida:old-pr/9937
ProjectLeonida:old-pr/9986
ProjectLeonida:old-pr/3014
ProjectLeonida:old-pr/9943
ProjectLeonida:old-pr/9939
ProjectLeonida:old-pr/4682
ProjectLeonida:old-pr/4765
No reviewers
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
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
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2823"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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-latestand failed in five minutes, on a test that passes on a machine with a GPU:And it reproduces here on the software adapter, which is what a runner without a card gets:
The query, and why it is not enough (
host.rs,depth_bounds):D3D12_OPTIONS2.DepthBoundsTestSupportedis true on WARP.OMSetDepthBoundsis 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:
adapter_ofwas already there (indirect.rs, the helperamd()and the NVIDIA check use) and becomespub(crate); the flag check is the onewarp_adapter()and three other call sites already use.Both arms, measured:
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.
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:So before this change, on WARP, the runtime emitted
OMSetDepthBoundsand 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 reportsDepthBoundsTestSupported", 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.
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:
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:
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.
Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-01T03:18:30Z.
done: green on every check.
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.
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
maincould not see, and this is the second fix it produced.The first is #2815 (the asset policy). With both merged, and #2652 (the
xbox_presentflake),mainhas 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.
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=1the 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_ofmatches 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; trustingD3D12_OPTIONS2is 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 everydepth_bounds()call doesCreateDXGIFactory2+EnumAdapterByLuid+GetDesc1. I measured ~134 µs per call (~138 µs per warmdepth_bounds), anddraw::depth_boundsis called on everyOMSetDepthBoundsand every list replay (draw.rs:2780-2781). Before this PR it was a OnceLock load. Move the check insideBOUNDS.get_or_init, or cache the software flag in its ownOnceLock—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 theOnceLock.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.
Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-01T06:18:26Z.
done: it merges onto today's
mainand both arms behave - the test skips on a software adapter and still runs on a card.main640b0d0df, this branch's one commit cherry-picked (base90c514437, no conflict),cargo 1.98.1: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.
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-01T15:20:31Z.
fc96e20b2: the adapter is asked insideget_or_init, so once, not at everyOMSetDepthBoundsand every replayed list (KelboLive measured about 134 µs a call). Onmaincd0c52fcf:cargo test -p leonida-gpu --lib631 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).
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 isdescriptor::tests::records_copi…(assertion failed: host.made(5)), and it is not the code this branch changes — which isdepth_boundsand 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 ofmainreported 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.
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
b60a7294a9a94847ac721746a68d89edbba9fa94integrated onto mainc4ca5761508f136c5530482093bb3053b0bad4fain 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 withD3D12_OPTIONS2.DepthBoundsTestSupported == true. The probe counted entries toindirect::adapter_ofduring calls todepth_bounds().The fixture ORs
DXGI_ADAPTER_FLAG_SOFTWAREinto 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_drawstest also passed on both physical GPUs in both trees, with no printed skips. I included #2654 atf4ae7b9in both arms of that test for the Wine pipeline-library path.AI-assisted local testing, independently checked against the raw logs.
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.
Imported from ubiquitarianism/leonida. Originally posted by andrew-ai on 2026-12-02T00:06:14Z.
Verified
7adc427c3on 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.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 reportsDepthBoundsTestSupported", which is true on WARP even though WARP does not gate the draw, it now answers no for an adapter withDXGI_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 helperpub(crate), the software-flag test is the one five other call sites already use, the adapter is asked once (insideget_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 awatchflake.head
7adc427c3f4fe9e3cb7efabe5e0c169b820e924f("leonida-gpu: ask the adapter for the depth bounds once"), baseorigin/main=a917c54d6aff8c9ef5dda2d8ebf938cb5c693902, merge base913b88b9054de123a78fae0aea5ee24e10b7cb1d(134 commits behindmain). Two files, +13/−1:d3d12/crates/leonida-gpu/src/host.rsandd3d12/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(emitsOMSetDepthBoundswhen 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_OPTIONS2and returnedDepthBoundsTestSupported. The new body, inside theOnceLock(so asked once per process), first answers false for a software adapter:and
indirect.rs:329makes the existingadapter_of(device)(which matches the device's adapter by LUID throughCreateDXGIFactory2+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.mdandd3d12/docs/switches.mdhave nothing on it, and the port-status table ind3d12/docs/README-fxceless.mdlists 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.depth_bounds()now says no for one." — The code change does exactly this. The premise (WARP reportsDepthBoundsTestSupportedtrue 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. TheD3D12_OPTIONS2.DepthBoundsTestSupportedquery is athost.rs:6292-6303and is unchanged — the software branch is added before it and short-circuits it.adapter_ofwas already there and becomespub(crate); the flag check is the onewarp_adapter()and three other call sites already use." — Confirmed.adapter_ofwasfn(private) atindirect.rs:329and is nowpub(crate); the exact expressiondesc.Flags & DXGI_ADAPTER_FLAG_SOFTWARE.0 as u32 != 0(or== 0) is used athost.rs:1653(warp_adapter),indirect.rs:386,indirect.rs:1008,indirect.rs:4297andinplace.rs:1475— five call sites, so "three other" understates it.OMSetDepthBoundsand 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 outsideget_or_init(i.e. per call); the head is the once-per-process version.draw.rs:8077previously emittedOMSetDepthBounds(a no-op WARP ignored) and now does not — the picture is the same.pipeline/host.rs:888-902previously tookg.depth_boundsas true and claimed the state; now it takes theelsebranch 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.pipeline/host.rs:1627-1633: With the change, on a WARP adapterdepth_bounds()is false and the test prints "no host depth bounds support; skipped" instead of proceeding to the two-draw probe that failsleft: 255, right: 0. On a real carddepth_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-gpuforx86_64-pc-windows-gnuand ran the test binaries under Wine withpython3 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.913b88b90(merge base)7adc427c(PR head)The tool printed "red then green", but its 1 red→green is a
watchflake, not this change:watch::tests::what_is_put_in_beside_the_guards_is_told_at_every_viewfailed on the base and passed on the head. The PR toucheshost.rs/indirect.rs;watch.rsis a different module, and the same threewatchtests 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 flakywatchguard-page machinery under Wine without a real GPU. 640 tests pass on both sides, 59 areignored.pipeline::host::tests::depth_bounds_pipeline_loads_and_filters_drawsreportsokon both sides, but it returns atpipeline/host.rs:1628(let Some(host) = host() else { return; }) becausehost()isNoneon 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 — butHost::create()still fails afterD3D12CreateDevice(the ignoreddump_buffer_view_descriptor_bytesprobe, which requires a device, panics with "an active D3D12 device" atlisted_raw_tests.rs:224), sohost()isNoneand the test returns beforedepth_bounds()is ever called. Running the test alone under Wine with--nocaptureprintedokin 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.depth_bounds()is only reached with a liveHost, 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
watchfailures (§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 ofwatch.rs. The 1 red→green flake is the same class (a differentwatchtest than in the #2911 run, so the flakiness is not a fixed set).5. What I did not check
DepthBoundsTestSupported == trueand 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.LEONIDA_D3D12_WARP=1path:warp_adapter()(host.rs:1647) requires the WARP adapter and refuses a non-software one; I did not run it under Wine.913b88b90, 134 commits behind today'smain(a917c54d). The red/green run is against the merge base, not today'smain; I did not check whether the change still applies cleanly tomain(the author's and commenters' runs say it merged cleanly onto themains of their times).cargo test --target x86_64-pc-windows-gnuunder Wine 11.21 on Fedora 45; the#[cfg(windows)]path is compiled, but a real Windows driver/ABI is not exercised.adapter_ofon 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; theamd()/NVIDIA paths that also use it are unchanged and were not re-run on a card.leonida-hle,leonida-loader) and the repository's Python suite were not run; the change is confined toleonida-gpu.Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T18:28:53Z.
Verification triage of #2823
Head
7adc427c3is 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
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T21:34:53Z.
RUN (independent run on Windows, head
7adc427c3f4fe9e3cb7efabe5e0c169b820e924f, merged intomainb41763227aeed2d23c98af84bcbc1bddc7acdc90withgit merge --no-ff)Merge: clean, no conflict. The PR changes two files in
d3d12/crates/leonida-gpu/src/:host.rs(+12) andindirect.rs(adapter_ofbecomespub(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_boundson the card: 3 passed.depth_bounds_pipeline_loads_and_filters_drawsran (0.34 s, no "skipped" line), so the real-GPU arm still draws and filters.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):
== 0)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
docs/switches.mddoes not exist in this tree and nothing needed regenerating.get_or_init, so the adapter is looked up once, not perOMSetDepthBounds. This is the later commit on the head, and it is the right place.adapter_ofmatches the adapter by the device's LUID, so the flag cannot come from a different adapter.draw.rs(OMSetDepthBounds) and the pipeline build path both go throughdepth_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.issues/14, 1608 or 2570 link in the text I read; the thread cites #2816 and #2570 as context. Worth adding.d3d12 (windows-latest)runs noted there were other tests, not this change.Not covered
windows-latestrunner): not available here, so the fix itself is not confirmed.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.
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:Host::depth_boundsreads the adapter flags and hands the query's answer todepth_bounds_answer, so the guard is testable without a WARP. Your three mutations, re-run against it: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 onmain).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.
Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-02T22:52:09Z.
The
UNSTABLEhere ismain'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:1089does.unwrap()onRuntime::new, which no longer returns aResultsince057cc94d8.main(16243cd6e) does not compile itsleonida-luatests at all, so every pull request fails that job, and a red check says nothing about this one. I confirmed it withcargo test -p leonida-luaonorigin/main: the same error, exit 101.The one-line fix is pushed to the fork as
fix-main-lua-test-unwrap(cf29393a1,46 passedafter 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.
Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-02T23:35:09Z.
Rebased onto the fixed
main(81efe4566), pushed as1191462f8. TheUNSTABLEwasmain's —leonida-lua's tests did not compile for a few hours (057cc94d8's.unwrap()onRuntime::new), so everyd3d12 (windows-latest)job failed at Build; #3244 fixed it witha22fa26d6.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.
Imported from ubiquitarianism/leonida. Originally posted by enlight3d on 2026-12-03T00:54:21Z.
RUN (in game, gate-style): head
854796496tested 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 withgit merge --no-ffontomainf3865cae8. One conflict, in the credit table ofd3d12/README.mdwhen #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) andd3d12/README.md(#2588, #3119). Built withdiagnostics,mimalloc, targetx86_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 thismainthe 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:Warnings: only kinds that a run on the same
mainwith 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 head854796496; the current head1191462f8is the same three commits rebased onto a newermain(samegit 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)
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.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.