Shaders: scalar loads from a root view's address read its memory #1056
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1056"
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 Marvisak/VIctory. Originally posted by adamdotpy on 2026-11-24T15:21:01Z.
What
An
s_load_dword*whose address comes from a root descriptor, and whose result the program never uses as a descriptor, reads that buffer's data. Onmainit goes todescriptor_data. That function finds no resource use of the load, so the program stops with "a descriptor read only as data". In theffe310ecensus in #293 that row has 394 programs, 305 of them compute; I can't say how many of them are this case.Such a load is now read the way global loads from a root view already are (
Lower::flat):rawBufferLoadonroot_srv_handle);cbufferLoadLegacyviacbuffer_dword);A load whose result is used as a descriptor (a descriptor stored in a root buffer) goes to
descriptor_dataas before.loads_descriptorchecks every descriptor source,LoadedandFetched, for the load site.Related, without overlap: #667 binds addresses passed in two root constants as root views. #709 reads structured buffer accesses through a root view's raw handle. Neither changes
s_loadfrom a root descriptor's address.Test
scalar_loads_read_a_root_srv_and_a_root_cbv(newemit/root_view_tests.rs) runs a synthetic program with a root view in user SGPRs 0-1 and a table holding a raw UAV. It reads dwords 2 and 3 of the view's memory with ones_load_dwordx2and stores them. The test:root_srvs/root_cbvs);The results are exact on an RTX 4060 Ti and on WARP. On
mainthe program stops with "a descriptor read only as data".Checks
cargo test --workspace --locked: 343 passed, 0 failed, 6 ignored. The GPU tests ran on an RTX 4060 Ti and WARP, with no "skipped" lines.cargo clippy --workspace --all-targets --locked -- -D warningsand the same with--all-features: clean.cargo xtask policy: ok.No title data was used.
🤖 Generated with Claude Code
Imported from Marvisak/VIctory. Originally posted by ThomasHFWright on 2026-11-24T15:30:45Z.
Independent Linux/Wine validation of
417f4e30d22f8ffc1801d60e1b480bbc29781594, based onffe310e. The newscalar_loads_read_a_root_srv_and_a_root_cbvregression passes: both root-view kinds produce the exact[0x2002, 0x2003]readback. The declared SRV/CBV root-view checks also pass.Full workspace unit/integration suite, all features, all 14 generated Windows MSVC test executables:
ffe310ebaselineThe five failures match baseline: empty pipeline library (#347), missing Wine Winsock export (#217), checksum-rejection expectation, nested Cargo fixture build, and Windows xtask attempting to launch host Git. Native Linux shader tests separately pass 96 / 0 / 1, xtask 4 / 0 / 0, and asset policy passes. Windows-target workspace Clippy with all targets/features and
-D warningspasses.Environment: Rust 1.98.1, Wine 11.22, RTX 5090 / NVIDIA 620.73.04, vkd3d-proton
30b0eb9bc12dc9f; natived3dcompiler_47supplied for GPU fixtures, identical runtime DLLs to baseline. Both requested device paths in the new test completed, but this Wine/DXVK setup is not genuine Windows WARP coverage. Optionaldxil.dllvalidation was unavailable; GPU pipeline creation and dispatch/readback executed.Offline and offscreen, no game data or gameplay. No native Windows or Wine doctests. Aggregate counts include existing early-return tests without optional console compilers or the DXIL validator; the new regression executed. AI-assisted testing with Codex.
Imported from Marvisak/VIctory. Originally posted by shortselow-byte on 2026-11-24T16:09:01Z.
This PR has no CI run yet, so I ran the CI's checks at head
417f4e3(onmainffe310e) natively on Windows with an AMD GPU, to complement the Linux/Wine run above: Windows 11, Rust 1.98.1 MSVC, AMD Radeon RX 6900 XT (RDNA2).cargo test --workspace --locked -- --test-threads=1: 343 passed, 0 failed, includingscalar_loads_read_a_root_srv_and_a_root_cbv(AMD device and WARP).cargo clippy --workspace --all-targets --locked -- -D warnings, and with--all-features: clean.cargo xtask policy: ok.Imported from Marvisak/VIctory. Originally posted by adamdotpy on 2026-11-24T16:19:02Z.
This is the red/green I asked for: the same fixture on the copy-only control fails before dispatch with
a descriptor read only as dataat offset 36, and the PR's lowering produces the exact[0x2002, 0x2003]readback on the RX 7900 XT. Combined with the Wine runs on two other adapters, that closes the question on this one — the fix is what makes the difference, not the environment. Noted on dxil.dll validation being unavailable in that run; the other two environments did validate.Imported from Marvisak/VIctory. Originally posted by Zipettte on 2026-11-24T16:30:10Z.
Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at
417f4e3:cargo test -p victory-shaderpasses, 121 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed).Tested with AI assistance (Claude).
Imported from Marvisak/VIctory. Originally posted by jtrudeau1530 on 2026-11-24T16:13:57Z.
Independent red/green check on RX 7900 XT / RADV 26.2.3, Wine 11.18 and vkd3d-proton 3.2.0 (cae8353): exact
417f4e30d2source delta applied toffe310e+ the separate host-only copy fallback61474f6.emit::root_view_tests::scalar_loads_read_a_root_srv_and_a_root_cbvexecuted successfully, including bothhardware: scalar loads from a root Srv exactandhardware: scalar loads from a root Cbv exact. The same fixture on the copy-only control, with production lowering unchanged, fails before dispatch witha descriptor read only as dataat offset36.Limits: dxil.dll validation was unavailable. The fixture's WARP-labelled Wine route also passed but used another hardware adapter; this is not a Windows WARP result. No title/world-rendering improvement is claimed from this synthetic check.
Update 16:44 UTC: repeated the same root-load test executable with Microsoft DXIL validator release 1.7.2308 available through VICTORY_DXIL. Both SRV and CBV modules validated and the exact hardware readbacks passed. The Wine WARP-labelled path still selects hardware; this does not add native Windows WARP coverage.
Imported from Marvisak/VIctory. Originally posted by adamdotpy on 2026-11-24T17:10:18Z.
Thanks for the RDNA3 run @Zipettte — 121 passed / 0 failed at
417f4e3, baseline green on main. Together with the RX 7900 XT red/green this branch's scalar root-view loads are now confirmed on two RDNA3-era and one RDNA2-era part. Nothing actionable.Imported from Marvisak/VIctory. Originally posted by Parakeet-Wheat on 2026-11-24T21:06:54Z.
Ran the offline corpus check on
417f4e3(containsmainffe310e) againstffe310e, to answer how many of the 394 "a descriptor read only as data" programs are this case.610.88), Ryzen 5 5600X, Rust 1.98.1 (x86_64-pc-windows-msvc),dxil.dll1.8.2502, title 1.0.2.1.victory translate <exe> shaders.rpf --list --validate, matched program by program (25,891): 0 outcome changes (21,726 validated / 4,003 failed / 162 rejected on both). No failing program's message changed either: "a descriptor read only as data" stays at 394, so none of them is a scalar load from a root view's address in this title, at least onmainalone.cargo test -p victory-shader --locked: 121 passed, 0 failed, 1 ignored, includingscalar_loads_read_a_root_srv_and_a_root_cbv.Offline translation and validation only; no shader contents or extracted data included. AI-assisted (Claude Code); run on my machine.
Imported from Marvisak/VIctory. Originally posted by adamdotpy on 2026-11-24T21:26:55Z.
Thanks for the corpus check — that negative result is useful: it confirms none of the title's 394 "a descriptor read only as data" programs is a scalar load from a root view's address, so #1056 stays a correctness fix for the general case rather than a recovery for a known title program. The 0 outcome changes on 25,891 programs also matches what I measured locally on the head (unit + GPU tests green, no golden changes).
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T00:32:47Z.
Automated triage for the maintainers.
Needs rebase. This PR does not merge cleanly into current
main(ac2525d). Conflicting files:crates/victory-shader/src/emit/lower.rs.The content has not been reviewed yet; it will be once the branch is rebased onto
main.Generated by Claude Code
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.