d3d12: rebuild a grown scene in the storage it already has #566
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/566"
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-30T03:51:08Z.
Fixes a crash in ProjectScarlett, announced on #533 and #382 (3kynox has the same one). Overlaps #406 (same functions, which already conflicts with main alone) and possibly @3kynox's unpublished #382 wiring.
Problem. A list captures a scene (a ray-tracing structure in title memory). A later list rebuilds that scene larger at the same guest address.
guest_memory::targetfinds the storage too small and gives the rebuild new storage, so the first list holds a native address the scene no longer has. Submitted after the rebuild, it is refused ("inline ray scene or geometry changed after recording, rejecting submission"), and everything after it on that queue is dropped: its labels never land and the title crashes (access violation atgame_scarlett_master.exe+0x23CF683, exit code 5). On a console the first list reads the rebuilt scene at the same address.Change. A top-level build in title memory that needs new storage gets room for 4 times its instances, at least 2,048 (capped at the host's maximum). Bottom-level structures reserve nothing. If that allocation fails, the exact size is used. A scene that outgrows its room is still moved and refused, as now, and logs "outgrew its storage". I left out running such a list on the old storage: its pins can be retired before that list completes, so it could read freed memory.
Cost: I have no measured bytes per instance. If it's 200 B, five scenes at the floor cost about 2 MB and a 3,058-instance scene 2.4 MB. Copies of a scene grow with their source's storage. One more host size query per top-level build.
Tested
1002:13c0, RADV) and an RTX 5090 (10de:2b85, 620.70.10). The recorded builds aren't executed; the rebuilt contents are built natively into the storage they chose.python tuxbox.py checkof53c0c6ba(rebased ontoe5d2e913; main's reformat only, range-diff in the PR's history): RTX 5090 (10de:2b85, 620.70.10) 200 pass, 0 fail; AMD iGPU (1002:13c0, RADV) 199 pass, 0 fail. GE-Proton11-14.Game (RTX 5090, integration builds of
f482572awith our open PRs, plus a log-only trace): the five runs before it (78b, 79a, 79c, 80a, 81a) ended in this refusal within about 2 minutes of the story loading; the six with it (82a, 83a, 83b, 84a, 84b, 85a; up to 19 minutes in the world, one never got there) had none, and no "outgrew" line. They ended in other ways: four in a GPU loss (Xid 13, MMU fault in a shader), one in the private-views alias fault of #472, one in a MangoHud crash. I have no reason to think this change causes the losses, and no proof that it doesn't; #232.The three
scene_publicationdevice tests, the new one included, pass on53c0c6baon both cards (they need a hardware device and aren't in the suite).@3kynox's three crashed runs on an RTX 4070 Ti SUPER each have the refusal line, and with this change (
fa287c8eon their base) one run of 20 minutes, 11 in the story, had no refusal, no stalled label and no crash (#382). Their unpublished wiring doesn't touch the functions changed here.Not run: a second card of other kinds in the game, a scene that outgrows its room (by game), a title-memory scene copy under load.
Evidence: TuxBox check of
53c0c6ba6f, no uncommitted changes, GPU 10de:2b85: 16 passed, 0 failed, 0 not runEvidence: TuxBox check of
53c0c6ba6f, no uncommitted changes, GPU 1002:13c0: 16 passed, 0 failed, 0 not run🤖 Generated with Claude Code
Imported from brcly/TuxBox. Originally posted by brcly on 2026-11-30T04:12:05Z.
Heads-up: main just landed a large cleanup (up to
e5d2e913), so this PR needs a rebase.rustfmt.toml).unwrap(), lossyascasts and undocumentedunsafeoutside tests.cargo fmt --check, rustdoc with warnings denied, and Miri on the providers' unit tests.The least painful way is to format your branch first, so the rebase only shows real changes:
Then run
python tuxbox.py check --no-gpu, which now includes the format step.If clippy flags something new:
Fromfor widening,TryFromfor narrowing, and a mask for bit fields.unwrap(): use?, orexpectwith the reason it can't fail.unsafeblock: it needs a// SAFETY:comment.CONTRIBUTING's "Code checks" section lists the commands. Thanks!
Imported from brcly/TuxBox. Originally posted by brcly on 2026-11-30T09:32:45Z.
Merged into main as
daea4d76(squashed and credited to you), thanks! The before-and-after game runs (five crashes, then six runs without one, plus @3kynox's run) are what decided it.On the squashed result, d3d12's unit tests pass under Wine except the three
scene_publicationtests, which need a hardware device there; you ran those on both cards. Clippy and formatting are clean.This overlaps #406, which will need to rebase onto it.
Pull request closed