Shaders: s_buffer descriptor reads, signature/PSV0 fixes, gather4_l, a16 samples (+479 VS/PS, +200 mesh validated) #136

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

@⁠mpDom on GitHub · 2026-11-24 00:51 UTC · original
mpDom:pr/shader-sbuffer-psv0-gather4l → main · +307 −51 · 3 files · 2 commits · closed without merging

Raises the number of GTA VI shaders in shaders.rpf that translate and pass dxil.dll validation (translate --validate, all 26,503 containers):
vertex/pixel 12,690 -> 13,169 of 13,169 emitted (0 validator errors), mesh ~8,100 -> 8,302 of 8,506, compute 1,672 -> 1,717 validated (2,032 emitted).

  • s_buffer_load_dword* on a loaded descriptor read as data (descriptor_data), including structured buffers (scalar loads now use the view's stride, not a raw view): 726 -> 0 'a scalar memory read as data'.
  • Dead descriptor-dword phi edges no longer fail a join that also carries real data (700 -> 31, 187 -> 40).
  • ISG1/OSG1 rows are in register order, and PSV0 interpolation modes are taken from the container: 55 signature validator errors -> 0.
  • calculateLOD takes only the spatial coordinates (array slice undef).
  • image_gather4_l and image_gather4_l_o (explicit mip) via clamped textureLoad in gather order: 12 -> 0, unblocks the meshlet culling compute shaders (pipeline creation checked on the host adapter).
  • a16 biased/clamped/compare samples (separates 32-bit leading VGPRs from packed 16-bit coordinates) and centroid SV_Position for conservative depth outputs.

Tested: cargo test -p victory-shader -p xtask (0 failures).

**@⁠mpDom** on GitHub · 2026-11-24 00:51 UTC · [original](https://github.com/Marvisak/VIctory/pull/136) `mpDom:pr/shader-sbuffer-psv0-gather4l` → `main` · +307 −51 · 3 files · 2 commits · closed without merging Raises the number of GTA VI shaders in shaders.rpf that translate and pass dxil.dll validation (translate --validate, all 26,503 containers): vertex/pixel 12,690 -> 13,169 of 13,169 emitted (0 validator errors), mesh ~8,100 -> 8,302 of 8,506, compute 1,672 -> 1,717 validated (2,032 emitted). - s_buffer_load_dword* on a loaded descriptor read as data (descriptor_data), including structured buffers (scalar loads now use the view's stride, not a raw view): 726 -> 0 'a scalar memory read as data'. - Dead descriptor-dword phi edges no longer fail a join that also carries real data (700 -> 31, 187 -> 40). - ISG1/OSG1 rows are in register order, and PSV0 interpolation modes are taken from the container: 55 signature validator errors -> 0. - calculateLOD takes only the spatial coordinates (array slice undef). - image_gather4_l and image_gather4_l_o (explicit mip) via clamped textureLoad in gather order: 12 -> 0, unblocks the meshlet culling compute shaders (pipeline creation checked on the host adapter). - a16 biased/clamped/compare samples (separates 32-bit leading VGPRs from packed 16-bit coordinates) and centroid SV_Position for conservative depth outputs. Tested: cargo test -p victory-shader -p xtask (0 failures).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:51:43 +00:00
github-bot closed this pull request 2026-11-26 03:51:43 +00:00
Author
Owner

@⁠DaviTostes on GitHub · 2026-11-24 00:53 UTC · original

Tested 8ae232f on Arch Linux x86_64, rustc 1.98.1: cargo test -p victory-shader: 51 passed, 0 failed (2 test binaries). The full workspace still needs #112 for the victory-gpu E0425.

  • The diff adds no test, and the title bundles several independent changes (s_buffer descriptor/structured loads, dead descriptor phis, PSV0/ISG1, calculateLOD, image_gather4_l). A regression in one of them would not show in this run; small fixtures per feature (or splitting the PR) would make review and bisecting much easier.
  • No conflict seen with the current victory-shader tests; the new paths are simply unexercised here.

No game data used. AI-assisted (DeepSeek V4.1 Flash coding agent).

**@⁠DaviTostes** on GitHub · 2026-11-24 00:53 UTC · [original](https://github.com/Marvisak/VIctory/pull/136#issuecomment-7118548759) Tested `8ae232f` on **Arch Linux x86_64, rustc 1.98.1**: **`cargo test -p victory-shader`: 51 passed, 0 failed** (2 test binaries). The full workspace still needs #112 for the `victory-gpu` E0425. - The diff adds no test, and the title bundles several independent changes (s_buffer descriptor/structured loads, dead descriptor phis, PSV0/ISG1, `calculateLOD`, `image_gather4_l`). A regression in one of them would not show in this run; small fixtures per feature (or splitting the PR) would make review and bisecting much easier. - No conflict seen with the current `victory-shader` tests; the new paths are simply unexercised here. No game data used. AI-assisted (DeepSeek V4.1 Flash coding agent).
Author
Owner

@⁠HenriqueSBueno on GitHub · 2026-11-24 01:05 UTC · original

Tested on NVIDIA. This PR turns the menus black here. Windows 11, RTX 3080 (10 GB, driver 616.92), i5-10400F, 32 GB RAM, retail title, diagnostics build, no pad input.

  • main at 9aef3d9: the first-boot screens and the account prompt render. Captured frames ~1200–2400 are real images.
  • main at 9aef3d9 + this PR (8ae232f), same run: every captured frame is black (0,0,0), and there is no audio.
  • The log difference: with this PR, several compute pipelines fail to be created during boot with E_OUTOFMEMORY. The driver is out of memory compiling them; it isn't host memory, since the process sits far below the limit there. main has none of these:
WARN victory_gpu::pipeline::host: host pipeline refused error=E_OUTOFMEMORY (0x8007000E) shaders=[compute 1c8165626a581de4]
WARN victory_gpu::pipeline::host: host pipeline refused error=E_OUTOFMEMORY (0x8007000E) shaders=[compute d240837d597ce9d1]
WARN victory_gpu::pipeline::host: host pipeline refused error=E_OUTOFMEMORY (0x8007000E) shaders=[compute 738350c1a01b713a]
...

Counts in the same ~110 s run: E_OUTOFMEMORY refusals 0 on main, 11 with this PR. E_INVALIDARG refusals are 3 in both runs.

Bisect, 110 s each: main renders. main + #135 + #136 + #40 is black. main + #136 alone is black. Happy to rerun a newer head on this card.

AI-assisted (Claude Code)

**@⁠HenriqueSBueno** on GitHub · 2026-11-24 01:05 UTC · [original](https://github.com/Marvisak/VIctory/pull/136#issuecomment-7118743938) Tested on NVIDIA. This PR turns the menus black here. Windows 11, RTX 3080 (10 GB, driver 616.92), i5-10400F, 32 GB RAM, retail title, diagnostics build, no pad input. - `main` at 9aef3d9: the first-boot screens and the account prompt render. Captured frames ~1200–2400 are real images. - `main` at 9aef3d9 + this PR (8ae232f), same run: every captured frame is black (0,0,0), and there is no audio. - The log difference: with this PR, several compute pipelines fail to be created during boot with `E_OUTOFMEMORY`. The driver is out of memory compiling them; it isn't host memory, since the process sits far below the limit there. `main` has none of these: ``` WARN victory_gpu::pipeline::host: host pipeline refused error=E_OUTOFMEMORY (0x8007000E) shaders=[compute 1c8165626a581de4] WARN victory_gpu::pipeline::host: host pipeline refused error=E_OUTOFMEMORY (0x8007000E) shaders=[compute d240837d597ce9d1] WARN victory_gpu::pipeline::host: host pipeline refused error=E_OUTOFMEMORY (0x8007000E) shaders=[compute 738350c1a01b713a] ... ``` Counts in the same ~110 s run: `E_OUTOFMEMORY` refusals 0 on `main`, 11 with this PR. `E_INVALIDARG` refusals are 3 in both runs. Bisect, 110 s each: `main` renders. `main` + #135 + #136 + #40 is black. `main` + #136 alone is black. Happy to rerun a newer head on this card. AI-assisted (Claude Code)
Author
Owner

@⁠Sunkiller-qc on GitHub · 2026-11-24 01:05 UTC · original

The a16 sampling part here (full-dword offset/bias/compare, packed coordinates, _cl clamp, lower.rs:5324 and :5559) is almost line for line the same as #73 (lower.rs:5233 and :5461 there), and the two PRs conflict. #138 is also stacked on #73. Would you consider rebasing this on #73, or dropping that part, so only one version lands? The other changes (s_buffer descriptor reads, ISG1/OSG1/PSV0, gather4_l) don't overlap.

Static review, not built or run.

**@⁠Sunkiller-qc** on GitHub · 2026-11-24 01:05 UTC · [original](https://github.com/Marvisak/VIctory/pull/136#issuecomment-7118749703) The a16 sampling part here (full-dword offset/bias/compare, packed coordinates, `_cl` clamp, `lower.rs:5324` and `:5559`) is almost line for line the same as #73 (`lower.rs:5233` and `:5461` there), and the two PRs conflict. #138 is also stacked on #73. Would you consider rebasing this on #73, or dropping that part, so only one version lands? The other changes (s_buffer descriptor reads, ISG1/OSG1/PSV0, gather4_l) don't overlap. Static review, not built or run.
Author
Owner

@⁠ifBars on GitHub · 2026-11-24 01:16 UTC · original

I tested the three scalar-buffer hunks from 8ae232f on Windows 10 with Microsoft's DXIL validator and a native D3D12 device (RTX 3060 Ti, driver 610.88). The input was a private sample of 50 previously rejected shaders from first-story loading. Baseline was 9 validated programs and 9 host pipelines. With just the scalar load and descriptor changes it was 13 validated and 13 pipelines. The four additions were vertex shaders. All nine baseline successes remained.

This measurement isolates the scalar changes from the sampling, gather and signature changes. It covers pipeline creation; it does not measure output pixels.

**@⁠ifBars** on GitHub · 2026-11-24 01:16 UTC · [original](https://github.com/Marvisak/VIctory/pull/136#issuecomment-7118934205) I tested the three scalar-buffer hunks from 8ae232f on Windows 10 with Microsoft's DXIL validator and a native D3D12 device (RTX 3060 Ti, driver 610.88). The input was a private sample of 50 previously rejected shaders from first-story loading. Baseline was 9 validated programs and 9 host pipelines. With just the scalar load and descriptor changes it was 13 validated and 13 pipelines. The four additions were vertex shaders. All nine baseline successes remained. This measurement isolates the scalar changes from the sampling, gather and signature changes. It covers pipeline creation; it does not measure output pixels.
Author
Owner

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

A follow-up title test found a startup regression worth isolating. With the three scalar-buffer hunks together, four shaders gained pipelines but the returning-profile Player screen rendered uniformly black. Keeping the descriptor reconstruction hunks while restoring the ordinary scalar SRV load path kept all four vertex pipeline gains. On that build the Player capture matched the known-good reference pixel for pixel, and the original movie and the first two story cards rendered. One run per configuration, with cold host pipeline libraries.

**@⁠ifBars** on GitHub · 2026-11-24 01:24 UTC · [original](https://github.com/Marvisak/VIctory/pull/136#issuecomment-7119069779) A follow-up title test found a startup regression worth isolating. With the three scalar-buffer hunks together, four shaders gained pipelines but the returning-profile Player screen rendered uniformly black. Keeping the descriptor reconstruction hunks while restoring the ordinary scalar SRV load path kept all four vertex pipeline gains. On that build the Player capture matched the known-good reference pixel for pixel, and the original movie and the first two story cards rendered. One run per configuration, with cold host pipeline libraries.
Author
Owner

@⁠Sunkiller-qc on GitHub · 2026-11-24 01:29 UTC · original

Follow-up to my earlier note: I suggested rebasing the a16 part on #73, but both versions read an a16 LOD bias as a full f32 dword (lower.rs:5660-5661 here). With a16 it's an f16 in the low half of its dword, and the high half is undefined (LLVM lowerImage, D111754). #160 handles it that way. So whichever version lands should convert the low half (legacyF16ToF32) instead of as_float on the dword.

Static review, not built or run.

**@⁠Sunkiller-qc** on GitHub · 2026-11-24 01:29 UTC · [original](https://github.com/Marvisak/VIctory/pull/136#issuecomment-7119151151) Follow-up to my earlier note: I suggested rebasing the a16 part on #73, but both versions read an a16 LOD bias as a full f32 dword (`lower.rs:5660-5661` here). With `a16` it's an f16 in the low half of its dword, and the high half is undefined (LLVM `lowerImage`, D111754). #160 handles it that way. So whichever version lands should convert the low half (`legacyF16ToF32`) instead of `as_float` on the dword. Static review, not built or run.
Author
Owner

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

I tested the explicit-mip gather change on seven meshlet_culling:CS_BatchCull* compute shaders from a world-loading run. This was an offline A/B on Windows with an RTX 3080 Ti (617.14), using the 10.0.26100 DXIL validator and D3D12 compute pipeline creation.

Before adding this PR to my integration branch, all four shaders using image_gather4_l stopped at that instruction. With the change, all four validated and created pipelines: the three CS_BatchCullPreSkinnedMeshlets variants and CS_BatchCullBatchCSMeshlets. The three other batch-cull variants still stop at a hardware SGPR input in both builds.

Both builds include the local integration of #180. I kept the pre-PR ordinary scalar SRV read path in the second build given the Player-screen report above. This result covers translation and pipeline creation. I did not run a frame or compare gather output pixels.

The complete 311-shader replay has now finished. Adding this integration to the #180 build raised the count passing both checks from 53 to 65. In addition to the four gathers, eight shaders previously stopped at a scalar memory read as data passed, including a CS_PedStandardSkinning variant. All 53 previous successes still passed.

**@⁠Raxstreams** on GitHub · 2026-11-24 01:26 UTC · [original](https://github.com/Marvisak/VIctory/pull/136#issuecomment-7119105714) · edited 2026-11-24 01:31 UTC I tested the explicit-mip gather change on seven `meshlet_culling:CS_BatchCull*` compute shaders from a world-loading run. This was an offline A/B on Windows with an RTX 3080 Ti (617.14), using the 10.0.26100 DXIL validator and D3D12 compute pipeline creation. Before adding this PR to my integration branch, all four shaders using `image_gather4_l` stopped at that instruction. With the change, all four validated and created pipelines: the three `CS_BatchCullPreSkinnedMeshlets` variants and `CS_BatchCullBatchCSMeshlets`. The three other batch-cull variants still stop at `a hardware SGPR input` in both builds. Both builds include the local integration of #180. I kept the pre-PR ordinary scalar SRV read path in the second build given the Player-screen report above. This result covers translation and pipeline creation. I did not run a frame or compare gather output pixels. The complete 311-shader replay has now finished. Adding this integration to the #180 build raised the count passing both checks from 53 to 65. In addition to the four gathers, eight shaders previously stopped at `a scalar memory read as data` passed, including a `CS_PedStandardSkinning` variant. All 53 previous successes still passed.
Author
Owner

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

A note on the a16 samples in this PR, from comparing with #160 (same family): the bias dword is read here as a full f32 (addr_dword, with the comment that offset, bias and z-compare are always 32-bit). For the bias that does not hold with a16. LLVM's SITargetLowering::lowerImage:

// Special handling of bias when A16 is on. Bias is of type half but
// occupies full 32-bit.
SDValue Bias = DAG.getBuildVector(
    MVT::v2f16, DL,
    {Op.getOperand(ArgOffset + I), DAG.getPOISON(MVT::f16)});

The bias keeps its own dword but is an f16 in the low half; offset and comparison reference are 32-bit as the comment says. Read as an f32, an f16 bias is a denormal near zero, so a biased a16 sample would silently lose its bias.

Also, in case it applies here: on GFX10.3 a16 packs the coordinates and the level but not the derivatives (only _g16 opcodes have 16-bit derivatives); LLVM's gfx10_asm_mimg.s has image_sample_d ... 2D a16 with five address dwords. The decoder on main counts them packed, which I fixed in #160.

From the sources only, not run on hardware. No game data used.

**@⁠r4tedx** on GitHub · 2026-11-24 01:43 UTC · [original](https://github.com/Marvisak/VIctory/pull/136#issuecomment-7119383794) A note on the a16 samples in this PR, from comparing with #160 (same family): the bias dword is read here as a full f32 (`addr_dword`, with the comment that offset, bias and z-compare are always 32-bit). For the bias that does not hold with a16. LLVM's `SITargetLowering::lowerImage`: ```cpp // Special handling of bias when A16 is on. Bias is of type half but // occupies full 32-bit. SDValue Bias = DAG.getBuildVector( MVT::v2f16, DL, {Op.getOperand(ArgOffset + I), DAG.getPOISON(MVT::f16)}); ``` The bias keeps its own dword but is an f16 in the low half; offset and comparison reference are 32-bit as the comment says. Read as an f32, an f16 bias is a denormal near zero, so a biased a16 sample would silently lose its bias. Also, in case it applies here: on GFX10.3 a16 packs the coordinates and the level but not the derivatives (only `_g16` opcodes have 16-bit derivatives); LLVM's `gfx10_asm_mimg.s` has `image_sample_d ... 2D a16` with five address dwords. The decoder on `main` counts them packed, which I fixed in #160. From the sources only, not run on hardware. No game data used.
Author
Owner

@⁠r4tedx on GitHub · 2026-11-24 03:08 UTC · original

Two more review notes on this PR (besides the a16 bias above), both about results that can change without a refusal:

  1. image_gather4_l as four textureLoads. The emulation clamps the texel coordinates to the edge and never uses the sampler, so a gather through a wrap, mirror or border sampler reads different texels at the edges than the console does. For level 0 a real textureGather keeps the sampler's address mode (#160 does that and refuses other levels); the emulation is only needed for levels other than 0, and there it could apply the address mode from the sampler state, or refuse samplers that are not clamp.

  2. fill_phis. A phi edge that is Missing("a descriptor's address or format read as data" | "a descriptor read only as data") now becomes i32(0) whenever another edge carries data. Nothing checks that the value is dead on the path that takes the edge, so a program that does use it there gets 0 instead of a refusal.

The s_buffer descriptor-read fix (the part behind the 726 to 0 count, and the a scalar memory read as data row of #293) looks like the piece testers need most. Would you consider splitting it into its own PR, so it can go in without the two points above?

From reading the diff only; I have no copy of the title.

**@⁠r4tedx** on GitHub · 2026-11-24 03:08 UTC · [original](https://github.com/Marvisak/VIctory/pull/136#issuecomment-7120816858) Two more review notes on this PR (besides the a16 bias above), both about results that can change without a refusal: 1. **`image_gather4_l` as four `textureLoad`s.** The emulation clamps the texel coordinates to the edge and never uses the sampler, so a gather through a wrap, mirror or border sampler reads different texels at the edges than the console does. For level 0 a real `textureGather` keeps the sampler's address mode (#160 does that and refuses other levels); the emulation is only needed for levels other than 0, and there it could apply the address mode from the sampler state, or refuse samplers that are not clamp. 2. **`fill_phis`.** A phi edge that is `Missing("a descriptor's address or format read as data" | "a descriptor read only as data")` now becomes `i32(0)` whenever another edge carries data. Nothing checks that the value is dead on the path that takes the edge, so a program that does use it there gets 0 instead of a refusal. The s_buffer descriptor-read fix (the part behind the 726 to 0 count, and the `a scalar memory read as data` row of #293) looks like the piece testers need most. Would you consider splitting it into its own PR, so it can go in without the two points above? From reading the diff only; I have no copy of the title.
Author
Owner

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

Ran the full corpus (26,084 programs) and the game on an NVIDIA RTX 3060 12 GB

  • a scalar memory read as data: 573 -> 0. Emitted +41 VS/PS, +11 CS, +29 MS. 80 of the 81 validate, 80 create host pipelines (one invalid module, one wave64 compute the host refuses, as on main).
  • It moves programs rather than closing them: a descriptor's address or format read as data 71 -> 547.
  • The full PR black-screens with 31 E_OUTOFMEMORY refusals (21 compute, 10 mesh).
    • The regression is in the scalar-path/a16 half: dropping the scalar SRV path change makes the game render into the intro with no pipeline refusals.
    • Descriptor hunks alone fail the same 3,652 programs as with that change, so dropping it loses none of the gains.
**@⁠MichailiK** on GitHub · 2026-11-24 03:43 UTC · [original](https://github.com/Marvisak/VIctory/pull/136#issuecomment-7121365734) Ran the full corpus (26,084 programs) and the game on an NVIDIA RTX 3060 12 GB - `a scalar memory read as data`: 573 -> 0. Emitted +41 VS/PS, +11 CS, +29 MS. 80 of the 81 validate, 80 create host pipelines (one invalid module, one wave64 compute the host refuses, as on main). - It moves programs rather than closing them: `a descriptor's address or format read as data` 71 -> 547. - The full PR black-screens with 31 `E_OUTOFMEMORY` refusals (21 compute, 10 mesh). - The regression is in the scalar-path/a16 half: dropping the scalar SRV path change makes the game render into the intro with no pipeline refusals. - Descriptor hunks alone fail the same 3,652 programs as with that change, so dropping it loses none of the gains.
Author
Owner

@⁠claude-GTA6 on GitHub · 2026-11-24 06:01 UTC · original

From a tester working with Claude (AI-assisted); measured on my own machine.

Heads-up from an RTX 5090 (driver 621.24, Windows 11 26200): #136 alone turns every first-boot and loading screen black. #437 fixes it, so the two should probably land together, or #437 first.

How I found it: I bisected with a diag build, capturing presented frame 256 (the start screen), no input:

build frame 256
d2a4bae + #305 + #177 + #197 start screen
+ #136 first commit (d112889, a16 samples) start screen
+ #136 second commit (8ae232f) black (presented frame is all zeros)
+ #136 + #437 (also with about 30 other open PRs merged, mostly shader ones) start screen

Within 8ae232f, it isn't the PSV0 interpolation modes or the signature sort order (both reverted, still black). It's in the lower.rs part. Given #437's title ("keep scalar byte-offset loads compatible with raw buffer views"), I'd guess it's the raw-to-structured switch for scalar/buffer loads when a stride is declared.

Same effect on the loading screen: its art is drawn into a colour target, but the pass that copies it into the sRGB target outputs nothing. With #437 the art shows again.

Validated counts over the whole package don't show it: #136 is +651 validated, but those shaders draw the wrong thing.

**@⁠claude-GTA6** on GitHub · 2026-11-24 06:01 UTC · [original](https://github.com/Marvisak/VIctory/pull/136#issuecomment-7123501123) *From a tester working with Claude (AI-assisted); measured on my own machine.* Heads-up from an RTX 5090 (driver 621.24, Windows 11 26200): **#136 alone turns every first-boot and loading screen black**. **#437 fixes it**, so the two should probably land together, or #437 first. **How I found it:** I bisected with a diag build, capturing presented frame 256 (the start screen), no input: | build | frame 256 | |---|---| | `d2a4bae` + #305 + #177 + #197 | start screen | | + #136 first commit (`d112889`, a16 samples) | start screen | | + #136 second commit (`8ae232f`) | **black** (presented frame is all zeros) | | + #136 + #437 (also with about 30 other open PRs merged, mostly shader ones) | start screen | Within `8ae232f`, it isn't the PSV0 interpolation modes or the signature sort order (both reverted, still black). It's in the `lower.rs` part. Given #437's title ("keep scalar byte-offset loads compatible with raw buffer views"), I'd guess it's the raw-to-structured switch for scalar/buffer loads when a stride is declared. Same effect on the loading screen: its art is drawn into a colour target, but the pass that copies it into the sRGB target outputs nothing. With #437 the art shows again. Validated counts over the whole package don't show it: #136 is +651 validated, but those shaders draw the wrong thing.
Author
Owner

@⁠jeremygold02 on GitHub · 2026-11-24 06:56 UTC · original

Verified the scalar structured-SRV path on two vertex shaders at 8ae232f1d7 on Windows 11. Both fail on the same scalar descriptor-data read on the PR merge base (9aef3d9) and on my mission build. Both emit DXIL and pass Windows SDK 10.0.26100.0 validation with this PR.

I checked the descriptor actually supplied by the title at draw entry, before the missing host PSO rejects the draw. Across the two shaders the observer recorded 14 and 11 distinct declarations for the relevant table slot. All were buffer SRVs with DXGI_FORMAT_UNKNOWN, the RAW flag clear and StructureByteStride=80; element counts ranged from 10 to 256 overall. Each original shader also has a singleton structured-SRV declaration covering that register. This verifies the shape of this slot for these observations.

In both validated outputs the count comes from GetDimensions on StructuredBuffer<stride=80>. The scalar load uses (record_count - 1) * 80 as its byte address and splits it into the record index and the offset within that record. All 21 scalar dword loads on that table expression in each shader use the same stride.

I exercised the changed lowering separately on a physical RTX 5070 with a one-thread synthetic shader and three 80-byte records. It reported 3 records. With a matching guard, reads at bytes 160 and 164 returned the two expected third-record words; with a mismatched guard, both initialized output words remained intact. The adjacent sentinels stayed intact and both fences completed with the device reporting S_OK.

The two guest vertex shaders were checked through SDK validation. Their graphics PSOs, actual draws, and effect on the mission picture remain unverified.

**@⁠jeremygold02** on GitHub · 2026-11-24 06:56 UTC · [original](https://github.com/Marvisak/VIctory/pull/136#issuecomment-7124448780) Verified the scalar structured-SRV path on two vertex shaders at `8ae232f1d7` on Windows 11. Both fail on the same scalar descriptor-data read on the PR merge base (`9aef3d9`) and on my mission build. Both emit DXIL and pass Windows SDK 10.0.26100.0 validation with this PR. I checked the descriptor actually supplied by the title at draw entry, before the missing host PSO rejects the draw. Across the two shaders the observer recorded 14 and 11 distinct declarations for the relevant table slot. All were buffer SRVs with `DXGI_FORMAT_UNKNOWN`, the RAW flag clear and `StructureByteStride=80`; element counts ranged from 10 to 256 overall. Each original shader also has a singleton structured-SRV declaration covering that register. This verifies the shape of this slot for these observations. In both validated outputs the count comes from `GetDimensions` on `StructuredBuffer<stride=80>`. The scalar load uses `(record_count - 1) * 80` as its byte address and splits it into the record index and the offset within that record. All 21 scalar dword loads on that table expression in each shader use the same stride. I exercised the changed lowering separately on a physical RTX 5070 with a one-thread synthetic shader and three 80-byte records. It reported 3 records. With a matching guard, reads at bytes 160 and 164 returned the two expected third-record words; with a mismatched guard, both initialized output words remained intact. The adjacent sentinels stayed intact and both fences completed with the device reporting `S_OK`. The two guest vertex shaders were checked through SDK validation. Their graphics PSOs, actual draws, and effect on the mission picture remain unverified.
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,119 (−614) 40 0 152
main + this PR + #180 3,080 (−653) 1 0 53 (mesh only)
  • It does what it claims: "scalar memory read as data" goes to 0, nothing newly fails, and no module that validated on main is rejected.
  • The rejections include 76 newly emitted compute modules with "incompatible with the shader stage". Those are the implicit-derivative dx.valver case that #306 fixes.
  • With #180: the two PRs collide in two regions of descriptor_data in lower.rs. Resolved by hand, the union is strictly better than either one alone: +39 programs over this PR, and every vertex/pixel and compute module that emits validates. The resolution (~40 lines) is on a branch you're welcome to take: https://github.com/iurysf/VIctory/commits/union-136-180 (merge commit df69a52). I'm not opening a PR for it, since it's your and #180's work.
  • Against the clean-merging stack from #201 (#306, #592, #309, #571, #573, #576, #585), this PR conflicts in 9 regions of lower.rs and 2 of mod.rs. Part of that is because it repeats #306's a16/centroid/ISG1/PSV0 fixes, so dropping those here would shrink the conflict.
  • Next bottleneck: this PR pushes +197 programs into "lane mask read as data".

AI-assisted.

**@⁠iurysf** on GitHub · 2026-11-24 07:21 UTC · [original](https://github.com/Marvisak/VIctory/pull/136#issuecomment-7124900747) 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,119 (−614) | 40 | **0** | 152 | | main + this PR + #180 | **3,080 (−653)** | 1 | 0 | **53** (mesh only) | - It does what it claims: "scalar memory read as data" goes to 0, nothing newly fails, and no module that validated on main is rejected. - The rejections include 76 newly emitted compute modules with "incompatible with the shader stage". Those are the implicit-derivative `dx.valver` case that #306 fixes. - **With #180:** the two PRs collide in two regions of `descriptor_data` in `lower.rs`. Resolved by hand, the union is strictly better than either one alone: +39 programs over this PR, and every vertex/pixel and compute module that emits validates. The resolution (~40 lines) is on a branch you're welcome to take: https://github.com/iurysf/VIctory/commits/union-136-180 (merge commit `df69a52`). I'm not opening a PR for it, since it's your and #180's work. - **Against the clean-merging stack from #201** (#306, #592, #309, #571, #573, #576, #585), this PR conflicts in 9 regions of `lower.rs` and 2 of `mod.rs`. Part of that is because it repeats #306's a16/centroid/ISG1/PSV0 fixes, so dropping those here would shrink the conflict. - Next bottleneck: this PR pushes +197 programs into "lane mask read as data". AI-assisted.
Author
Owner

@⁠slint6614-dev on GitHub · 2026-11-24 07:32 UTC · original

Measured on the full retail shader pack (26,503 containers) with victory translate --validate, against main d2a4bae (emitted / validated):

VS/PS CS MS cargo test -p victory-shader
main 12272 / 12172 1693 / 1670 8191 / 8129 ok
#694 12272 / 12172 1705 / 1682 8191 / 8129 ok
#563 12297 / 12197 1693 / 1670 8191 / 8129 ok
#160 12345 / 12237 1705 / 1682 8191 / 8129 ok
#136 12619 / 12619 1796 / 1697 8355 / 8302 ok
  • image_gather4_l (12 refusals, all compute): cleared by #694, #160 and #136; the 12 programs then validate.
  • image_sample_d_cl (27 refusals): cleared by #694, #563 and #160, but only #563 (cube gradients) turns 25 of them into validated pixel programs; with #694 they stop on another reason.
  • #160 also clears the 108 biased 16-bit samples, but adds 8 "Program Input Signature does not match" validator failures (21 → 29).
  • #136 gains the most (+447 VS/PS, +27 CS, +173 MS validated), but the compute "operation incompatible with the shader stage" validator failure goes from 23 to 99: of its 103 newly emitted compute programs, 76 fail validation.

Windows 11, dxil.dll from SDK 10.0.26100.

**@⁠slint6614-dev** on GitHub · 2026-11-24 07:32 UTC · [original](https://github.com/Marvisak/VIctory/pull/136#issuecomment-7125100086) Measured on the full retail shader pack (26,503 containers) with `victory translate --validate`, against main d2a4bae (emitted / validated): | | VS/PS | CS | MS | `cargo test -p victory-shader` | |---|---|---|---|---| | main | 12272 / 12172 | 1693 / 1670 | 8191 / 8129 | ok | | #694 | 12272 / 12172 | 1705 / 1682 | 8191 / 8129 | ok | | #563 | 12297 / 12197 | 1693 / 1670 | 8191 / 8129 | ok | | #160 | 12345 / 12237 | 1705 / 1682 | 8191 / 8129 | ok | | #136 | 12619 / 12619 | 1796 / 1697 | 8355 / 8302 | ok | - `image_gather4_l` (12 refusals, all compute): cleared by #694, #160 and #136; the 12 programs then validate. - `image_sample_d_cl` (27 refusals): cleared by #694, #563 and #160, but only #563 (cube gradients) turns 25 of them into validated pixel programs; with #694 they stop on another reason. - #160 also clears the 108 biased 16-bit samples, but adds 8 "Program Input Signature does not match" validator failures (21 → 29). - #136 gains the most (+447 VS/PS, +27 CS, +173 MS validated), but the compute "operation incompatible with the shader stage" validator failure goes from 23 to 99: of its 103 newly emitted compute programs, 76 fail validation. Windows 11, dxil.dll from SDK 10.0.26100.

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!136
No description provided.