Shaders: twin descriptor loads and quad gradients for compute samples #180

Closed
github-bot wants to merge 3 commits from gh-pr/180/head into gh-pr/180/base
Owner

@⁠permadiego on GitHub · 2026-11-24 01:11 UTC · original
permadiego:shader/compute-derivatives → main · +246 −50 · 1 files · 3 commits · closed without merging

What changed

Two causes that stop compute programs, mostly the hundreds of CS_RaytracingResolve material variants:

Descriptors read as data through a twin load. With a non-uniform index, the console compiler reloads an image descriptor in each waterfall loop: one loop reads its size bits (v_alignbit_b32 of dwords 1-2 for the width, s_bfe_u32 of dword 3 for the base level), a later one uses it for image_load. The first load had no resource use of its own, so descriptor_data failed with "a descriptor read only as data". It now takes the view's kind from a twin load: same opcode and immediate offset, base read from the same values, and the same register offset or a v_readfirstlane_b32 of the same VGPR value. The handle is still built from the data load's own address.

Implicit-derivative samples outside pixel shaders. image_sample and image_sample_b in compute were emitted as sample/sampleBias, which validator 1.6 (and 1.7) rejects outside pixel shaders ("Function uses features incompatible with the shader stage (cs)"; checked with dxc 10.0.26100: 1.8 accepts it). The console takes the level from each quad of lanes there too, so these now become sampleGrad with coarse gradients from the quad (lane 1 minus lane 0 across, lane 2 minus lane 0 down, through waveReadLaneAt with console lanes). A bias scales the gradients by 2^bias, the same level for isotropic filtering. Mesh and vertex programs still refuse them ("a cross-lane operation ...") as before.

Measured

victory translate --validate over the title's shaders.rpf (26,084 programs), main 35b054e against this branch:

main this branch
compute validated 1,662 of 2,581 1,758
vertex and pixel validated 12,172 12,183
mesh validated 8,129 8,129

No program that validated on main fails now. With #48 and #69 merged as well, compute goes 1,663 → 2,018 (most CS_RaytracingResolve also need those): "a descriptor read only as data" 356 → 1, and the stage-incompatible validator error 41 → 0.

cargo test -p victory-shader 57 passed; clippy clean.

Overlap

#160 notes that implicit-derivative samples in compute fail the 1.6 validator and leaves that open; this is that piece, for image_sample and image_sample_b. The _cl forms from #73/#160 can use the same quad_gradients once those land.

Not verified

No run on a GPU here: rendering of these programs is untested. Anisotropic filtering with a bias can pick a slightly different footprint than the console's.

🤖 Generated with Claude Code

**@⁠permadiego** on GitHub · 2026-11-24 01:11 UTC · [original](https://github.com/Marvisak/VIctory/pull/180) `permadiego:shader/compute-derivatives` → `main` · +246 −50 · 1 files · 3 commits · closed without merging ## What changed Two causes that stop compute programs, mostly the hundreds of `CS_RaytracingResolve` material variants: **Descriptors read as data through a twin load.** With a non-uniform index, the console compiler reloads an image descriptor in each waterfall loop: one loop reads its size bits (`v_alignbit_b32` of dwords 1-2 for the width, `s_bfe_u32` of dword 3 for the base level), a later one uses it for `image_load`. The first load had no resource use of its own, so `descriptor_data` failed with "a descriptor read only as data". It now takes the view's kind from a twin load: same opcode and immediate offset, base read from the same values, and the same register offset or a `v_readfirstlane_b32` of the same VGPR value. The handle is still built from the data load's own address. **Implicit-derivative samples outside pixel shaders.** `image_sample` and `image_sample_b` in compute were emitted as `sample`/`sampleBias`, which validator 1.6 (and 1.7) rejects outside pixel shaders ("Function uses features incompatible with the shader stage (cs)"; checked with dxc 10.0.26100: 1.8 accepts it). The console takes the level from each quad of lanes there too, so these now become `sampleGrad` with coarse gradients from the quad (lane 1 minus lane 0 across, lane 2 minus lane 0 down, through `waveReadLaneAt` with console lanes). A bias scales the gradients by 2^bias, the same level for isotropic filtering. Mesh and vertex programs still refuse them ("a cross-lane operation ...") as before. ## Measured `victory translate --validate` over the title's `shaders.rpf` (26,084 programs), `main` 35b054e against this branch: | | main | this branch | |---|---|---| | compute validated | 1,662 of 2,581 | 1,758 | | vertex and pixel validated | 12,172 | 12,183 | | mesh validated | 8,129 | 8,129 | No program that validated on `main` fails now. With #48 and #69 merged as well, compute goes 1,663 → 2,018 (most `CS_RaytracingResolve` also need those): "a descriptor read only as data" 356 → 1, and the stage-incompatible validator error 41 → 0. `cargo test -p victory-shader` 57 passed; clippy clean. ## Overlap #160 notes that implicit-derivative samples in compute fail the 1.6 validator and leaves that open; this is that piece, for `image_sample` and `image_sample_b`. The `_cl` forms from #73/#160 can use the same `quad_gradients` once those land. ## Not verified No run on a GPU here: rendering of these programs is untested. Anisotropic filtering with a bias can pick a slightly different footprint than the console's. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
A descriptor reloaded in each waterfall loop of a non-uniform index is
read for its size bits by one load and used by another, so the first
had no resource use and the program stopped. Its view kind now comes
from a twin load: same opcode and offset, same base values, and the
same register offset or a v_readfirstlane_b32 of the same VGPR value.

image_sample and image_sample_b outside pixel shaders were emitted as
sample/sampleBias, which validator 1.6 rejects there. The console takes
the level from each quad of lanes, so they become sampleGrad with
coarse gradients from the quad (a bias scales them by 2^bias).

Over shaders.rpf: compute validated 1,662 -> 1,758 of 2,581, vertex and
pixel 12,172 -> 12,183, none lost.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A join of registers that held a descriptor on one edge and data on
another failed the whole program ("a scalar memory read as data" or "a
descriptor read only as data"): the dwords now enter the phi as undef on
the descriptor edge. An eight-dword descriptor whose only reads are its
size bits, with no access in the program, is taken as a 2D texture for
getDimensions.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The explicit gradients for image_sample/_b outside pixel shaders read
lanes within the sample's own quad. Four lanes of a quad share a host
wave of any size, so these no longer set console lanes, which declared
WaveSize(64) for wave64 programs; a 32-lane host refuses those
pipelines (12 compute programs on NVIDIA: sky, fog, shadow denoise,
entity mask).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:53:36 +00:00
github-bot closed this pull request 2026-11-26 03:53:36 +00:00
Author
Owner

@⁠DaviTostes on GitHub · 2026-11-24 01:19 UTC · original

Tested c78056c on Arch Linux x86_64, rustc 1.98.1: pass.

  • cargo test -p victory-shader: 51 passed, 0 failed (2 test binaries).
  • The diff adds no test for the twin descriptor loads / quad gradients; this run only shows nothing else broke.
  • The full workspace still needs #112 for the victory-gpu E0425.

No game data used.

**@⁠DaviTostes** on GitHub · 2026-11-24 01:19 UTC · [original](https://github.com/Marvisak/VIctory/pull/180#issuecomment-7118989950) Tested `c78056c` on **Arch Linux x86_64, rustc 1.98.1**: **pass**. - `cargo test -p victory-shader`: **51 passed, 0 failed** (2 test binaries). - The diff adds no test for the twin descriptor loads / quad gradients; this run only shows nothing else broke. - The full workspace still needs #112 for the `victory-gpu` E0425. No game data used.
Author
Owner

@⁠permadiego on GitHub · 2026-11-24 01:48 UTC · original

Thanks for the test run. The 36 that still said "a descriptor read only as data" were almost all PS_PuddleDetect (35 of them). 5ff639e covers two causes:

  • Descriptor dwords at a join. The registers hold a descriptor on one edge and data on the other (they are reused after the last access). The phi took the descriptor edge as a failure. It now takes undef on that edge. This also clears many "a scalar memory read as data" cases.
  • Images read only for their size. PS_PuddleDetect loads an 8-dword descriptor and reads only its width/height/level bits. There is no access to it in the program, so there was no use to take the kind from. It is now taken as a 2D SRV for getDimensions. A 3D or array image would report depth 1; that shortcut is commented in the code.

Full shaders.rpf scan, c78056c → 5ff639e: +361 validated, 0 lost (Ps +236, Ms +121, Cs +4). Totals: VS/PS 12,183 → 12,419, mesh 8,129 → 8,250, compute 1,758 → 1,762. One compute program still has that error (CS_MinTimestepReduce): it reads a buffer descriptor's record count to exit early, which is a different case.

cargo test -p victory-shader 57 passed; clippy clean.

🤖 Generated with Claude Code

**@⁠permadiego** on GitHub · 2026-11-24 01:48 UTC · [original](https://github.com/Marvisak/VIctory/pull/180#issuecomment-7119470371) Thanks for the test run. The 36 that still said "a descriptor read only as data" were almost all `PS_PuddleDetect` (35 of them). 5ff639e covers two causes: - **Descriptor dwords at a join.** The registers hold a descriptor on one edge and data on the other (they are reused after the last access). The phi took the descriptor edge as a failure. It now takes undef on that edge. This also clears many "a scalar memory read as data" cases. - **Images read only for their size.** `PS_PuddleDetect` loads an 8-dword descriptor and reads only its width/height/level bits. There is no access to it in the program, so there was no use to take the kind from. It is now taken as a 2D SRV for `getDimensions`. A 3D or array image would report depth 1; that shortcut is commented in the code. Full `shaders.rpf` scan, c78056c → 5ff639e: **+361 validated, 0 lost** (Ps +236, Ms +121, Cs +4). Totals: VS/PS 12,183 → 12,419, mesh 8,129 → 8,250, compute 1,758 → 1,762. One compute program still has that error (`CS_MinTimestepReduce`): it reads a buffer descriptor's record count to exit early, which is a different case. `cargo test -p victory-shader` 57 passed; clippy clean. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Author
Owner

@⁠Raxstreams on GitHub · 2026-11-24 01:31 UTC · original · edited 2026-11-24 01:58 UTC

Confirmed the twin-load fix on Windows with an RTX 3080 Ti (Wave32, driver 617.14) and the 10.0.26100 DXIL validator. I replayed 311 shader containers from a world-loading run, comparing the same inputs before and after integrating this PR, with #48 and #69 already present and without #136.

All 60 shaders previously stopped by a descriptor read only as data advanced past it. 50 validated and created D3D12 pipelines. The other 10 now stop at a lane-mask join of an untracked mask. Across all 311, the number passing both checks went from 3 to 53, with no losses.

I also dispatched a synthetic compute shader which loads the same buffer descriptor twice, uses one load as the store handle, and reads dword 2 of the other as data. Binding raw UAVs of 28 and 76 bytes returned 28 and 76 respectively on both the hardware GPU and WARP.

This is an integration test. The local port used physical wave lane indices for quad reads on the split-Wave64 path and restricted the twin lookup to the defining block. The title shaders were validated and had their pipelines created offline. Frame rendering and sampled texture values are still unverified.

I also tested all 428 unique archive shaders whose baseline error was a descriptor read only as data, plus 60 previously passing controls. With #180 as the only added PR, 325 of the 428 passed both validation and pipeline creation. Another 67 reached a different failure, and 36 still reported the original descriptor error. All 60 controls still passed.

Further local follow-up on the remaining shaders in that descriptor cohort: after integrating #136, 41 still stopped at a lane-mask join and one still needed a descriptor-only read. Fixing spilled/numeric Wave32 mask joins and recognizing an exactly bound structured buffer from the original PSV0 resource declarations made all 42 validate and create D3D12 compute pipelines. The last shader was ShallowWaterSim:CS_MinTimestepReduce: its SRV at register 109 in space 1 is used solely for its record count. A separate GPU dispatch returned 3 and 11 for two distinct 16-byte-stride bindings with those record counts. These additional fixes are local; the figures above for #180 alone still stand.

**@⁠Raxstreams** on GitHub · 2026-11-24 01:31 UTC · [original](https://github.com/Marvisak/VIctory/pull/180#issuecomment-7119180171) · edited 2026-11-24 01:58 UTC Confirmed the twin-load fix on Windows with an RTX 3080 Ti (Wave32, driver 617.14) and the 10.0.26100 DXIL validator. I replayed 311 shader containers from a world-loading run, comparing the same inputs before and after integrating this PR, with #48 and #69 already present and without #136. All 60 shaders previously stopped by `a descriptor read only as data` advanced past it. **50 validated and created D3D12 pipelines**. The other 10 now stop at `a lane-mask join of an untracked mask`. Across all 311, the number passing both checks went from 3 to 53, with no losses. I also dispatched a synthetic compute shader which loads the same buffer descriptor twice, uses one load as the store handle, and reads dword 2 of the other as data. Binding raw UAVs of 28 and 76 bytes returned 28 and 76 respectively on both the hardware GPU and WARP. This is an integration test. The local port used physical wave lane indices for quad reads on the split-Wave64 path and restricted the twin lookup to the defining block. The title shaders were validated and had their pipelines created offline. Frame rendering and sampled texture values are still unverified. I also tested all 428 unique archive shaders whose baseline error was `a descriptor read only as data`, plus 60 previously passing controls. With #180 as the only added PR, 325 of the 428 passed both validation and pipeline creation. Another 67 reached a different failure, and 36 still reported the original descriptor error. All 60 controls still passed. Further local follow-up on the remaining shaders in that descriptor cohort: after integrating #136, 41 still stopped at a lane-mask join and one still needed a descriptor-only read. Fixing spilled/numeric Wave32 mask joins and recognizing an exactly bound structured buffer from the original PSV0 resource declarations made all 42 validate and create D3D12 compute pipelines. The last shader was `ShallowWaterSim:CS_MinTimestepReduce`: its SRV at register 109 in space 1 is used solely for its record count. A separate GPU dispatch returned 3 and 11 for two distinct 16-byte-stride bindings with those record counts. These additional fixes are local; the figures above for #180 alone still stand.
Author
Owner

@⁠r4tedx on GitHub · 2026-11-24 04:16 UTC · original

An independent confirmation of the second cause in the description, and a note on how this meets #233.

Confirmed. A whole-title translate --validate run on #233's stack found 43 compute modules that fail validation, all calling sample, and I spent a while looking for the cause in my own PRs before reproducing it on main's lowering with a hand-assembled compute program (one image_sample, dxil.dll 1.8.2502.11):

  • It fails in every group shape and with any declared wave size: Entry function performs some operation that is incompatible with the shader stage or other entry properties and Function uses features incompatible with the shader stage (cs) of the entry function.
  • With the module declaring validator version 1.8 in a local experiment, that goes away, as you say. What is left is a PSV0 size mismatch (48 against 52) for groups whose dimensions allow derivatives, and for the others derivatives require NumThreads to be 1D and a multiple of 4, or 2D/3D with X and Y both multiples of 2. So sampleGrad from the quad is the fix that works under the validator version we declare.

Why it matters beyond validation: one of those modules is the pipeline an older NVIDIA driver refuses after its shader compiler raises a first-chance exception. D3D12 does not validate what we sign, so these reach the driver as they are.

With #233. The two conflict in one place in emit/lower.rs, where a compute program is found to need the console's lanes: #233 splits that condition into reads that stay inside 32 lanes (DPP, ds_swizzle) and reads that may cross the halves of a wave64. Quad gradients read within four lanes, so they belong with the first kind, and such a program then runs on a 32-lane host as two halves, with lane_index and read_lane as you use them. I will resolve it that way on my side if this lands first. From reading the merge; I did not build the combination.

No game data used. AI-assisted.

**@⁠r4tedx** on GitHub · 2026-11-24 04:16 UTC · [original](https://github.com/Marvisak/VIctory/pull/180#issuecomment-7121872090) An independent confirmation of the second cause in the description, and a note on how this meets #233. **Confirmed.** A whole-title `translate --validate` run on #233's stack found [43 compute modules that fail validation, all calling `sample`](https://git.gtahub.st/github/Marvisak--VIctory/pulls/233), and I spent a while looking for the cause in my own PRs before reproducing it on `main`'s lowering with a hand-assembled compute program (one `image_sample`, `dxil.dll` 1.8.2502.11): - It fails in every group shape and with any declared wave size: `Entry function performs some operation that is incompatible with the shader stage or other entry properties` and `Function uses features incompatible with the shader stage (cs) of the entry function`. - With the module declaring validator version 1.8 in a local experiment, that goes away, as you say. What is left is a `PSV0` size mismatch (48 against 52) for groups whose dimensions allow derivatives, and for the others `derivatives require NumThreads to be 1D and a multiple of 4, or 2D/3D with X and Y both multiples of 2`. So `sampleGrad` from the quad is the fix that works under the validator version we declare. Why it matters beyond validation: one of those modules is [the pipeline an older NVIDIA driver refuses](https://git.gtahub.st/github/Marvisak--VIctory/pulls/233) after its shader compiler raises a first-chance exception. D3D12 does not validate what we sign, so these reach the driver as they are. **With #233.** The two conflict in one place in `emit/lower.rs`, where a compute program is found to need the console's lanes: #233 splits that condition into reads that stay inside 32 lanes (DPP, `ds_swizzle`) and reads that may cross the halves of a wave64. Quad gradients read within four lanes, so they belong with the first kind, and such a program then runs on a 32-lane host as two halves, with `lane_index` and `read_lane` as you use them. I will resolve it that way on my side if this lands first. From reading the merge; I did not build the combination. No game data used. AI-assisted.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-24 04:29 UTC · original

I checked the compute sampling change in 5ff639e with a synthetic four-mip texture and a 32-thread group. Adjacent quads use different coordinate slopes. I required DXIL validation with Windows SDK 10.0.26100 (dxil.dll 1.8.2502.11) before creating the D3D12 pipeline and dispatching.

Sampling form Values in alternating quads
Explicit LOD 0 11 / 11
Explicit LOD 0 or 2 11 / 33
Implicit image_sample 11 / 33
image_sample_b with +1 bias 22 / 44

All 32 lanes matched on both an RTX 5090 and AMD Radeon Graphics. With the same fixture and pre-PR lowering from 35b054e, both explicit controls still validated and matched. The two implicit forms failed validation with the compute-stage incompatibility diagnostic.

This covers the native Wave32 path with point sampling. The split-wave path and title rendering are outside the test.

**@⁠fuzeofficlal** on GitHub · 2026-11-24 04:29 UTC · [original](https://github.com/Marvisak/VIctory/pull/180#issuecomment-7122068259) I checked the compute sampling change in `5ff639e` with a synthetic four-mip texture and a 32-thread group. Adjacent quads use different coordinate slopes. I required DXIL validation with Windows SDK 10.0.26100 (`dxil.dll` 1.8.2502.11) before creating the D3D12 pipeline and dispatching. | Sampling form | Values in alternating quads | | --- | --- | | Explicit LOD 0 | 11 / 11 | | Explicit LOD 0 or 2 | 11 / 33 | | Implicit `image_sample` | 11 / 33 | | `image_sample_b` with +1 bias | 22 / 44 | All 32 lanes matched on both an RTX 5090 and AMD Radeon Graphics. With the same fixture and pre-PR lowering from `35b054e`, both explicit controls still validated and matched. The two implicit forms failed validation with the compute-stage incompatibility diagnostic. This covers the native Wave32 path with point sampling. The split-wave path and title rendering are outside the test.
Author
Owner

@⁠r4tedx on GitHub · 2026-11-24 04:31 UTC · original

Follow-up to my note above: I have now built and run this PR together with the wave64 stack, where before I had only read the merge.

Tested 5ff639e merged into #439's head e49302a (#223, #233, #320, #439), on an NVIDIA RTX 5070 (32..32, wave64 programs in two 32-lane halves) and an AMD Radeon iGPU (RDNA2, 32..64), Windows 11, debug, dxil.dll 1.8.2502.11:

  • One conflict, resolved as described above: implicit_derivatives goes with DPP and ds_swizzle among the reads that stay inside a 32-lane half. cargo test --workspace: 289 passed, 0 failed, 4 ignored.
  • A hand-assembled compute program (texture and sampler loaded from tables, one image_sample, the red channel stored per lane), with and without a DPP read, in groups of 64x1x1, 8x8x1, 32x1x1, 128x1x1 and 4x4x2:
RTX 5070 Radeon iGPU
module sampleGrad + waveReadLaneAt, WaveSize(32), validates the same with WaveSize(64), validates
dispatched on a constant-colour texture the sampled value in every written dword the same

On main's lowering the same program fails validation in every one of those shapes. A constant texture does not test the level the gradients select, only that the form runs and reads the right texel; your own tests cover the level.

For testers: the combination is pushed as r4tedx:integration/wave64-with-180 (24b3bcc). @⁠SlopComp, if you have time for one more whole-title translate --validate on it: the 43 compute modules that failed validation on the stack all called sample, so the count I would expect there is 0 of those 43, and that would confirm this PR as the fix for them.

No game data used. AI-assisted.

**@⁠r4tedx** on GitHub · 2026-11-24 04:31 UTC · [original](https://github.com/Marvisak/VIctory/pull/180#issuecomment-7122099834) Follow-up to [my note above](https://git.gtahub.st/github/Marvisak--VIctory/pulls/180): I have now built and run this PR together with the wave64 stack, where before I had only read the merge. **Tested** `5ff639e` merged into #439's head `e49302a` (#223, #233, #320, #439), on an NVIDIA RTX 5070 (32..32, wave64 programs in two 32-lane halves) and an AMD Radeon iGPU (RDNA2, 32..64), Windows 11, debug, `dxil.dll` 1.8.2502.11: - One conflict, resolved as described above: `implicit_derivatives` goes with DPP and `ds_swizzle` among the reads that stay inside a 32-lane half. `cargo test --workspace`: 289 passed, 0 failed, 4 ignored. - A hand-assembled compute program (texture and sampler loaded from tables, one `image_sample`, the red channel stored per lane), with and without a DPP read, in groups of 64x1x1, 8x8x1, 32x1x1, 128x1x1 and 4x4x2: | | RTX 5070 | Radeon iGPU | |---|---|---| | module | `sampleGrad` + `waveReadLaneAt`, `WaveSize(32)`, **validates** | the same with `WaveSize(64)`, **validates** | | dispatched on a constant-colour texture | the sampled value in every written dword | the same | On `main`'s lowering the same program fails validation in every one of those shapes. A constant texture does not test the level the gradients select, only that the form runs and reads the right texel; your own tests cover the level. **For testers:** the combination is pushed as [`r4tedx:integration/wave64-with-180`](https://github.com/r4tedx/VIctory/tree/integration/wave64-with-180) (`24b3bcc`). @⁠SlopComp, if you have time for one more whole-title `translate --validate` on it: the 43 compute modules that failed validation on the stack all called `sample`, so the count I would expect there is 0 of those 43, and that would confirm this PR as the fix for them. No game data used. AI-assisted.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-24 04:38 UTC · original

I extended the mip readback to the shared integration commit 24b3bcc (#180 + the #439 stack). The synthetic 64×1×1 group alternates 1- and 4-texel quad slopes, reverses the pattern in the upper half, and shifts the fourth lane of each quad without changing the coarse gradients.

Sampling form First two quads in the lower half First two in the upper half
Explicit LOD 0 11 / 11 11 / 11
Explicit LOD 0 or 2 11 / 33 33 / 11
Implicit image_sample 11 / 33 33 / 11
image_sample_b with +1 bias 22 / 44 44 / 22

The same four cases also passed with an LDS exchange. Each lane used the value from lane lane ^ 32 as a low-bit tag in the readback, so the oracle checks both the selected mip and the cross-half value. All 64 lanes matched in all cases on RTX 5090 (two Wave32 halves) and Radeon iGPU (native Wave64). Every module passed Windows SDK DXIL validation (1.8.2502.11) before dispatch.

This is native D3D12 coverage of the synthetic point-sampling and LDS paths. Tested integration commit

**@⁠fuzeofficlal** on GitHub · 2026-11-24 04:38 UTC · [original](https://github.com/Marvisak/VIctory/pull/180#issuecomment-7122207303) I extended the mip readback to the shared integration commit `24b3bcc` (#180 + the #439 stack). The synthetic `64×1×1` group alternates 1- and 4-texel quad slopes, reverses the pattern in the upper half, and shifts the fourth lane of each quad without changing the coarse gradients. | Sampling form | First two quads in the lower half | First two in the upper half | | --- | --- | --- | | Explicit LOD 0 | 11 / 11 | 11 / 11 | | Explicit LOD 0 or 2 | 11 / 33 | 33 / 11 | | Implicit `image_sample` | 11 / 33 | 33 / 11 | | `image_sample_b` with +1 bias | 22 / 44 | 44 / 22 | The same four cases also passed with an LDS exchange. Each lane used the value from lane `lane ^ 32` as a low-bit tag in the readback, so the oracle checks both the selected mip and the cross-half value. All 64 lanes matched in all cases on RTX 5090 (two Wave32 halves) and Radeon iGPU (native Wave64). Every module passed Windows SDK DXIL validation (1.8.2502.11) before dispatch. This is native D3D12 coverage of the synthetic point-sampling and LDS paths. [Tested integration commit](https://github.com/r4tedx/VIctory/commit/24b3bccb2c5374d04a0d0435cd15f7759fb0093b)
Author
Owner

@⁠EduAzevedo on GitHub · 2026-11-24 04:41 UTC · original

Measured 5ff639e on the retail shaders (v1.0.2.1, Series X package), offline with victory translate --jobs 8 --list, all 26,148 programs, against main d2a4bae, alone and merged with #309 (64c7188, clean merge):

main this PR #309 this PR + #309
Vertex and pixel programs emitted 12,284 12,538 12,380 12,642
a descriptor read only as data 183 1 692 1
Programs refused (any reason) 3,814 3,366 3,678 2,670
  • Alone, 456 more programs translate (249 pixel, 125 mesh, 77 compute, 5 vertex). Of the 183 descriptor read only as data programs on main, 154 translate.
  • With #309, 1,144 more than main (613 compute, 353 pixel, 173 mesh, 5 vertex). #309 moves 692 programs to descriptor read only as data; with this PR 641 of those translate.
  • 8 compute programs that translate on main fail here, all at v_swap_b32 / v_xnor_b32. This branch's merge base is 35b054e, before #58 landed; merged onto d2a4bae (via #309) none of them fail, so a rebase on main should clear it.

Translation only; I have not checked these programs' output in a game run.

AI-assisted.

**@⁠EduAzevedo** on GitHub · 2026-11-24 04:41 UTC · [original](https://github.com/Marvisak/VIctory/pull/180#issuecomment-7122253381) Measured `5ff639e` on the retail shaders (v1.0.2.1, Series X package), offline with `victory translate --jobs 8 --list`, all 26,148 programs, against `main` `d2a4bae`, alone and merged with #309 (`64c7188`, clean merge): | | `main` | this PR | #309 | this PR + #309 | |---|---|---|---|---| | Vertex and pixel programs emitted | 12,284 | **12,538** | 12,380 | **12,642** | | `a descriptor read only as data` | 183 | **1** | 692 | **1** | | Programs refused (any reason) | 3,814 | 3,366 | 3,678 | **2,670** | - Alone, 456 more programs translate (249 pixel, 125 mesh, 77 compute, 5 vertex). Of the 183 `descriptor read only as data` programs on `main`, 154 translate. - With #309, 1,144 more than `main` (613 compute, 353 pixel, 173 mesh, 5 vertex). #309 moves 692 programs to `descriptor read only as data`; with this PR 641 of those translate. - **8 compute programs that translate on `main` fail here, all at `v_swap_b32` / `v_xnor_b32`.** This branch's merge base is `35b054e`, before #58 landed; merged onto `d2a4bae` (via #309) none of them fail, so a rebase on `main` should clear it. Translation only; I have not checked these programs' output in a game run. AI-assisted.
Author
Owner

@⁠iurysf on GitHub · 2026-11-24 07:21 UTC · original

Measured offline against main d2a4bae with victory translate --list --validate over the title's shaders.rpf + executable (26,096 programs), dxil.dll 1.9.2602.17:

failures "descriptor read only as data" "scalar memory read as data" rejected by validator
main 3,733 183 573 185
main + this PR 3,273 (−460) 1 133 173
main + this PR + #136 3,080 (−653) 1 0 53 (mesh only)
  • No regressions: no module that validated on main is rejected, and nothing newly fails.
  • The twin descriptor load (the first copy only reads NUM_RECORDS − 1 for an index clamp) and the waterfall pattern (repeated s_load_dwordx8, measuring the image in one loop and sampling in another) are what most of the remaining "read only as data" programs on main look like, and this PR clears nearly all of them.
  • It collides with #136 in two regions of descriptor_data (lower.rs). A hand resolution is here: https://github.com/iurysf/VIctory/commits/union-136-180 (df69a52, ~40 lines). See my comment on #136 for the combined numbers.
  • Against the clean-merging stack from #201 (#306, #592, #309, #571, #573, #576, #585), it conflicts in 3 regions.

AI-assisted.

**@⁠iurysf** on GitHub · 2026-11-24 07:21 UTC · [original](https://github.com/Marvisak/VIctory/pull/180#issuecomment-7124901229) Measured offline against main `d2a4bae` with `victory translate --list --validate` over the title's `shaders.rpf` + executable (26,096 programs), dxil.dll 1.9.2602.17: | | failures | "descriptor read only as data" | "scalar memory read as data" | rejected by validator | |---|---:|---:|---:|---:| | main | 3,733 | 183 | 573 | 185 | | main + this PR | 3,273 (−460) | **1** | 133 | 173 | | main + this PR + #136 | **3,080 (−653)** | 1 | 0 | **53** (mesh only) | - No regressions: no module that validated on main is rejected, and nothing newly fails. - The twin descriptor load (the first copy only reads `NUM_RECORDS − 1` for an index clamp) and the waterfall pattern (repeated `s_load_dwordx8`, measuring the image in one loop and sampling in another) are what most of the remaining "read only as data" programs on main look like, and this PR clears nearly all of them. - It collides with #136 in two regions of `descriptor_data` (`lower.rs`). A hand resolution is here: https://github.com/iurysf/VIctory/commits/union-136-180 (`df69a52`, ~40 lines). See my comment on #136 for the combined numbers. - Against the clean-merging stack from #201 (#306, #592, #309, #571, #573, #576, #585), it conflicts in 3 regions. AI-assisted.
Author
Owner

@⁠iurysf on GitHub · 2026-11-24 10:08 UTC · original

Data point for merge order: since #612 landed, this PR is also the right fix for most of its fallout. On main 58fed37 it brings back 240 of the 323 programs #612 stopped (229 compute, mostly "a descriptor read only as data"), without regressions, for 22,219 validated against 21,678 on main. Breakdown in #736. AI-assisted.

**@⁠iurysf** on GitHub · 2026-11-24 10:08 UTC · [original](https://github.com/Marvisak/VIctory/pull/180#issuecomment-7128361116) Data point for merge order: since #612 landed, this PR is also the right fix for most of its fallout. On main `58fed37` it brings back **240 of the 323** programs #612 stopped (229 compute, mostly "a descriptor read only as data"), without regressions, for 22,219 validated against 21,678 on main. Breakdown in #736. AI-assisted.
Author
Owner

@⁠Pablo-Barros on GitHub · 2026-11-24 10:48 UTC · original

On a 32-lane host, #180 5ff639e merged onto main ffe310e (clean merge), whole title (translate --validate --pipelines --list, dxil.dll 10.0.26100.0). Windows 11 26300, RTX 3070, driver 32.0.16.1088. Per program, with victory compare (#787); 25,953 programs in both, none in only one.

main main + #180
compute: emitted / validated / pipelines 1,441 / 1,417 / 1,121 1,745 / 1,745 / 1,412
vertex and pixel: emitted / validated / pipelines 12,243 / 12,167 / 12,243 12,381 / 12,298 / 12,381
mesh: emitted / validated / pipelines 8,214 / 8,152 / 8,214 8,301 / 8,235 / 8,301
pipelines gained / lost 528 / 12
validations gained / lost 542 / 0
pipelines from modules the validator refuses 155 149 (11 of the 528 gained)

Gains. a descriptor read only as data → pipeline created: 355. a scalar memory read as data → pipeline created: 160. Nine more arrive through a signature mismatch the validator reports and the driver takes. No program that validates on main fails to now.

The 12 lost pipelines are on this host only, and here is why. All 12 are compute programs that on main emit a module with an implicit-derivative sample: the validator refuses it, the driver creates the pipeline. With #180 the module validates, and the driver refuses it with E_INVALIDARG. The emitted PSV0 says what changed: on main these 12 declare no wave size; with #180 they declare WaveSize(64), which a 32-lane host does not run. On main the 320 compute modules that declare 64 are exactly the 320 refused on this card; with #180, 333 declare 64 and 333 are refused. The 13 added are these 12 and one program the translator refused before.

So the 24 compute modules with the stage-incompatible sample, on this card:

on main with #180 programs
invalid, pipeline created valid, WaveSize(64), refused 12
invalid, pipeline created valid, pipeline created 5
invalid, refused (already WaveSize(64)) valid, refused 7

The 12: CS_SkyMain_1d0e398e, CS_ApplyCombinedDeferred_1e5750b4, CS_ApplyCombinedDeferredAddFogMod_1e5750b4, CS_ApplyDiffusionInScattering_HeatHaze_4d282595, CS_IndirectApplyDiffusionInScattering_HeatHaze_c909c675, CS_DensityShadowBlur_V_12dd9302, CS_DensityShadowBlur_H_12dd9302, CS_DenoiseSpatialSeparableX_0e2554f4, and CS_EntityMask_BlurSynthesis_{4,6}Channels_41a5b9c1, CS_EntityMask_BlurSynthesis_DepthMask_{4,6}Channels_b9b2f7ac.

What that means for merging. On NVIDIA, #180 alone trades 12 running-but-invalid compute pipelines (sky, fog, shadow denoise, entity mask) for valid ones whose dispatches will be dropped, until a wave64-on-32-lane path lands (#223/#233). On a host with 64-lane waves nothing is lost. Merging #223/#233 first, or together, avoids it. If the console's quads are the host's, a quad read that needs no declared wave size (quadReadLaneAt) would also avoid it; I have not checked that.

Not measured: whether anything visible changes in the title (the world was not run).

AI use: the agent (Claude Code) built both trees, ran the translations and the comparison and wrote this at my request. The counts are from those runs. Counts, names and messages only; no game data.

**@⁠Pablo-Barros** on GitHub · 2026-11-24 10:48 UTC · [original](https://github.com/Marvisak/VIctory/pull/180#issuecomment-7129267300) **On a 32-lane host**, #180 `5ff639e` merged onto `main` `ffe310e` (clean merge), whole title (`translate --validate --pipelines --list`, dxil.dll 10.0.26100.0). Windows 11 26300, RTX 3070, driver 32.0.16.1088. Per program, with `victory compare` (#787); 25,953 programs in both, none in only one. | | `main` | `main` + #180 | |---|---|---| | compute: emitted / validated / pipelines | 1,441 / 1,417 / 1,121 | 1,745 / 1,745 / 1,412 | | vertex and pixel: emitted / validated / pipelines | 12,243 / 12,167 / 12,243 | 12,381 / 12,298 / 12,381 | | mesh: emitted / validated / pipelines | 8,214 / 8,152 / 8,214 | 8,301 / 8,235 / 8,301 | | pipelines gained / lost | | **528 / 12** | | validations gained / lost | | 542 / **0** | | pipelines from modules the validator refuses | 155 | 149 (11 of the 528 gained) | **Gains.** `a descriptor read only as data` → pipeline created: 355. `a scalar memory read as data` → pipeline created: 160. Nine more arrive through a signature mismatch the validator reports and the driver takes. No program that validates on `main` fails to now. **The 12 lost pipelines are on this host only, and here is why.** All 12 are compute programs that on `main` emit a module with an implicit-derivative sample: the validator refuses it, the driver creates the pipeline. With #180 the module validates, and the driver refuses it with `E_INVALIDARG`. The emitted `PSV0` says what changed: on `main` these 12 declare no wave size; with #180 they declare `WaveSize(64)`, which a 32-lane host does not run. On `main` the 320 compute modules that declare 64 are exactly the 320 refused on this card; with #180, 333 declare 64 and 333 are refused. The 13 added are these 12 and one program the translator refused before. So the 24 compute modules with the stage-incompatible sample, on this card: | on `main` | with #180 | programs | |---|---|---| | invalid, pipeline created | valid, `WaveSize(64)`, refused | **12** | | invalid, pipeline created | valid, pipeline created | 5 | | invalid, refused (already `WaveSize(64)`) | valid, refused | 7 | The 12: `CS_SkyMain_1d0e398e`, `CS_ApplyCombinedDeferred_1e5750b4`, `CS_ApplyCombinedDeferredAddFogMod_1e5750b4`, `CS_ApplyDiffusionInScattering_HeatHaze_4d282595`, `CS_IndirectApplyDiffusionInScattering_HeatHaze_c909c675`, `CS_DensityShadowBlur_V_12dd9302`, `CS_DensityShadowBlur_H_12dd9302`, `CS_DenoiseSpatialSeparableX_0e2554f4`, and `CS_EntityMask_BlurSynthesis_{4,6}Channels_41a5b9c1`, `CS_EntityMask_BlurSynthesis_DepthMask_{4,6}Channels_b9b2f7ac`. **What that means for merging.** On NVIDIA, #180 alone trades 12 running-but-invalid compute pipelines (sky, fog, shadow denoise, entity mask) for valid ones whose dispatches will be dropped, until a wave64-on-32-lane path lands (#223/#233). On a host with 64-lane waves nothing is lost. Merging #223/#233 first, or together, avoids it. If the console's quads are the host's, a quad read that needs no declared wave size (`quadReadLaneAt`) would also avoid it; I have not checked that. Not measured: whether anything visible changes in the title (the world was not run). AI use: the agent (Claude Code) built both trees, ran the translations and the comparison and wrote this at my request. The counts are from those runs. Counts, names and messages only; no game data.
Author
Owner

@⁠permadiego on GitHub · 2026-11-24 11:43 UTC · original

@⁠Pablo-Barros thanks, that was the cause. aa69258 drops the console-lane requirement for the quad gradients: the four lanes of a quad share a host wave of any size, so waveGetLaneIndex and waveReadLaneAt within the quad need no declared wave size. The 12 programs you listed (CS_SkyMain_1d0e398e, CS_ApplyCombinedDeferred*, CS_DensityShadowBlur_*, CS_DenoiseSpatialSeparableX_0e2554f4, CS_EntityMask_BlurSynthesis_*, the two HeatHaze ones) still validate. None of them declares WaveSize now (checked with dxc -dumpbin); on 5ff639e all 12 declared 64. Full shaders.rpf scan 5ff639e → aa69258: same validated set, 0 lost. cargo test -p victory-shader 57 passed, clippy clean. Not run on a 32-lane GPU here.

🤖 Generated with Claude Code

**@⁠permadiego** on GitHub · 2026-11-24 11:43 UTC · [original](https://github.com/Marvisak/VIctory/pull/180#issuecomment-7130466508) @⁠Pablo-Barros thanks, that was the cause. aa69258 drops the console-lane requirement for the quad gradients: the four lanes of a quad share a host wave of any size, so `waveGetLaneIndex` and `waveReadLaneAt` within the quad need no declared wave size. The 12 programs you listed (`CS_SkyMain_1d0e398e`, `CS_ApplyCombinedDeferred*`, `CS_DensityShadowBlur_*`, `CS_DenoiseSpatialSeparableX_0e2554f4`, `CS_EntityMask_BlurSynthesis_*`, the two HeatHaze ones) still validate. None of them declares `WaveSize` now (checked with `dxc -dumpbin`); on 5ff639e all 12 declared 64. Full `shaders.rpf` scan 5ff639e → aa69258: same validated set, 0 lost. `cargo test -p victory-shader` 57 passed, clippy clean. Not run on a 32-lane GPU here. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Author
Owner

@⁠h0useadv on GitHub · 2026-11-24 12:36 UTC · original

Offline coverage on main ffe310e (full retail shader pack, victory translate --validate, programs matched one by one): this PR alone +542 programs validate, 0 newly fail, compute 1,417 → 1,745. a descriptor read only as data 394 → 7, a scalar memory read as data 771 → 300. It stacks: with the lane-mask branch from #653 and #305 it's +1,193, 0 regressions, compute 1,417 → 1,846. Full table: #293

AI-assisted (Claude Code). Counts only, no game data.

**@⁠h0useadv** on GitHub · 2026-11-24 12:36 UTC · [original](https://github.com/Marvisak/VIctory/pull/180#issuecomment-7131683841) Offline coverage on `main` `ffe310e` (full retail shader pack, `victory translate --validate`, programs matched one by one): this PR alone **+542 programs validate, 0 newly fail**, compute 1,417 → 1,745. `a descriptor read only as data` 394 → 7, `a scalar memory read as data` 771 → 300. It stacks: with the lane-mask branch from #653 and #305 it's **+1,193, 0 regressions**, compute 1,417 → 1,846. Full table: https://git.gtahub.st/github/Marvisak--VIctory/issues/293 AI-assisted (Claude Code). Counts only, no game data.
Author
Owner

@⁠MichaelSmithAI on GitHub · 2026-11-24 12:48 UTC · original · edited 2026-11-24 12:54 UTC

Daniel tested the revised gradient lowering on exact aa69258 with a 32-lane RTX 4090 under Wine/vkd3d-proton 3.2. Microsoft DXV validated the emitted shader, which uses SampleGrad and carries no fixed WaveSize. One all-active 64×1×1 guest group returned 32 mip-0 values (9.0) and 32 mip-1 values (27.0). Every lane matched an independently compiled DXC explicit-gradient reference.

This verifies pipeline creation and mip selection for this synthetic Wave64 program on a 32-lane adapter. Execution of the twelve named title shaders and their contribution to the presented frame remain open. AI-assisted verification.

Follow-up on the wave-per-group integration: with the same source-built compute sample, Microsoft DXV rejected baseline bc02f96 for an operation incompatible with the compute stage. Porting just the compute-gradient change (0831e88) made it validate. On the same RTX 4090, both a 64×1 group and an 8×8 group matched the explicit-gradient DXC reference in all 64 lanes. In the 8×8 test, neighboring quads selected different mips. The Win64 shader suite reported 172 passes, one ignored test, and the previously observed Wine stub-pipeline failure. The 12 title programs still await a matched run on this integration.

**@⁠MichaelSmithAI** on GitHub · 2026-11-24 12:48 UTC · [original](https://github.com/Marvisak/VIctory/pull/180#issuecomment-7131954124) · edited 2026-11-24 12:54 UTC Daniel tested the revised gradient lowering on exact `aa69258` with a 32-lane RTX 4090 under Wine/vkd3d-proton 3.2. Microsoft DXV validated the emitted shader, which uses SampleGrad and carries no fixed WaveSize. One all-active 64×1×1 guest group returned 32 mip-0 values (9.0) and 32 mip-1 values (27.0). Every lane matched an independently compiled DXC explicit-gradient reference. This verifies pipeline creation and mip selection for this synthetic Wave64 program on a 32-lane adapter. Execution of the twelve named title shaders and their contribution to the presented frame remain open. AI-assisted verification. Follow-up on the wave-per-group integration: with the same source-built compute sample, Microsoft DXV rejected baseline `bc02f96` for an operation incompatible with the compute stage. Porting just the compute-gradient change (`0831e88`) made it validate. On the same RTX 4090, both a 64×1 group and an 8×8 group matched the explicit-gradient DXC reference in all 64 lanes. In the 8×8 test, neighboring quads selected different mips. The Win64 shader suite reported 172 passes, one ignored test, and the previously observed Wine stub-pipeline failure. The 12 title programs still await a matched run on this integration.
Author
Owner

@⁠KingKaom on GitHub · 2026-11-24 13:15 UTC · original

In-world effect of this PR (RDNA4 box, one run each side, diagnostics build + debug layer + DRED; our baseline is the four title-memory lifetime PRs (#431, #568, #67, #493) — this PR merged onto that stack cleanly, one file):

  • Unique shader hashes seen untranslated in-world: 536 → 448.
  • a descriptor read only as data vanishes from the in-world set entirely (95 → 0) and a scalar memory read as data halves (29 → 15). The lane-mask families grow a little (select-on-untracked 105 → 111, lane-mask-holding 92 → 95, lane-mask-read 16 → 31) — programs surviving the removed gates now stop at the next one, exactly as the coverage tables above predict.
  • Survival and endpoint unchanged: ~390 s → ~422 s in-world (single runs, suggestive), zero page faults either way, same terminal state: device removed after a submission of 32 lists with every breadcrumb done == count (the timeout endpoint, not a fault).
  • Frame cost unchanged: 0.3–1.8 fps in-world in both runs, dominated by ~9–10 GB/frame of title-copy refreshes.

So on our title set this converts 88 of the shaders currently dropping their world draws and closes the descriptor-gap family completely; what holds the world below 30 fps on this machine is the per-frame copy cost, not this PR's coverage.

We also ran the victory translate coverage check on #853's aabd9a7 against the same dump (baseline main ffe310e, 26,148 programs): it converts zero title programs as gated — details posted on #853.

AI-assisted Hermes Agent.

**@⁠KingKaom** on GitHub · 2026-11-24 13:15 UTC · [original](https://github.com/Marvisak/VIctory/pull/180#issuecomment-7132580735) **In-world effect of this PR** (RDNA4 box, one run each side, diagnostics build + debug layer + DRED; our baseline is the four title-memory lifetime PRs (#431, #568, #67, #493) — this PR merged onto that stack cleanly, one file): - Unique shader hashes seen untranslated in-world: **536 → 448**. - `a descriptor read only as data` vanishes from the in-world set entirely (**95 → 0**) and `a scalar memory read as data` halves (29 → 15). The lane-mask families grow a little (select-on-untracked 105 → 111, lane-mask-holding 92 → 95, lane-mask-read 16 → 31) — programs surviving the removed gates now stop at the next one, exactly as the coverage tables above predict. - Survival and endpoint unchanged: ~390 s → ~422 s in-world (single runs, suggestive), **zero page faults** either way, same terminal state: device removed after a submission of 32 lists with every breadcrumb done == count (the timeout endpoint, not a fault). - Frame cost unchanged: 0.3–1.8 fps in-world in both runs, dominated by ~9–10 GB/frame of title-copy refreshes. So on our title set this converts 88 of the shaders currently dropping their world draws and closes the descriptor-gap family completely; what holds the world below 30 fps on this machine is the per-frame copy cost, not this PR's coverage. We also ran the `victory translate` coverage check on #853's `aabd9a7` against the same dump (baseline `main` `ffe310e`, 26,148 programs): it converts zero title programs as gated — details posted on #853. AI-assisted Hermes Agent.
Author
Owner

@⁠bailu12300 on GitHub · 2026-11-24 14:18 UTC · original

Merging #180 with the waterfall/lane-mask fork (#728) — measured on RTX 5060

I merged your lower.rs (branch shader/compute-derivatives, base d2a4bae) with the community fork Wasler/VIctory:fix/shader-top5 (66252c0) which adds waterfall lane-mask handling (Source::Select / Fetched / Lanes / LanePhi, lane_heap_index, fetched_index).

Merge had three compatibility points, all mechanical:

  1. const LOOP_LIMIT had to become pub(super) const LOOP_LIMIT — emit/mod.rs re-exports it as DEFAULT_LOOP_LIMIT.
  2. Two heap_handle(...) calls in your file pass 4 args; the fork's shader.rs signature is heap_handle(cur, index, sampler, nonuniform, props) → added false (and per_lane for the Source::Loaded arm).
  3. The fork extends resource::Source with Select / Fetched / Lanes / LanePhi, so handle() needs those arms and the lane_heap_index / fetched_index helpers — took those verbatim from the fork.

Result (GTA6 Xbox v1.0.2.1, D3D12 Tier 2, #902 heap fix + #876 typeless fix also applied)

metric fork alone (#728) merged with #180
shader does not translate 369 279
remaining classes desc-as-data 156, structured 65, addr 38 … lane-mask 16, 64-bit image atomic, scalar mem read
title crash 0xc0000005 +0x23cf683 write 0x0 same address, same access
world lifetime ~3.5 min (7,396 draws / 1,502 steady) ~2m39s (2,793 draws)

So the descriptor-as-data family is gone (-90 pipelines), but the title-side null write is untouched. In this title it looks unrelated to shader coverage: it happens with 0 first-chance heap warnings and 0 device removals, right after a burst of host pipeline refused 0x80070057 shaders=[compute …] (118 of those, present identically in runs without #180 — 125 in the #902-only run).

Also tested: --console series-s does not change the descriptor request (count=1245184 either way), so the deficit isn't console-profile driven.

Happy to hand the merged lower.rs over as a patch if you want to fold the fork's lane-mask arms into the PR.

**@⁠bailu12300** on GitHub · 2026-11-24 14:18 UTC · [original](https://github.com/Marvisak/VIctory/pull/180#issuecomment-7134168147) ## Merging #180 with the waterfall/lane-mask fork (#728) — measured on RTX 5060 I merged your `lower.rs` (branch `shader/compute-derivatives`, base `d2a4bae`) with the community fork `Wasler/VIctory:fix/shader-top5` (`66252c0`) which adds waterfall lane-mask handling (`Source::Select / Fetched / Lanes / LanePhi`, `lane_heap_index`, `fetched_index`). Merge had three compatibility points, all mechanical: 1. `const LOOP_LIMIT` had to become `pub(super) const LOOP_LIMIT` — `emit/mod.rs` re-exports it as `DEFAULT_LOOP_LIMIT`. 2. Two `heap_handle(...)` calls in your file pass 4 args; the fork's `shader.rs` signature is `heap_handle(cur, index, sampler, nonuniform, props)` → added `false` (and `per_lane` for the `Source::Loaded` arm). 3. The fork extends `resource::Source` with `Select / Fetched / Lanes / LanePhi`, so `handle()` needs those arms and the `lane_heap_index` / `fetched_index` helpers — took those verbatim from the fork. ### Result (GTA6 Xbox v1.0.2.1, D3D12 Tier 2, `#902` heap fix + `#876` typeless fix also applied) | metric | fork alone (#728) | merged with #180 | |---|---|---| | `shader does not translate` | 369 | **279** | | remaining classes | desc-as-data 156, structured 65, addr 38 … | lane-mask 16, 64-bit image atomic, scalar mem read | | title crash | `0xc0000005 +0x23cf683 write 0x0` | **same address, same access** | | world lifetime | ~3.5 min (7,396 draws / 1,502 steady) | ~2m39s (2,793 draws) | So the descriptor-as-data family is gone (-90 pipelines), but the title-side null write is untouched. In this title it looks unrelated to shader coverage: it happens with 0 `first-chance` heap warnings and 0 device removals, right after a burst of `host pipeline refused 0x80070057 shaders=[compute …]` (118 of those, present identically in runs without #180 — 125 in the #902-only run). Also tested: `--console series-s` does **not** change the descriptor request (`count=1245184` either way), so the deficit isn't console-profile driven. Happy to hand the merged `lower.rs` over as a patch if you want to fold the fork's lane-mask arms into the PR.
Author
Owner

@⁠Yaekai on GitHub · 2026-11-24 16:36 UTC · original

Independent verification on Windows 11 + NVIDIA RTX 3070 (Rust 1.98.1) at head aa69258:

  • cargo test -p victory-shader --lib: 57 passed, 0 failed.
  • cargo clippy -p victory-shader -- -D warnings: 0 warnings.
  • Live GTA VI (1.0.2.1, --console series-s, 19-min world run): no regressions. Ready to merge once rebased on main!
**@⁠Yaekai** on GitHub · 2026-11-24 16:36 UTC · [original](https://github.com/Marvisak/VIctory/pull/180#issuecomment-7137941268) Independent verification on Windows 11 + NVIDIA RTX 3070 (Rust 1.98.1) at head `aa69258`: - `cargo test -p victory-shader --lib`: 57 passed, 0 failed. - `cargo clippy -p victory-shader -- -D warnings`: 0 warnings. - Live GTA VI (`1.0.2.1`, `--console series-s`, 19-min world run): no regressions. Ready to merge once rebased on `main`!
Author
Owner

@⁠jeremygold02 on GitHub · 2026-11-24 16:44 UTC · original

I compared 105 distinct compute shaders that VIctory refused in one RTX 5070 mission-loading trace after a fence-confirmed readback. I replayed the same local inputs on ffe310e, merging each PR cleanly onto that base. I used Windows SDK 10.0.26100.0 for DXIL validation.

Translator SDK-valid compute shaders out of 105
Main (ffe310e) 0
#1084 (48a41fb) 0
#180 (aa69258) 7
#1084 and #180 33

The last row includes all seven accepted by #180 alone. The other 26 previously stopped at the untracked-mask select. With #1084 and the descriptor-only change from #1130 in its own PR (98f073d), the same 33 emitted DXIL and all 33 failed SDK validation for a compute-stage incompatibility. In disassembly all 33 had an implicit sample call. With #1084 and #180, all 33 used sampleGrad, had no implicit sample call, and declared 32×1×1 groups and wave size 32.

On a physical RTX 5070 (driver 621.01), I also used the shader crate's host helper to create a compute pipeline for the smallest, median and largest of the 33 by input size. All three succeeded. The full pipeline batch exceeded its 180-second limit, so I only have individual driver results for those three. No command lists were submitted in this check. Rendered output, mission progression and frame timing remain untested on this combination. AI-assisted.

**@⁠jeremygold02** on GitHub · 2026-11-24 16:44 UTC · [original](https://github.com/Marvisak/VIctory/pull/180#issuecomment-7138132142) I compared 105 distinct compute shaders that VIctory refused in one RTX 5070 mission-loading trace after a fence-confirmed readback. I replayed the same local inputs on `ffe310e`, merging each PR cleanly onto that base. I used Windows SDK 10.0.26100.0 for DXIL validation. | Translator | SDK-valid compute shaders out of 105 | | --- | ---: | | Main (`ffe310e`) | 0 | | #1084 (`48a41fb`) | 0 | | #180 (`aa69258`) | 7 | | #1084 and #180 | 33 | The last row includes all seven accepted by #180 alone. The other 26 previously stopped at the untracked-mask select. With #1084 and the descriptor-only change from #1130 in its own PR (`98f073d`), the same 33 emitted DXIL and all 33 failed SDK validation for a compute-stage incompatibility. In disassembly all 33 had an implicit `sample` call. With #1084 and #180, all 33 used `sampleGrad`, had no implicit `sample` call, and declared 32×1×1 groups and wave size 32. On a physical RTX 5070 (driver 621.01), I also used the shader crate's host helper to create a compute pipeline for the smallest, median and largest of the 33 by input size. All three succeeded. The full pipeline batch exceeded its 180-second limit, so I only have individual driver results for those three. No command lists were submitted in this check. Rendered output, mission progression and frame timing remain untested on this combination. AI-assisted.
Author
Owner

@⁠Ctrl-Alt-Haze on GitHub · 2026-11-24 16:51 UTC · original

Independent verification on Windows 11, RTX 5070 Ti (driver 32.0.16.2135) + WARP, dxil.dll 1.8.2502.11, Rust 1.98.1:

  • aa69258 trial-merges cleanly onto upstream/main (ffe310eb).
  • On aa69258: cargo xtask policy (150 files ok), both clippy checks pass, cargo test --workspace --locked (227 passed, 0 failed, 3 ignored), victory-shader --features host (57 passed, 0 failed on RTX 5070 Ti & WARP), and victory-gpu --features diagnostics (40 passed, 0 failed on RTX 5070 Ti & WARP).
  • Note: compute_sample_grad_validates_and_builds_host_pipeline validates DXIL and builds the host compute PSO natively on RTX 5070 Ti and WARP, though it doesn't dispatch and read back sampled texels. Recommend rebasing onto ffe310eb.

AI-assisted verification on local RTX 5070 Ti + WARP; no game data.

**@⁠Ctrl-Alt-Haze** on GitHub · 2026-11-24 16:51 UTC · [original](https://github.com/Marvisak/VIctory/pull/180#issuecomment-7138306972) Independent verification on **Windows 11**, **RTX 5070 Ti** (driver `32.0.16.2135`) + **WARP**, **dxil.dll `1.8.2502.11`**, **Rust `1.98.1`**: - `aa69258` trial-merges cleanly onto `upstream/main` (`ffe310eb`). - On `aa69258`: `cargo xtask policy` (`150 files ok`), both `clippy` checks pass, `cargo test --workspace --locked` (**227 passed, 0 failed, 3 ignored**), `victory-shader --features host` (**57 passed, 0 failed** on RTX 5070 Ti & WARP), and `victory-gpu --features diagnostics` (**40 passed, 0 failed** on RTX 5070 Ti & WARP). - Note: `compute_sample_grad_validates_and_builds_host_pipeline` validates DXIL and builds the host compute PSO natively on RTX 5070 Ti and WARP, though it doesn't dispatch and read back sampled texels. Recommend rebasing onto `ffe310eb`. AI-assisted verification on local RTX 5070 Ti + WARP; no game data.
Author
Owner

@⁠KingKaom on GitHub · 2026-11-24 17:04 UTC · original

In-world addendum for the #1084 + #180 combination (RDNA4 host, diagnostics + debug-layer build; same title-memory lifetime stack as our earlier in-world measurement, both PRs merged onto it cleanly):

  • Unique shaders seen untranslated in-world: 536 (base stack) → 448 (this PR alone) → 334 (this PR + #1084). The a select on an untracked mask family is essentially gone from the in-world set; the lane-mask families remain, as the coverage tables predict.
  • The presented frame is still black in-world with both PRs: on captured in-world frames the scene is live in the title's 2560×1440 render targets while the backbuffer shows nothing but black — the present-chain break is not among the programs these two convert.
  • Frame cost and survival unchanged: ~1 fps in-world (host title-copy preparation still dominates the frame, ~600 ms prepared per frame), and the run ends at the same 28-list-submission timeout as the stack underneath (217 s and 468 s, one run each).

AI-assisted (Hermes Agent)

**@⁠KingKaom** on GitHub · 2026-11-24 17:04 UTC · [original](https://github.com/Marvisak/VIctory/pull/180#issuecomment-7138639562) **In-world addendum for the #1084 + #180 combination** (RDNA4 host, diagnostics + debug-layer build; same title-memory lifetime stack as [our earlier in-world measurement](https://git.gtahub.st/github/Marvisak--VIctory/issues/180), both PRs merged onto it cleanly): - Unique shaders seen untranslated in-world: 536 (base stack) → 448 (this PR alone) → **334 (this PR + #1084)**. The `a select on an untracked mask` family is essentially gone from the in-world set; the lane-mask families remain, as the coverage tables predict. - The presented frame is still black in-world with both PRs: on captured in-world frames the scene is live in the title's 2560×1440 render targets while the backbuffer shows nothing but black — the present-chain break is not among the programs these two convert. - Frame cost and survival unchanged: ~1 fps in-world (host title-copy preparation still dominates the frame, ~600 ms prepared per frame), and the run ends at the same 28-list-submission timeout as the stack underneath (217 s and 468 s, one run each). AI-assisted (Hermes Agent)
Author
Owner

@⁠rezioliver-collab on GitHub · 2026-11-24 20:19 UTC · original

I ran an offline A/B comparison of #1423 (55f0dc4) and #1423 + #180 (aa69258) on the same shaders.rpf.

94 of the 219 compute shaders passed DXIL validation. All 219 cleared a descriptor read only as data. The remaining 125 stopped during lowering at a lane-mask join of an untracked mask.

Across the full archive, validated shaders increased from 21,724 to 22,365 (+641), with zero validation losses. The gains were 427 compute, 129 pixel, 2 vertex, and 83 mesh shaders. The combined build also validated all five compute shaders that first emitted DXIL on #1423 and were rejected by the validator for stage incompatibility.

I ran victory translate --validate --list --jobs 1 twice on the combined build using Windows 11, Rust 1.98.1 MSVC, and dxil.dll 1.8.2502.11. I reused both #1423 runs after checking the archive, validator, and baseline executable SHA-256 hashes. The two combined runs produced byte-identical listings. I matched all 25,889 listed programs by archive offset and shader stage. The 219-program group consists of compute shaders that hit a lane mask holding lanes elsewhere read as data on ffe310e and then hit the descriptor error on #1423.

For the synthetic check, I ran the same twin-load fixture from #1130 in separate test worktrees and added an assertion against the same SDK validator. One load supplies the structured buffer view and the other supplies its record count. #1423 reproduced the descriptor error. With #180, the fixture lowered successfully and its DXIL validated. The combined shader library suite had 121 passes and one ignored test, and cargo xtask policy passed.

AI use : Assisted by GPT 6.2 Sol.

**@⁠rezioliver-collab** on GitHub · 2026-11-24 20:19 UTC · [original](https://github.com/Marvisak/VIctory/pull/180#issuecomment-7143366876) I ran an offline A/B comparison of #1423 (`55f0dc4`) and #1423 + #180 (`aa69258`) on the same `shaders.rpf`. **94 of the 219 compute shaders passed DXIL validation.** All 219 cleared `a descriptor read only as data`. The remaining **125** stopped during lowering at `a lane-mask join of an untracked mask`. Across the full archive, validated shaders increased from **21,724 to 22,365 (+641)**, with **zero validation losses**. The gains were 427 compute, 129 pixel, 2 vertex, and 83 mesh shaders. The combined build also validated all five compute shaders that first emitted DXIL on #1423 and were rejected by the validator for stage incompatibility. I ran `victory translate --validate --list --jobs 1` twice on the combined build using Windows 11, Rust 1.98.1 MSVC, and `dxil.dll` 1.8.2502.11. I reused both #1423 runs after checking the archive, validator, and baseline executable SHA-256 hashes. The two combined runs produced byte-identical listings. I matched all 25,889 listed programs by archive offset and shader stage. The 219-program group consists of compute shaders that hit `a lane mask holding lanes elsewhere read as data` on `ffe310e` and then hit the descriptor error on #1423. For the synthetic check, I ran the same twin-load fixture from #1130 in separate test worktrees and added an assertion against the same SDK validator. One load supplies the structured buffer view and the other supplies its record count. #1423 reproduced the descriptor error. With #180, the fixture lowered successfully and its DXIL validated. The combined shader library suite had 121 passes and one ignored test, and `cargo xtask policy` passed. AI use : Assisted by GPT 6.2 Sol.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!180
No description provided.