d3d12: size title-memory BLAS vertex ranges by their largest index #428
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/428"
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 gtb-sbe on 2026-11-28T23:19:01Z.
Summary
A bottom-level build in title memory imports its vertex range sized by the geometry's
VertexCount. Only index format 53 was sized by its largest index (#375). The console's builder reads whichever vertex an index names, and ProjectScarlett has R16 indices pastVertexCount(Jerkin42 in #320: 3747 against 16). The host build then reads past the end of the vertex import, and the GPU faults if the next page isn't mapped.DrArroway named this as one candidate for the in-place update fault in #403. That fault now has another explanation, an update whose source was never built, which
ce620c7in #409 handles. In my own game runs no geometry needed the larger range (see Tests). This change closes the over-read for titles and scenes that do need it, and the new Lanes scenario reproduces it onmain.Change
VertexCountto one more than the largest index. The vertex import, or the upload for packed positions, is sized by that count, and the host build gets the same count.VertexCountstill fit, as onmain.validate_shared_range). A build whose indices name such a page is left out, like any other build the provider can't record. With #406, the scene's instances of that structure become inactive.PERFORM_UPDATE) take the same path, so an update gets the same count as the build it updates.Tests
ray-tracing-index-range. A structure in title memory has two geometries, one with 16-bit and one with 32-bit indices. Each triangle names a vertex pages past what itsVertexCountof 3 covers (indices 11000 and 70000). Rays through a scene must hit both triangles where those vertices put them, then again after an in-place update moves the triangles. A second build's indices name a vertex in memory the title only reserved; it must be left out, so its size report stays empty.main(RX 9060 XT, RADV): GPU page fault in the first submission (TCP,WALKER_ERROR 0x5,PERMISSION_FAULTS 0x3,MAPPING_ERROR 0x1,RW 0x0), followed by a gfx ring timeout and reset. The scenario fails with "did not finish within 2 seconds".src/tests/commands/guest_addresses.rs. I ran the crate's unit tests under Proton's Wine: the new ones pass, and so do the format-53 and packed-position tests next to them. In the full crate run, 288 passed and 10 failed. All 10 failures arememory_waitGPU tests that stop atD3D12XboxCreateDeviceunder plain Wine; they don't reach this code.python tuxbox.py checkon Linux, RX 9060 XT (1002:7590), RADV GFX1200, Mesa 26.2.6, kernel 6.18.60, Proton Experimental 20261112:lanes-selftest-ray-tracing-index-rangeincluded. Regression controls: 22 of 22.test_stage_baseline.GuestWatch.test_a_guest_that_died_stops_the_sandbox_instead_of_waiting_out_the_timeout(0 != 'guest gone'). It also fails onmainon my machine; the other 580 tests pass or are skipped.ProjectScarlett 1.0.2.1 (offline, GE-Proton11-14, same card), two runs:
Game Running, with a compute-ring read fault at a title address inside the allocation that holds the title's structures (MAPPING_ERROR 0x0). That fits the first cause in #403, not this over-read.VertexCount. So in this part of the game the change didn't alter anything, and I can't show a game fault it prevents. The run ended on a gfx-ring read of an unmapped native page during draws with one shader pair, with no raytracing command unfinished.The case for the change is the Lanes reproduction and Jerkin42's observation in #320. The provider change applies cleanly on top of #409 as well. I haven't merged the Lanes lists with it.
NVIDIA: not run. I don't have an NVIDIA card; it would be good to have one run before merging, since this changes what the host build is given.
Not covered
VertexCountand the indices seen at recording. The GPU still reads the title's index buffer directly. Copying the indices into an upload would close this gap. It would also cost one upload per geometry per build, including every per-frame update, and would miss indices written between recording and execution.VertexCountfar larger than the indices need, whose range runs past committed memory, stays refused, as onmain.VertexCountcan be larger than the prebuild's. The format-53 path onmainalready does this, and RADV sizes structures and scratch by primitive count. DrArroway plans to query prebuild info after geometry translation on top of #409 (see #409). That covers this case as well, so I left the prebuild query alone here.Related
AI use
I made this branch with an AI coding agent (Claude Code, following
AGENTS.md). The agent read the build path, wrote the Lanes scenario, the change and the unit tests, and ran the checks above on my machine: the scenario againstmain's provider and against this branch, the d3d12 unit tests under Wine, the fullcheck, and two ProjectScarlett runs (one with #406, one with #409, #424 and a temporary counter that isn't part of this branch). I reviewed the diff.