Shaders: hidden descriptor words joined with data are an undefined path (+494 programs, stacked on #1402) #1597

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

@⁠sinan-cmyk on GitHub · 2026-11-24 19:40 UTC · original
sinan-cmyk:shader-hidden-descriptor-join → main · +2190 −158 · 10 files · 35 commits · closed without merging

Stacked on #1402. Until #1402 lands, the diff here shows #1402 too. The change itself is the last commit, 2d2a697: one file, emit/lower.rs, +93 lines including 2 tests.

Summary: This PR handles the 772 programs that reach "a descriptor's address or format read as data" through a join with data. On a retail dump it gains 435 programs on top of #1402 and loses none. With #1402, that failure is the largest one: 809 programs (measurement).

What the 809 programs do

I instrumented the translator on all 809 programs and recorded the first instruction that consumes the missing dword:

First consumer Programs
a phi (a join) 772
an SGPR spill (v_writelane_b32) 36
v_mov_b32 1

At those joins, another reachable edge brings real data (s_buffer_load results, for example), and the code after the join uses the value as a number (s_and_b32, s_cmp_*, s_lshl_b32, s_bfe_u32). The descriptor's registers are simply reused on one path. In a traced example, the read sits behind a branch that is taken only when the value came over the data edge.

Change

descriptor_data marks the dwords that no HLSL program can read as hidden. GetDimensions reads an image's sizes and levels (dwords 1–4), a buffer's record count (dword 2) and a structured buffer's stride (dword 1). It never reads these dwords:

  • addresses: image dword 0, buffer dwords 0 and 1, except the stride bits of a structured buffer
  • formats: buffer dword 3
  • an image's array pitch and meta data: dwords 5–7

At a join where a reachable edge brings data, a hidden dword on another edge is a register that a path left undefined. fill_phis takes 0 for it, which is the existing treatment of an unread join. What stays refused:

  • a hidden dword read directly, not through a join
  • a join of descriptor dwords only, with no data edge
  • the 36 spill cases

The assumption to review (marked shortcut: in the code): a program that really reads such a dword on that path now gets 0. Plain HLSL cannot express such a read, so the console compiler can only produce it for a value that is undefined in the source. If an Xbox-specific intrinsic exposes raw descriptor words, programs that use it would get 0 on that path.

Measurement

victory translate --validate --list on shaders.rpf (1.0.2.1), with dxil.dll 1.8.2502.11, compared program by program (25,889 programs):

Build Validated Change Lost
#1402 head 2310409 23,412
this PR, 2d2a697 23,847 +435 0

Of the 809, 435 now validate. 53 more move on to later failures:

  • 35 to "a lane mask read as data"
  • 8 to "a lane mask holding lanes elsewhere read as data"
  • 8 to "a constant buffer's descriptor read as data"
  • 2 to "a descriptor read only as data"

321 still fail with this reason. Most of them are image dwords 0 and 5 that reach the read without a data edge, plus the spills.

Checks

  • Two synthetic tests, no game data:
    • A raw view's dword 1 read directly is still refused.
    • The same dword joined with s_buffer_load data now lowers. With the new rule turned off, this test fails with exactly the target error.
  • cargo test --locked -p victory-shader --lib: 139 passed, 0 failed, 1 ignored. The run used an RTX 4070 SUPER as the default adapter.
  • cargo clippy -p victory-shader --all-targets: clean.
  • The asset-policy check passed in the pre-commit hook.

Overlap: #1376 and #1230 also work on descriptor and missing-value joins. Both conflict with #1402 in emit/lower.rs, and I have not measured them stacked.

AI-assisted (Claude Code). No shader names or data are included, per the asset policy.

**@⁠sinan-cmyk** on GitHub · 2026-11-24 19:40 UTC · [original](https://github.com/Marvisak/VIctory/pull/1597) `sinan-cmyk:shader-hidden-descriptor-join` → `main` · +2190 −158 · 10 files · 35 commits · closed without merging **Stacked on #1402.** Until #1402 lands, the diff here shows #1402 too. The change itself is the last commit, 2d2a697: one file, `emit/lower.rs`, +93 lines including 2 tests. **Summary:** This PR handles the 772 programs that reach "a descriptor's address or format read as data" through a join with data. On a retail dump it gains **435 programs on top of #1402 and loses none**. With #1402, that failure is the largest one: 809 programs ([measurement](https://git.gtahub.st/github/Marvisak--VIctory/pulls/1402)). ## What the 809 programs do I instrumented the translator on all 809 programs and recorded the first instruction that consumes the missing dword: | First consumer | Programs | |---|---| | a phi (a join) | 772 | | an SGPR spill (`v_writelane_b32`) | 36 | | `v_mov_b32` | 1 | At those joins, another reachable edge brings real data (`s_buffer_load` results, for example), and the code after the join uses the value as a number (`s_and_b32`, `s_cmp_*`, `s_lshl_b32`, `s_bfe_u32`). The descriptor's registers are simply reused on one path. In a traced example, the read sits behind a branch that is taken only when the value came over the data edge. ## Change `descriptor_data` marks the dwords that no HLSL program can read as hidden. `GetDimensions` reads an image's sizes and levels (dwords 1–4), a buffer's record count (dword 2) and a structured buffer's stride (dword 1). It never reads these dwords: - addresses: image dword 0, buffer dwords 0 and 1, except the stride bits of a structured buffer - formats: buffer dword 3 - an image's array pitch and meta data: dwords 5–7 At a join where a reachable edge brings data, a hidden dword on another edge is a register that a path left undefined. `fill_phis` takes 0 for it, which is the existing treatment of an unread join. What stays refused: - a hidden dword read directly, not through a join - a join of descriptor dwords only, with no data edge - the 36 spill cases **The assumption to review** (marked `shortcut:` in the code): a program that really reads such a dword on that path now gets 0. Plain HLSL cannot express such a read, so the console compiler can only produce it for a value that is undefined in the source. If an Xbox-specific intrinsic exposes raw descriptor words, programs that use it would get 0 on that path. ## Measurement `victory translate --validate --list` on `shaders.rpf` (1.0.2.1), with dxil.dll 1.8.2502.11, compared program by program (25,889 programs): | Build | Validated | Change | Lost | |---|---|---|---| | #1402 head 2310409 | 23,412 | | | | this PR, 2d2a697 | 23,847 | **+435** | **0** | Of the 809, 435 now validate. 53 more move on to later failures: - 35 to "a lane mask read as data" - 8 to "a lane mask holding lanes elsewhere read as data" - 8 to "a constant buffer's descriptor read as data" - 2 to "a descriptor read only as data" 321 still fail with this reason. Most of them are image dwords 0 and 5 that reach the read without a data edge, plus the spills. ## Checks - Two synthetic tests, no game data: - A raw view's dword 1 read directly is still refused. - The same dword joined with `s_buffer_load` data now lowers. With the new rule turned off, this test fails with exactly the target error. - `cargo test --locked -p victory-shader --lib`: 139 passed, 0 failed, 1 ignored. The run used an RTX 4070 SUPER as the default adapter. - `cargo clippy -p victory-shader --all-targets`: clean. - The asset-policy check passed in the pre-commit hook. **Overlap:** #1376 and #1230 also work on descriptor and missing-value joins. Both conflict with #1402 in `emit/lower.rs`, and I have not measured them stacked. AI-assisted (Claude Code). No shader names or data are included, per the asset policy.
image_sample_d_cl was refused by name, and behind it every program hit
a cube sample with explicit gradients, refused as "a cube sample with
... gradients". Both now translate to sampleGrad:

- A cube's gradients on GFX10 are of the face coordinates (s, t), four
  addresses rather than six, so the coordinates follow at 4. They become
  the direction's gradients through the face's linear part of
  cube_direction (u = 2s - 3, v = 2t - 3; the major axis does not move),
  in the new cube_gradient.
- `_cl`: the level-of-detail clamp follows the coordinates and is passed
  as sampleGrad's clamp.

translate --validate on shaders.rpf: vertex/pixel 12172 -> 12197
validated; both errors are gone from the list. Not yet compared against
the console's sampling at runtime.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A descriptor fetched from the resource heap by index has no used-resource
entry, so a scalar buffer load (s_buffer_load_dword*) through it was
lowered through a 64 KiB constant buffer handle. When vector buffer loads
read the same descriptor, the slot holds a buffer SRV (the title made it
one), and reading it through a CBV handle is a descriptor of the wrong
type, which D3D12 leaves undefined. Such loads now read the slot as a raw
buffer, as table SRVs already do. A descriptor also written through
(a UAV) and one only scalar loads read are unchanged.

In the title's shaders.rpf this changes 38,829 scalar loads in about 1,900
of 26,084 programs; emit and validation counts are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
s_buffer_load_dword* through a table's UAV took the constant buffer
path: a CBV handle at the heap index of a UAV. Reading through it
removes the device (WARP: "The GPU device instance has been
suspended"). Such a load now reads the UAV raw, as a raw SRV is read
and as vector buffer accesses read a UAV.

The test writes a value to the VALU tests' raw UAV, reads it back with
a scalar buffer load and stores that; it removed the WARP device before
this change and passes on the hardware GPU and WARP after.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
An s_load_dword* whose address is a root descriptor's, and whose
result the program never uses as a descriptor, reads that buffer's
data. It stopped with "a descriptor read only as data". It is now read
as global loads from a root view already are: a root SRV raw, a root
CBV (or a root view the used-resource list does not name) as a
constant buffer. A root UAV still stops, with its own reason.

Test: dwords 2 and 3 of a root SRV and of a root CBV read with one
s_load_dwordx2 and stored, exact on the hardware GPU and WARP; main
refuses the program.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
An s_load_dword* of a descriptor whose dwords the code reads as numbers
(an image's width and levels) but never samples was refused with "a
descriptor read only as data": the view's kind came only from a use. Now
the table's range names it, and an entry in the resource heap that no
range names (a run-time index reaches it) is an image if it is eight
dwords, taken for 2D (shortcut noted in the code).

Offline over the whole corpus, programs refused: 4123 -> 3749; "a
descriptor read only as data" 395 -> 18; compute programs emitted
1441 -> 1743 (validated 1417 -> 1647). Tested with a hand-assembled
waterfall program that reads two textures' sizes, on the host GPU and
WARP; it fails with the old refusal without the change.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
A register can hold a compare result's high dword on one path and a loaded
number on another; the compiler only reads it where the number is live. The
join's mask side was "a lane mask read as data", which refused the program.
A pixel or vertex program now takes the mask's ballot as that incoming value
(counts and zero tests mean the same on any wave size). shortcut: the ballot
is the host wave's, so a join read some other way would differ from the console.

Offline corpus: "a lane mask read as data" 250 -> 212, vertex/pixel programs
emitted 12243 -> 12250; the other 31 move on to descriptor/scalar-memory
refusals. Synthetic wave64 pixel program fails before, lowers after.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The console compiler spills scalars, lane-mask pairs among them, with
v_writelane_b32 into constant lanes of a VGPR and restores them with
v_readlane_b32 of the same lane. The restored pair was an opaque mask, so
the selects, EXEC writes and joins that used it refused ("a select on an
untracked mask", "an opaque lane mask", "a lane-mask join of an untracked
mask"). structure now follows a constant-lane readlane back through a plain
chain of writelanes to the scalar written to that lane, and gives the
restored pair that scalar pair's mask. A chain with a phi or another write
of the VGPR stays opaque (shortcut noted in code).

Offline corpus, against fix/mask-phi-ballot (neither branch carries #585):
vertex/pixel programs emitted 12250 -> 12269, compute 1443 -> 1452,
"a lane-mask join of an untracked mask" 20 -> 0, "an opaque lane mask"
29 -> 8, "a conditional export" 8 -> 0. Synthetic pixel program fails
before, lowers after. Stacked on fix/mask-phi-ballot (shares its test helper).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
v_cndmask_b32 and v_*_co_ci_u32 refused when their scalar mask was not one
structure followed (a plain SGPR number). In compute with console lanes the
lane now tests its own bit of the register (pair in wave64); inline 0 and -1
masks are constants. Taken from upstream PR #585 (mask part only; its
descriptor-dimension hunk is left to the resource work).

Offline corpus (26148 programs): "a select on an untracked mask" 288 -> 0, no
new refusal text; those programs now stop at later refusals (descriptor read
as data +205, unknown stride +32, descriptor address/format +33), so compute
programs emitted only 1441 -> 1443. Synthetic test on hardware: fails before,
passes after. WARP cannot pin a wave size, so the test skips it.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Fixes 5 shader emission and DXIL container/validator issues in `victory-shader`,
raising validated shaders across the test corpus from 21,983 to 22,159 (+176;
100% of emitted VS/PS/CS shaders now validate cleanly):

1. Biased 16-bit image samples (`emit/lower.rs`):
   - Remove the `a16` rejection on `image_sample_b` and separate 32-bit prefix
     operands (offsets, bias, comparison reference) from `a16`-packed tail
     operands (gradients, coordinates, explicit LOD) starting at `regs[first]`,
     matching GFX10 MIMG hardware operand layout.

2. Conservative depth `SV_Position` interpolation (`emit/mod.rs`):
   - Declare `SV_Position` with `linear_noperspective_centroid` (5) instead of
     `linear_noperspective` (4) in pixel shaders outputting `SV_DepthLessEqual`
     or `SV_DepthGreaterEqual` (kinds 18/19).

3. Per-row interpolation mode consistency (`emit/mod.rs`, `emit/lower.rs`):
   - Add `harmonize_row_interp()` so elements sharing a signature row always
     declare the same interpolation mode: rows containing integer attributes or
     `SV_IsFrontFace` propagate `nointerpolation` (1) to sibling elements, and
     after pixel-shader lowering unread siblings inherit the actual read mode
     of sibling elements in the same row.

4. Container signature row ordering (`emit/container.rs`):
   - Sort `ISG1`/`OSG1` rows stably by register only (`row`) rather than
     `(row, col)`, preserving DXIL element-ID order within a row so the
     container signature matches DXIL validator expectations byte for byte.

5. SM 6.6 compute-shader implicit derivatives (`emit/shader.rs`, `emit/container.rs`, `emit/lower.rs`):
   - Track compute shaders emitting implicit-derivative sampling ops and emit
     `dx.valver = 1.8` with `PSVRuntimeInfo3` (52 bytes, carrying
     `EntryFunctionName`), enabling validation and D3D12 compute PSO creation.

Adds 5 unit + `dxil.dll` validation (+ D3D12 compute PSO) tests in `emit::tests`.
With a16 the bias of `image_sample_b` keeps its own address dword but
holds an f16 in the low half (as LLVM's AMDGPU lowering builds it), so
reading the dword as f32 silently dropped the bias. Unpack the low half
and convert it like the other 16-bit addresses.

Derivatives are only 16-bit in the `_g16` opcodes; under a16 alone they
stay one 32-bit dword each and only the coordinates and LOD are packed.
Fix the decoder's address dword count (2D `image_sample_d ... a16` is
five dwords) and read the gradients as full dwords, starting the packed
coordinates after them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The first commit left a heap descriptor of no listed kind that a vector
buffer store or atomic also uses on the constant buffer path, which is a
CBV handle on the UAV the title made. Scalar loads through it now read a
raw UAV (11 | 0x1000), as #1055 does for a table's UAV; read-only use
stays a raw SRV. The test's store case now expects no CBV handle.

In the title's shaders.rpf no program has this case (all 38,829 changed
loads are the read-only one); emit and validation counts are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts:
#	crates/victory-shader/src/emit/lower.rs
#	crates/victory-shader/src/emit/valu_tests.rs
# Conflicts:
#	crates/victory-shader/src/emit/lower.rs
Merges #1057 #1073 #1074 #1084 #953 #1056 #1015 #1055 #563 #1004 onto main
(ffe310e), each head unchanged. Two merges needed a hand resolution:

- #1015 + #1055 (emit/lower.rs, the raw-view choice for a scalar buffer
  load of a descriptor): an SRV range reads a raw SRV view, a UAV range a
  raw UAV view, a descriptor of no listed kind the heap buffer view of #1015.
  Both of their tests (emit/valu_tests.rs) are kept.
- #563 + #1004 (emit/lower.rs, cube sample refusal): #563 lowers gradients
  and #1004 the level query, so only texel coordinates are still refused.

cargo clippy --workspace --all-targets --locked -- -D warnings, with and
without --all-features, is clean and cargo test --workspace --locked passes
(350 passed, 6 ignored; main has 342 passed, 6 ignored).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
# Conflicts:
#	crates/victory-shader/src/emit/lower.rs
# Conflicts:
#	crates/victory-shader/src/emit/lower.rs
# Conflicts:
#	crates/victory-shader/src/emit/lower.rs
# Conflicts:
#	crates/victory-shader/src/emit/lower.rs
Merges #1067 #305 #306 #176 on top of the bundle of #1319 (itself on main,
ffe310e), each head unchanged. In #1247's offline benchmark on a retail dump
they gain 295, 520, 153 and 117 programs. Each needed a hand resolution
against the PRs of #1319 (see the pull request text); the combined
semantics are the ones of both sides.

cargo clippy --workspace --all-targets --locked -- -D warnings, with and
without --all-features, is clean and cargo test --workspace --locked passes
(359 passed, 6 ignored; main has 342 passed, 6 ignored).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
compute_shader_implicit_sample_uses_valver_1_8_and_validates and
row_interp_harmonizes_packed_elements_and_validates (both #306) fail with
the stock Windows SDK's dxil.dll (validator 1.7): the first because the
module declares validator 1.8 ("Validator version in metadata (1.8) is not
supported; maximum: (1.7)"), the second with "Container part 'Pipeline
State Validation' does not match expected for module" (reported by
alexdeliu on #1495, RX 9070). A runner with the stock SDK would fail them.

Validator::version() asks the validator for its IDxcVersionInfo, and the
two tests validate through validate_if_1_8_available, which skips with a
message when the version is below 1.8 and validates as before otherwise.
Checked here with validator 1.9 (they run) and with an old SDK's 1.5 (they
skip).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
809 programs on top of #1402 stop at "a descriptor's address or format
read as data", and 772 of them reach it through a join: a descriptor
dword arrives on one path, data on another, and code after the join
reads the value. HLSL cannot see those words (GetDimensions reads an
image's sizes and levels and a buffer's count and stride, never an
address, a format or an image's meta data), so on that path the register
holds what a path that leaves the value undefined left there. Such a
join now takes zero from that path, as an unread join does. A word read
directly stays refused, and so does a join of descriptor words alone.

On a retail dump: 435 more programs validate, none lost.
Of the 321 programs still stopping at "a descriptor's address or format
read as data", 42 reach a join with data only through a join whose edges
are all hidden words (two loads of one descriptor), and 36 through an SGPR
spill. A join whose edges are all hidden words is now a hidden word
itself, so a join with data further on takes it as the undefined path,
while a direct read of it stays refused. v_writelane at a constant lane
keeps the mark on that lane, and v_readlane of it gives the hidden word
back.

On a retail dump: 38 more programs validate, none lost (473 over #1402).
A constant buffer descriptor that the program also reads as numbers was
refused as a whole ("a constant buffer's descriptor read as data"), even
when the words reach the code only through a join with data. HLSL can read
no word of a constant buffer's descriptor (there is no GetDimensions for
one), so all four are hidden words: a direct read is still refused under
the same reason, and at a join with data they are the undefined path, as
for the other hidden descriptor words. Words of the load past this
descriptor stay without a host value.

On a retail dump: 21 more programs validate, none lost; the other 33 that
stopped here move on to later failures.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:37:41 +00:00
github-bot closed this pull request 2026-11-26 04:37:42 +00:00
Author
Owner

@⁠sinan-cmyk on GitHub · 2026-11-24 20:10 UTC · original

Follow-up commit 6a94bb3: +38 more programs, 0 lost (+473 over #1402 in total).

This commit traced the 321 programs that still stopped at "a descriptor's address or format read as data" after 2d2a697, and handles two more paths. In both, the direct read stays refused.

  • A join whose edges are all hidden words is itself hidden (two loads of one descriptor meeting at a join). A join with data further on then takes it as the undefined path.
  • A hidden word spilled with v_writelane_b32 at a constant lane stays marked, and v_readlane_b32 of that lane gives the hidden word back.

I also tried counting a lane-mask edge (one whose ballot the join uses) as data. It gained no program, so I left it out to keep the assumption narrow.

Build Validated Change Lost
#1402 2310409 23,412
2d2a697 23,847 +435 0
6a94bb3 23,885 +38 0

About 48 programs still fail with this reason. Most of them read the hidden field on every path, so refusing them is correct. Two new synthetic tests (a_join_of_hidden_words_is_hidden, a_spilled_hidden_word_comes_back_hidden) each fail when their rule is turned off. cargo test -p victory-shader --lib: 141 passed, 0 failed. clippy: clean.

AI-assisted (Claude Code). No shader names or data are included, per the asset policy.

**@⁠sinan-cmyk** on GitHub · 2026-11-24 20:10 UTC · [original](https://github.com/Marvisak/VIctory/pull/1597#issuecomment-7143135547) **Follow-up commit 6a94bb3: +38 more programs, 0 lost (+473 over #1402 in total).** This commit traced the 321 programs that still stopped at "a descriptor's address or format read as data" after 2d2a697, and handles two more paths. In both, the direct read stays refused. - **A join whose edges are all hidden words is itself hidden** (two loads of one descriptor meeting at a join). A join with data further on then takes it as the undefined path. - **A hidden word spilled with `v_writelane_b32` at a constant lane stays marked**, and `v_readlane_b32` of that lane gives the hidden word back. I also tried counting a lane-mask edge (one whose ballot the join uses) as data. It gained no program, so I left it out to keep the assumption narrow. | Build | Validated | Change | Lost | |---|---|---|---| | #1402 2310409 | 23,412 | | | | 2d2a697 | 23,847 | +435 | 0 | | 6a94bb3 | 23,885 | **+38** | **0** | About 48 programs still fail with this reason. Most of them read the hidden field on every path, so refusing them is correct. Two new synthetic tests (`a_join_of_hidden_words_is_hidden`, `a_spilled_hidden_word_comes_back_hidden`) each fail when their rule is turned off. `cargo test -p victory-shader --lib`: 141 passed, 0 failed. clippy: clean. AI-assisted (Claude Code). No shader names or data are included, per the asset policy.
Author
Owner

@⁠sinan-cmyk on GitHub · 2026-11-24 20:57 UTC · original

Rebased onto the updated #1402 head 119b763. That commit is test-only: it skips two of #306's tests on older validators. My two commits are unchanged: 81f2545 (was 2d2a697) and 6c428a2 (was 6a94bb3). emit/lower.rs is byte-identical to before, so the measurement still holds: +473 over #1402, 0 lost. cargo test --locked -p victory-shader --lib on the rebased head: 141 passed, 0 failed.

AI-assisted (Claude Code).

**@⁠sinan-cmyk** on GitHub · 2026-11-24 20:57 UTC · [original](https://github.com/Marvisak/VIctory/pull/1597#issuecomment-7144292288) Rebased onto the updated #1402 head `119b763`. That commit is test-only: it skips two of #306's tests on older validators. My two commits are unchanged: `81f2545` (was 2d2a697) and `6c428a2` (was 6a94bb3). `emit/lower.rs` is byte-identical to before, so the measurement still holds: +473 over #1402, 0 lost. `cargo test --locked -p victory-shader --lib` on the rebased head: 141 passed, 0 failed. AI-assisted (Claude Code).
Author
Owner

@⁠sinan-cmyk on GitHub · 2026-11-24 21:12 UTC · original

Third commit f4e166a: a constant buffer's descriptor words are hidden too. +21 programs, 0 lost (+494 over #1402).

descriptor_data refused the whole load as soon as a descriptor whose use is a constant buffer had a word read as data. Plain HLSL can read no word of a CBV descriptor (GetDimensions has no cbuffer form), so all four words are hidden words now. A direct read is still refused under the same reason ("a constant buffer's descriptor read as data"). At a join with data, the words take the undefined path, as the first commit does for other hidden words. Words of the load beyond the descriptor stay "address or format" and are not hidden.

Build Validated Change Lost
#1402 119b763 23,412
6c428a2 (the two earlier commits, rebased) 23,885 +473 0
f4e166a 23,906 +21 0

No program fails with the CBV reason any more. 22 programs move on to "a descriptor's address or format read as data" (load words beyond the descriptor), and 9 to "a descriptor read only as data". New test: a_constant_buffers_descriptor_words_are_hidden. It fails at the join when the old refusal is put back. cargo test --locked -p victory-shader --lib: 142 passed, 0 failed.

No open PR targets this reason. AI-assisted (Claude Code). No shader names or data are included, per the asset policy.

**@⁠sinan-cmyk** on GitHub · 2026-11-24 21:12 UTC · [original](https://github.com/Marvisak/VIctory/pull/1597#issuecomment-7144626878) **Third commit f4e166a: a constant buffer's descriptor words are hidden too. +21 programs, 0 lost (+494 over #1402).** `descriptor_data` refused the whole load as soon as a descriptor whose use is a constant buffer had a word read as data. Plain HLSL can read no word of a CBV descriptor (`GetDimensions` has no cbuffer form), so all four words are hidden words now. A direct read is still refused under the same reason ("a constant buffer's descriptor read as data"). At a join with data, the words take the undefined path, as the first commit does for other hidden words. Words of the load beyond the descriptor stay "address or format" and are not hidden. | Build | Validated | Change | Lost | |---|---|---|---| | #1402 119b763 | 23,412 | | | | 6c428a2 (the two earlier commits, rebased) | 23,885 | +473 | 0 | | f4e166a | 23,906 | **+21** | **0** | No program fails with the CBV reason any more. 22 programs move on to "a descriptor's address or format read as data" (load words beyond the descriptor), and 9 to "a descriptor read only as data". New test: `a_constant_buffers_descriptor_words_are_hidden`. It fails at the join when the old refusal is put back. `cargo test --locked -p victory-shader --lib`: 142 passed, 0 failed. No open PR targets this reason. AI-assisted (Claude Code). No shader names or data are included, per the asset policy.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 01:21 UTC · original

Automated triage for the maintainers. Closing because by our reading the change is incorrect or would break something that works today.

Stacked on bundle #1402; its own change zero-fills stale descriptor words at joins with data ('shortcut: zero for the undefined path'), the policy main dropped as unsound (3dd467c), and main now proves such edges dead instead (a7fc47af dead_on_edge/live_edges).

If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.

**@⁠Marvisak** on GitHub · 2026-11-25 01:21 UTC · [original](https://github.com/Marvisak/VIctory/pull/1597#issuecomment-7149462533) Automated triage for the maintainers. Closing because by our reading the change is incorrect or would break something that works today. Stacked on bundle #1402; its own change zero-fills stale descriptor words at joins with data ('shortcut: zero for the undefined path'), the policy main dropped as unsound (3dd467c), and main now proves such edges dead instead (a7fc47af `dead_on_edge`/`live_edges`). If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 01:31 UTC · original

Automated triage for the maintainers.

Needs rebase. This pull request conflicts with main (conflicting: crates/victory-shader/src/emit/lower.rs, crates/victory-shader/src/emit/mod.rs, crates/victory-shader/src/emit/shader.rs, crates/victory-shader/src/emit/valu_tests.rs, crates/victory-shader/src/structure.rs). It will be reviewed once it is rebased onto the current main.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 01:31 UTC · [original](https://github.com/Marvisak/VIctory/pull/1597#issuecomment-7149648421) <!-- victory-triage v1 head=f4e166a8419983e40c1c5002f860b099f0c8c767 verdict=needs-rebase at=2026-11-25T01:31:41Z --> Automated triage for the maintainers. **Needs rebase.** This pull request conflicts with `main` (conflicting: `crates/victory-shader/src/emit/lower.rs`, `crates/victory-shader/src/emit/mod.rs`, `crates/victory-shader/src/emit/shader.rs`, `crates/victory-shader/src/emit/valu_tests.rs`, `crates/victory-shader/src/structure.rs`). It will be reviewed once it is rebased onto the current `main`. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠sinan-cmyk on GitHub · 2026-11-25 01:45 UTC · original

Fourth commit cc7d30a: a structured buffer's dword 1 is hidden at a join too.

Why. I merged #995 by hand on top of this PR, and the result lost 21 programs. #995 turns some raw views into structured ones. This PR treated a raw view's dword 1 as hidden, but not a structured view's dword 1. descriptor_data gives that word no value: its low half is the address, its high half the stride. So programs that the raw-view rule had covered fell back to "a descriptor's address or format read as data". The fix: a direct read of a structured view's dword 1 stays refused, and at a join with data the word now takes the undefined path, as for a raw view.

Build Validated Change Lost
f4e166a 23,906
cc7d30a (this PR alone) 23,907 +1 0
#1597 + #995, without the fix 21
#1597 + #995, with the fix +1 0

Total for this PR: +495 over #1402 (119b763), 0 lost. cargo test --locked -p victory-shader --lib: 142 passed, 0 failed.

Method: victory translate --validate --list on shaders.rpf (1.0.2.1), dxil.dll 1.8.2502.11, compared program by program (25,889 programs). AI-assisted (Claude Code). No shader names or data are included, per the asset policy.

**@⁠sinan-cmyk** on GitHub · 2026-11-25 01:45 UTC · [original](https://github.com/Marvisak/VIctory/pull/1597#issuecomment-7149925220) **Fourth commit cc7d30a: a structured buffer's dword 1 is hidden at a join too.** **Why.** I merged #995 by hand on top of this PR, and the result lost 21 programs. #995 turns some raw views into structured ones. This PR treated a raw view's dword 1 as hidden, but not a structured view's dword 1. `descriptor_data` gives that word no value: its low half is the address, its high half the stride. So programs that the raw-view rule had covered fell back to "a descriptor's address or format read as data". The fix: a direct read of a structured view's dword 1 stays refused, and at a join with data the word now takes the undefined path, as for a raw view. | Build | Validated | Change | Lost | |---|---|---|---| | f4e166a | 23,906 | | | | cc7d30a (this PR alone) | 23,907 | +1 | 0 | | #1597 + #995, without the fix | | | **21** | | #1597 + #995, with the fix | | +1 | **0** | Total for this PR: +495 over #1402 (119b763), 0 lost. `cargo test --locked -p victory-shader --lib`: 142 passed, 0 failed. Method: `victory translate --validate --list` on `shaders.rpf` (1.0.2.1), dxil.dll 1.8.2502.11, compared program by program (25,889 programs). AI-assisted (Claude Code). No shader names or data are included, per the asset policy.
Author
Owner

@⁠sinan-cmyk on GitHub · 2026-11-25 01:59 UTC · original

Thanks for the explanation. Understood: main proves those edges dead instead of zero-filling them, so this PR is superseded, and I won't reopen it.

To check whether anything was missed, I measured the current main (940d32f) on the dump. Method: translate --validate --list on shaders.rpf 1.0.2.1, dxil.dll 1.8.2502.11, program by program.

  • Over ffe310e, this PR made 2,183 more programs validate. main now validates 1,782 of them.

  • Of the other 401, main refuses 36 ("a descriptor read only as data"). The remaining 365 are emitted but rejected by the validator:

    • 318 with "Entry function performs some operation that is incompatible with the shader stage"
    • 47 with "Flags must match usage"

    So they are not proven-dead refusals.

  • Separately, 808 programs that validated on ffe310e fail on main with "Flags must match usage". I'm bisecting that now and will file it as its own issue with the commit.

AI-assisted (Claude Code). No shader names or data are included, per the asset policy.

**@⁠sinan-cmyk** on GitHub · 2026-11-25 01:59 UTC · [original](https://github.com/Marvisak/VIctory/pull/1597#issuecomment-7150197681) Thanks for the explanation. Understood: `main` proves those edges dead instead of zero-filling them, so this PR is superseded, and I won't reopen it. To check whether anything was missed, I measured the current `main` (940d32f) on the dump. Method: `translate --validate --list` on `shaders.rpf` 1.0.2.1, dxil.dll 1.8.2502.11, program by program. - Over `ffe310e`, this PR made 2,183 more programs validate. `main` now validates **1,782 of them**. - Of the other **401**, `main` refuses 36 ("a descriptor read only as data"). The remaining **365 are emitted but rejected by the validator**: - 318 with "Entry function performs some operation that is incompatible with the shader stage" - 47 with "Flags must match usage" So they are not proven-dead refusals. - Separately, 808 programs that validated on `ffe310e` fail on `main` with "Flags must match usage". I'm bisecting that now and will file it as its own issue with the commit. AI-assisted (Claude Code). No shader names or data are included, per the asset policy.

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