d3d12: give paged heap indices without a slot a null view #572
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/572"
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 brcly/TuxBox. Originally posted by NickStallman on 2026-11-30T05:08:45Z.
Rebased onto current main (
91f56511on9a19c767) and checked on both cards (see the update at the end). It does not fix #232 (see the game result). Refs #533, #232.With descriptor paging, the resource index map starts as zeros and programs load it unchecked, so an index without a visible slot reads whatever view slot 0 holds. The visible heap now has one more slot, holding the null view that empty records already get, and the map starts there. Indices with a slot read what they did. HLSL and cache keys don't change. A heap of the host's largest size gives up one slot.
Why. On an RTX 5090, #567's counter showed over a million map indices without a slot that hold non-zero records in ProjectScarlett. It doesn't show a shader reads them, and in the run that lost the GPU slot 0 named "no image", which weighs against this being the cause of #232. No claim that it fixes #232. It removes one way to read a wrong view.
Game result (RTX 5090, 86a, integration build): the fix was active (a log line names the null view's slot, 999,999, and the counter's lines read "the null view … no image"), and the GPU was still lost 9 minutes into the world (minutes in the world itself, from when frames drop below one a second; I first counted from the start of story loading) (Xid 13, MMU fault). So this is not the fix for #232. It removes one way to read a wrong view, and nothing more is claimed.
Update (1 Dec): the first version broke the stride of paged heaps below the host's largest size (32 bytes became 25 to 31), which failed 8 Lanes suites on both cards.
99268c96takes the stride from the arena; a failing unit test is indc47a861. Probe on AMD (GE-Proton11-15): main + this draft alone fails those 8; with the fix 45 of 45 pass. A heap of the host's largest size (ProjectScarlett's) was not affected. Fullpython tuxbox.py checkof this head (GE-Proton11-15): RTX 5090 (10de:2b85, 620.70.10) 202 pass, 0 fail; AMD iGPU (1002:13c0, RADV) 201 pass, 0 fail,bindless-unwrittenincluded.Evidence: TuxBox check of
99268c96ed, no uncommitted changes, GPU 10de:2b85: 16 passed, 0 failed, 0 not runEvidence: TuxBox check of
99268c96ed, no uncommitted changes, GPU 1002:13c0: 16 passed, 0 failed, 0 not runWhat those checks don't cover: the branch is based on
e5d2e913, 51 commits behind main. Six of the eight gates are in that base and pass on both cards.lanes-bindless-table-heap-store-wideand-constrainedcame to main later (539b8cb3), so they aren't in these checks: on40a69c3fplus this change they pass on the AMD iGPU and have not been run on the 5090. An integration build on main82109205that carries this change with others (not a check of this head) passes both of those gates and the full check on both cards (209 and 208 pass, 0 fail). It still needs a rebase and one more check of its own on both cards before it leaves draft.Tested
bindless-unwritten(built; passed on an AMD iGPU1002:13c0in an earlier, pre-rebase form together with a second change).python tuxbox.py check --no-gpuat661b558f: 12 of 12;cargo fmt --check, clippy-D warningsand rustdoc pass on both commits.Not run: Miri; a full check rebased on current main; the game on this head alone (integration builds with the fix have run).
Limits: the null is a Texture2D SRV, so another type read through it is a D3D12 mismatch, as it already is for empty records. An index past the heap still reads past the map (fixing that needs HLSL). Records a title copies to an index the API never wrote now read null, not the copy; following them takes many slots and may name ended textures, so it needs its own measurement.
Update (2 Dec): rebased onto
9a19c767. Upstream's56627188now bounds the map lookup (an index past the map reads slot 0); this PR still covers indices inside the map that no slot was written for, which read slot 0 on main. Two of its own tests now take the tables' read lock (they are an RwLock on main). Fullpython tuxbox.py checkof91f56511(GE-Proton11-15): RTX 5090 (10de:2b85) 212 pass, AMD iGPU (1002:13c0) 211 pass; the one failure on each islanes-selftest-texture-publication(#625, fails on main too).🤖 Generated with Claude Code
Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-11-30T22:41:06Z.
Correction: my warning above was too broad, please read this version. The draft does have a bug, but it doesn't affect ProjectScarlett's large heap, and I shouldn't have said your results or ours may be wrong because of it.
fix/heap-index-clamppasses all on the 5090. All eight are in suites that force a small descriptor heap.limit + 1while the tracked range still coverslimit, andcommands/descriptors.rsderives the stride by dividing them (32 becomes 25 to 31). A fix takes it fromGetDescriptorHandleIncrementSize.I said earlier that every build of ours from 86a may have published the wrong textures. That was a consequence I hadn't checked, and it's wrong.
Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-11-30T22:52:36Z.
The probe has run (AMD iGPU
1002:13c0, RADV, GE-Proton11-15; the 5090 has not been probed):40a69c3f+ this draft onlySo this draft alone causes the 8 Lanes failures, and taking the stride from the arena (it holds the host's increment) repairs them. The unit test for it fails without the fix. I'll push it to this PR with the full checks on both cards.