Skip to content

Shaders: a descriptor only read as data of eight dwords is a measured image - #81

Open
undeadhuman37 wants to merge 2 commits into
fxceless:mainfrom
undeadhuman37:fx/descriptor-data-only
Open

undeadhuman37 wants to merge 2 commits into
fxceless:mainfrom
undeadhuman37:fx/descriptor-data-only

Conversation

@undeadhuman37

Copy link
Copy Markdown

What

A scalar load of an image descriptor whose dwords the code reads only as numbers (the width and height bits, never sampled) was refused with "a descriptor read only as data", because the view's kind came only from a use. Now the table's range names the view's kind, and an entry in the resource heap that no range names is taken for a 2D image when it is eight dwords (marked shortcut: in the code). The size then comes from getDimensions.

Two pixel programs of the title's first scene were refused for exactly this and now translate.

Tested

  • cargo clippy --workspace --all-targets -- -D warnings, cargo test --workspace (497 passed, 0 failed) and cargo xtask policy pass, on Windows with an RTX 4070 and the host GPU tests enabled.
  • New test a_descriptor_only_read_as_data_gives_its_views_size: a hand-assembled waterfall program that reads a texture's size through s_load_dwordx8 and v_alignbit_b32, with no sampling. It fails with the old refusal without the change.
  • A 4-minute run of the title with this change: the two pixel refusals are gone and there was no device loss. Not tested: a full session, and any other GPU.
  • No game files, data, logs or captures are included.

AI use: an AI tool (Claude Code) wrote this change; a person ran and reviewed the checks.

… image

The pixel shaders 7d0f14ce44746d7e and 6b6db9f1a526daeb of the world run read
an image descriptor's size bits with no instruction that samples it, so no use
named its kind and the program was refused. Eight dwords are taken for an image
descriptor (2D) and its size comes from getDimensions. The waterfall test runs
the console loop that ends in v_alignbit_b32 of dwords 1 and 2.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@dkdknight

Copy link
Copy Markdown

Tested on an RTX 5080 (merged with #71, #77 and #38 on 4e17478): the four pixel programs that 4e17478 refused with a descriptor read only as data translate, and the run had no device removal.

  • 2fd01fca16993001, 6b6db9f1a526daeb, 7d0f14ce44746d7e, e5b2121a02f4f741: shader does not translate on 4e17478, shader translated with this PR, in the same scene (Series X profile, same save, ~2 min standing in the world).
  • Untranslated programs in the run: 11 on 4e17478, 5 with the four PRs (all five compute: v_cvt_f32_f64 ×2, v_permlanex16_b32, a descriptor's address or format read as data, a lane mask exchanged where not every lane runs). The frame numbers for the merged build are on GPU: use D3D12 COPY queue for relay card-copy fetches and parallelize CARD_COMPARE #71.
  • Not checked: whether the surfaces these programs draw look right, frame by frame.

Setup: NVIDIA GeForce RTX 5080 16 GB, driver 621.14, i9-13900KF, Windows 11 26200, release build.

AI use: Claude Code, Claude Opus 5.5 built the merged branch, ran it on the machine above (the person at the machine played) and read the logs.

@adriaespii

Copy link
Copy Markdown

Independent test run on commit 6236d57 (AMD RDNA4):

  • Hardware: AMD Radeon RX 9070 (driver 32.0.32015.7029), AMD Ryzen 5 7600, Windows 11 Pro, Rust 1.98.1 (x86_64-pc-windows-msvc)
  • cargo clippy --workspace --all-targets -- -D warnings: 0 warnings
  • cargo test --workspace: 497 passed, 0 failed, 7 ignored (victory-shader: 211 passed, 0 failed, 2 ignored; victory-gpu: 110 passed, 0 failed, 1 ignored)
  • Not tested: retail shader pack / live game run (no game files on this machine)

AI use: Antigravity (Gemini 4 Neon) ran clippy/tests locally and wrote this report.

@rocobalt1

Copy link
Copy Markdown

Offline coverage of this PR on the retail shader pack, measured alone on its base 4e17478.

Method: worktree at 4e17478, cargo build --release -p victory, then victory.exe translate <shaders.rpf> --validate --list --jobs 20 with the same Windows SDK validator, compared program by program by program hash against the same command on 4e17478 alone.

programs validated
4e17478 26 531 25 370
+ this PR 26 531 25 405

+35 gained, 0 lost.

All 35 are puddle detection, and only three distinct programs, repeated across containers:

PS_PuddleDetect_2dd9cfaa   PS_PuddleDetect_799735bb   PS_PuddleDetect_686d08e1

That is exactly the refusal the title reports on my machine: converter shader.dxil v1: GFX10 code at 0x51c4/0x49dc/0x4f8c/0x5204/0x4808/0x4c88: a descriptor read only as data is not supported, whose hashes map to PS_PuddleDetect_2dd9cfaa. Six distinct pixel pipelines are refused on this build, all PS_PuddleDetect, and their draws are dropped.

So this one should be testable as a visual difference (wet ground) rather than a count. Largest clean gain I have measured on this pack after the BVH branch (which was +334), and unlike #52 it takes nothing away.

No game data; counts and program names only.

@arminkhaleghirod

Copy link
Copy Markdown

Merged onto main 90228a7 and ran victory translate --validate over the full title (26,148 programs) on Windows 11 / RTX 4080. Changes against main, by failure reason:

  • a descriptor read only as data: 40 → 5
  • DXIL emitted: 14,168 → 14,203
  • No new failure reason. The 35 newly emitted programs join the existing Pipeline State Validation does not match group, like most programs on main.

@oeirughrepuiohg

Copy link
Copy Markdown

A visual regression with this PR under Linux/Proton: the cell's walls disappear in the first gameplay room. Skipping the two pixel programs it makes translate brings them back.

RTX 4070 Ti 12 GB, NVIDIA 620.70.06 (open modules), Fedora 45; Proton Experimental Wine, vkd3d-proton cae8353e (with a local dxil-spirv fix, see below), DXC 1.9.2609. Diag build of 90228a7 + #20 + VIctory #454, Series X, default loop limit, VICTORY_SKIP_PIPELINES=eeed82b877b44b5f, VK_NV_raw_access_chains disabled.

Three runs, same scene (Lucia at the cell window, then walking into the room):

Run Build Cell walls
A without this PR drawn
B with this PR (6236d57 cherry-picked) missing: open sky and ground show where the walls and bunk-side wall should be, around the window and behind the character
C B's executable and warm cache, plus 6b6db9f1a526daeb,7d0f14ce44746d7e in VICTORY_SKIP_PIPELINES drawn again

So with the two pixel programs translated, their draws (3 and 8 per frame here) cover the room's walls. My guess is the shortcut in the change: an eight-dword entry that no range names is taken for a 2D image, and here it may be another kind of view (a cube, for example), so the programs sample the wrong thing. I have not checked what they bind. One run each, so treat it as a lead. It may not show on Windows: the Windows reports above don't mention missing walls.

Unrelated to the walls, for anyone else on Linux: these runs use a local fix for dxil-spirv's endless recursion in the dominator computation (HansKristian-Work/dxil-spirv#376, since closed by its maintainer with a fix on another branch). Without it, four compute pipelines kill their worker thread under Wine every run and stay "being made".

AI use: Claude Code (Claude Opus 5.5) ran these tests on my machine and drafted this comment.

@oeirughrepuiohg

Copy link
Copy Markdown

Correction to my comment above: the missing walls are not caused by this PR.

Two later runs that skip both pixel programs (6b6db9f1a526daeb, 7d0f14ce44746d7e) also lost the cell walls in the same scene (they differed from run C only in speed switches: VICTORY_CARD_BUFFERS_MIN_MB=1 in one, VICTORY_WIDE_BACK=1 in the other). So on this setup the walls come and go between runs, and B and C differing was chance. The shirt's printed text disappears in the same runs, so it looks more like the room's assets sometimes not arriving than like a shader translating wrongly.

Sorry for the noise. Nothing here speaks against the change.

AI use: Claude Code (Claude Opus 5.5) ran these tests on my machine and drafted this comment.

@Peppacodes

Peppacodes commented Nov 24, 2026 •

Copy link
Copy Markdown

Tested on an RTX 5080 (Windows 11, driver 621.24, 32.0.16.2124, Ryzen 7 5700X3D). Build: 4e17478 + this PR, plus #28's watchdog hook and bigger pipeline-worker stacks. Settings: VICTORY_NO_WATCHDOG=1, no relay, no input.

  • The two refusals are gone. 2fd01fca16993001 and 6b6db9f1a526daeb translate. One is bound in the opening scene. Refused programs in the run went from 8 to 6.
  • Stable. 20 minutes in the opening scene, ended by my own time limit, with no device loss. About 420 ms per frame with the relay off.
  • But the opening window renders differently, at the same point of the same scene. I compared frame 4000 of a run without this change (same build otherwise) and with it:
    • Without: a wire mesh over the window, strong sun glare through it, and papers pinned on the wall to the right of the window.
    • With: the glass is completely clear (no mesh, no glare), the people in the yard are sharp, and the papers on the wall are not drawn.

The two programs this PR fixes were refused before, so their draws didn't run in the run without it. The window and wall difference therefore suggests the change also alters how some other, already-translating program resolves its views. A likely candidate is "the table's range names the view's kind". I haven't traced which program draws the glass or the papers. Is the clear glass what you see on the 4070 too?

AI-assisted (Claude Code). Runs on my own machine with my own copy; no captures attached.

A refused descriptor load is deferred: where nothing needs its dwords the
program translated before. The eight-dword fallback also applied there, adding a
2D heap handle and getDimensions to programs that already worked. It now runs
only after the whole emit has refused with that message, so a program that
translated before comes out as it did.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@Peppacodes

Copy link
Copy Markdown

Correction: the window difference in my report above probably isn't caused by this PR, the same conclusion as the correction above mine.

A later run without this PR, on the same machine and scene, came out with the same clear glass and no papers on the wall. That run was the base build plus an unrelated change, with the late-wait switches on. Over five runs these details came and went: without this PR the papers were missing in 2 of 4 runs and the glass was clear in 1 of 4. One run each can't pin them on this PR.

The rest of the report stands: both refusals are gone (8 → 6 refused programs), and the build held 20 minutes with no device loss.

AI-assisted (Claude Code).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants