Shaders: a descriptor only read as data takes its kind from its table #1067
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!1067
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1067/head"
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?
@undeadhuman37 on GitHub · 2026-11-24 15:27 UTC · original
undeadhuman37:pr/descriptor-read-as-data→main· +129 −37 · 2 files · 1 commits · closed without mergingWhat changed
An
s_load_dword*of a descriptor whose dwords the code reads as numbers (an image's width and levels) but never samples was refused with "a descriptor read only as data", because the view's kind came only from a use point. Now:Known limit, marked
shortcut:in the code: an unnamed eight-dword heap entry is taken as a 2D image, so a cube, 3D or array texture reads sizes of the wrong rank.Measured
victory translateover the title's shader archive, taken on our integration branch (this commit on top of other fixes, not on bare main), so the deltas on main may be smaller:A hand-assembled waterfall program that reads two textures' sizes is the new test (
waterfall_tests.rs). It fails with the old refusal without the change, and passes on the host GPU and on WARP.Checks on current main (
ffe310e)cargo clippy --workspace --all-targets --locked -- -D warnings, with and without--all-features: cleancargo test -p victory-shader --locked: 121 passed, 0 failed, 1 ignoredNo game data is included, only counts. This work was AI-assisted.
🤖 Generated with Claude Code
@sambagarandawertanda on GitHub · 2026-11-24 15:42 UTC · original
I ran the same small fixture with and without the #1067 lowering on our integration tree. The shader loads a fixed 8-dword SRV table entry with
s_load_dwordx8, reads width and height without sampling, and writes the encoded dimensions to a raw UAV. The input is a generated 8×4 RGBA32F texture.a descriptor read only as data.0x00030007(width minus one = 7, height minus one = 3) on RTX 3080 (driver 32.0.16.2114) and WARP.Two distinct compute shaders hit the same translation refusal in an earlier prologue trace. This test covers a 2D table entry. Array and 3D dimensions and the effect on the prologue remain unverified.
AI-assisted fixture, tested locally with generated data.
@NuraadGit on GitHub · 2026-11-24 16:26 UTC · original
Sizing for NVIDIA: with console-flow wave64 in place, this refusal becomes the largest one in compute, so it pairs well with #439.
Full offline census (26,503 containers, DXIL validation,
--host-lanes 32-32) offfe310e+ #439 (bf0f951) + r4tedx'sshader/wave-per-group+ #493 + #206 + #667 + #704 + #878 + #489 + #294/#709, without this PR:a descriptor read only as dataOf the 411 compute programs my #189 (Wave32) stack refuses for its two main wave reasons, 253 reach this one next on the #439 stack, and only 103 validate. r4tedx counts 730 compute programs at it on #439 alone (#439).
JMAN730's fork has an independent change for the same class,
57c98c7("twin descriptor loads and quad gradients for compute samples"). My stack on that fork is at 1 compute program for this reason (7 in all stages). #979 infers the view in a similar way. So there are three versions of this, worth comparing before one lands.I haven't measured this PR on the #439 stack. The known limit you mark, the 2D guess for an unnamed heap entry, is what I'd check at runtime.
AI-assisted (Claude Code): the census was automated. The hardware, title copy and runs are the user's.
@Zipettte on GitHub · 2026-11-24 16:30 UTC · original
Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at
6d30fd7: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).
@pablogonz12 on GitHub · 2026-11-24 16:38 UTC · original
Independent check on Linux (RX 9070 XT, RADV/Mesa 26.3.1, dxil-spirv master, spirv-val 1.3). Your head
6d30fd7applied alone onto origin/mainffe310e, then the offline four-stage check over the 751-program world dump plus the 52-program BVH capture (768 programs once 35 duplicate containers are skipped):ffe310eExactly those 4 programs clear and nothing else changes: no new refusal, and the 10 spirv-val failures are the same pre-existing ones. "a descriptor's address or format read as data" stays at 1.
For comparison I also built my own attempt at the same 4 programs (a raw buffer view, commit 61085ee in our tree, not pushed): it clears them too, but one lands on "a descriptor's address or format read as data", so 669 translated. Taking the kind from the table is the better fix; I did not open a competing PR.
Not tested: the full archive (only these dumps), in-game, native Windows.
@shortselow-byte on GitHub · 2026-11-24 16:41 UTC · original
#1067 and #1130 both remove the refusal "a descriptor read only as data", in different ways, and neither mentions the other:
shortcut:).Tested on Windows 11, Rust 1.98.1 MSVC, AMD Radeon RX 6900 XT, both on
mainffe310e(neither has a CI run yet):--all-features)6d30fd798f073dThey conflict in
lower.rs(descriptor_data), so whichever merges second needs a rebase. They combine naturally: in #1067's version,match use_at.or_else(|| self.same_entry_use(site)), so #1130's lookup runs first and #1067's table/heap fallback only when no other load of the entry is used. With that one-line resolution (local, not pushed), both new tests pass together (a_descriptor_only_read_as_data_gives_its_views_sizeon the AMD device and WARP,a_descriptor_read_only_as_data_takes_the_kind_of_its_entrys_use), the workspace has 344 passed, 0 failed, and both clippy runs are clean.That order would also keep #1067's 2D guess for heap entries that #1130 can't name, instead of using it first.
@fuzeofficlal on GitHub · 2026-11-24 17:18 UTC · original
Reviewed
6d30fd7alongside#979/#1130/#953and found three edge cases worth tightening in theNonefallback path:None if in_views => (false, count as u8, 0)fabricates 2D SRVs for untracked 8-dword loads & passesmip = 0for UAVs:used_kind(&src)returnsNone(for example ans_load_dwordx8spanning two adjacent 4-dword CBVs or an untrackedResourceHeapload),count == 8unconditionally declares a 2D SRV(2, 0x409); if the backing slot is actually anRWTexture2DUAV,uav = falsepassesmip = 0instead ofundeftodx.op.getDimensions(rejected bydxil.dll). Requiringlet used = self.used_kind(&src).ok_or(NONE)?;avoids guessing untracked slots.used.dwords:used_kindmatchesu.table_offset_dwords <= dwordwith no upper bound, so ans_load_dwordx8(count = 8) after an earlier 4-dword buffer range (u.dwords = 4) is misclassified as a 4-dword buffer unlessin_slot + count <= u32::from(used.dwords)is checked (in_slot = (a.offset % 32) / 4).in_slotinrel = (in_slot + k).wrapping_sub(u32::from(first))also supports LLVM-narrowed single-dwordNUM_RECORDSloads at+0x08(in_slot = 2) instead of failing atrel = 0("a descriptor's address or format read as data").stridefallback (4 if used.is_some() => (11 | u, 0)):u.dwords == 4has a non-zero stride that is not a multiple of 4 (e.g.stride = 2), falling through to raw buffer(11 | u, 0)causesgetDimensionsto return byte length (2 * N) rather than record count (N). Onlystride == 0should map to raw(11 | u, 0).Verified across 8-dword
Texture2D/RWTexture2D, 4-dwordStructuredBuffer/ByteAddressBuffer, and narrowed+0x08RWByteAddressBuffersize readbacks on RTX 5090 + D3D12 WARP +dxil.dllinfuzeofficlal/VIctory@66a9fde.@justlovett0 on GitHub · 2026-11-24 17:32 UTC · original
Runtime verification on Win10/RTX 3080 (driver 621.24): this PR clears the dominant runtime failure class.
We dumped the exact containers of every shader that failed at runtime (
VICTORY_DUMP_REFUSALS, a small diagnostics addition) and censused them withvictory translate. Across the world runs, the captured failing set was ~466 unique shaders, dominated by "a descriptor read only as data" (303) after the mask classes were cleared by #309.With this PR stacked (main
ffe310e+ #175/#994/#302/#193/#704/#309/#953 + this), a re-census of the same captured containers emits 313/381 compute, 11/14 VS/PS, 4/21 mesh — and the in-game untranslated count fell from 444 to 100. Visibly more character and scene geometry loads.Note for the record: #1056 (which we tried first) gained ~0 on this class, consistent with the #1247 benchmark; this PR is the one that moves it. The residual "descriptor read only as data" cases now report as "a descriptor's address or format read as data" (40) — the dword-0/1 subset your summary routes onward.
Remaining runtime classes after this: descriptor-address/format-as-data 40, address-not-from-root 29 (#1276's pattern), address-from-phi 11, image_gather4_l 9, root-UAV/typed-root-view 8.
AI use: Qwen Code (underlying model name not disclosed by the tool) ran the builds/censuses and drafted this comment at the user's request.
@dragoso on GitHub · 2026-11-24 19:19 UTC · original
Offline pipeline-creation check on an RTX 5060 Ti: #1067 on top of #585 adds 540 host pipelines and loses none. Together with #585 it adds 563 over
main. Counts only; no shader names or dumps.victory translate --validate --pipelines --listovershaders.rpf(retail 1.0.2.1, 26,084 programs). A program counts as usable only when its D3D12 pipeline is created on this GPU (NVIDIA RTX 5060 Ti, 32-lane, driver 32.0.16.1742, dxil.dll from SDK 10.0.26100).I measured #1067 stacked on #585 (
ffe310e+ #585 + #1067), not alone. The merge has one conflict, indescriptor_data's branch for a descriptor with no use. Both PRs rewrite it; I took #1067's side, which covers #585's (#585 only handles the case whereused_kindis known).mainffe310emain, 190 of the gains are programs thatmainrefuses earlier, with "a select on an untracked mask". So #1067 counts for more once #585 lands.In the game (same machine, same save, empty shader cache), the stacked build had 0 regressions: no shader whose pipeline was created on
mainfails with it. Likemain, it reaches the world and is removed with0x887A0006.AI-assisted (Claude Code); everything was run on our machine.
@ScarionWorkspace on GitHub · 2026-11-24 20:09 UTC · original
#1067 vs #1130 head-to-head, full archive, bare
main. Windows 11, RX 9070 XT, Rust 1.98.1, dxil.dll from SDK 10.0.26100.victory translate --list --validateovershaders.rpf+ the executable (1.0.2.1, 25,901 programs), each PR alone merged ontomainffe310e, compared program by program:6d30fd7)98f073d)same_entry_usetried before #1067's table fallbacksame_entry_use.AI-assisted (Claude); counts only, no game data.
@BitWuehler on GitHub · 2026-11-24 20:24 UTC · original
In-game Linux + Proton + NVIDIA RTX 5080 A/B verification combining
#585and#1067(using @dragoso'sdescriptor_datamerge resolution where#1067supersedes#585'sNonearm):7.3.6-1-cachyos), Ryzen 7 9800X3D, RTX 5080 16 GB (driver620.73.04),GE-Proton11-14viaumu-run(VKD3D_DISABLE_EXTENSIONS=VK_NV_raw_access_chains), retail1.0.2.1,--console series-x,diagbuild (VICTORY_DEBUG_PS=1,VICTORY_SHOW_TARGET=2560x1440-f28-3,VICTORY_NO_WATCHDOG=1).#994 + #177 + #454 + #1260 + #1267+ localMIN_DYNAMIC = 1 << 18(#747); added#1500 + #1180 + #585 + #1067.n = 30)#585 + #1067(n = 28)415308(−107)"a select on an untracked mask"(#585)890"a descriptor read only as data"(#1067)670(18 moved downstream to"descriptor's address or format read as data")host pipeline refusedwarnings137134draws/frame(median / max)2,076/5,6623,051/8,073(+47%)0/0/00/0/0(reachedframe=1523)No regressions observed (
cargo test -p victory-shader --locked: 97 passed, 0 failed, 1 benchmark ignored). Cross-posted briefly on#585.AI-assisted log analysis; built and run locally on my own retail copy, no game files or raw logs attached.
@thatirishguyyy on GitHub · 2026-11-24 22:52 UTC · original
I rebased
6d30fd7onto70564ae, preserving main’s descriptor-address fallback. Over 26,096 programs, the rebase added 36 DXIL-valid shaders with zero validation regressions. BothPS_PuddleDetectvariants from my RX 9070 XT logs now validate, and all six waterfall tests pass. Cutscene rendering remains unverified on the rebased build. AI-assisted.@Marvisak on GitHub · 2026-11-25 00:31 UTC · original
Automated triage for the maintainers. Closing because this change is already in
main, ormainhas since replaced the code it patches.Main takes a size-only descriptor's kind from a twin load (
75677cb8). What this adds beyond that is a guess: any eight-dword entry with no use is a 2D image. Main's notes rule that out (a 2D getDimensions on a view of another dimension is invalid in D3D12; the open case, PS_PuddleDetect, needs a size table from the host).If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.
Pull request closed