Shaders: cd94d35 costs 867 vertex programs to \Flags must match usage\ (24,785 validated to 23,918) #1987

Open
opened 2026-11-26 04:50:44 +00:00 by github-bot · 17 comments
Owner

@⁠fiestorra on GitHub · 2026-11-25 02:22 UTC · original

The view-mark commit costs 867 vertex programs: from 24,785 validated to 23,918, all of them Vs, all with Flags must match usage

Measured with the offline census on this machine, same local 1.0.2.1 shader archive each time, victory translate --validate --list --jobs 10, validator = SDK 10.0.26100 dxil.dll (1.9, the one default_path picks here):

commit validated Flags must match usage
ccfb029 (parent) 24,785 0
cd94d35 "shaders mark the pages they write through views" 23,918 868
940d32f (its child, main today) 23,918 868

So the regression is bisected to cd94d35 and it costs 867 programs (the first line of the error list is the program itself). Every one of them is a vertex shader:

VS_TransformSkin_VfxVBuffer_703b1881_Wrapped  Vs  validator: error: Flags must match usage.
VS_TransformPreSkin_VfxVBuffer_c6448ed4_Wrapped  Vs  validator: error: Flags must match usage.

867 × Vs, no other stage.

Why I think it is the marking, not the shaders. cd94d35 is the commit that has shaders mark the pages they write through buffer views, and its host side binds two extra root UAVs for that (VIEW_MARKS, VIEW_WRITES in MEMORY_SPACE, emit/host.rs). A vertex program whose DXIL now writes a UAV but whose container's flags/PSV do not declare UAV usage is exactly the shape the validator's "Flags must match usage" names. It would not be the first: this same commit changes what a translated module uses without necessarily changing what it declares.

What I have not done: I have not read the writer side far enough to point at the line that sets the flags, and I have not tried a fix — the marking is one day old and whoever wrote it knows which of the two ends is easier to change (declare the UAV usage in the flags and PSV, or not mark pages from the vertex stage). What I can say is that a fix is measurable in about two minutes with the command above, and that 24,785 is the number to get back to.

Reproduce (no game data leaves the machine; the counts are the only thing in a report):

victory translate <local shaders.rpf> --validate --list --jobs 10 | grep -c "Flags must match usage"

on ccfb029 and on cd94d35.

One caveat worth stating: this is the SDK validator 1.9. The 1.7 validator that #1945 describes rejects a fifth of the corpus for its own reasons (PSV0 rebuilding), so a report from a machine with that one will not show this regression clearly — the validator's version matters and is now printed by translate --validate.

No game data is involved: counts, stage letters and program names.

Written with an AI assistant.

**@⁠fiestorra** on GitHub · 2026-11-25 02:22 UTC · [original](https://github.com/Marvisak/VIctory/issues/1987) **The view-mark commit costs 867 vertex programs: from 24,785 validated to 23,918, all of them `Vs`, all with `Flags must match usage`** Measured with the offline census on this machine, same local 1.0.2.1 shader archive each time, `victory translate --validate --list --jobs 10`, validator = SDK 10.0.26100 `dxil.dll` (1.9, the one `default_path` picks here): | commit | validated | `Flags must match usage` | |---|---|---| | `ccfb029` (parent) | **24,785** | **0** | | `cd94d35` "shaders mark the pages they write through views" | 23,918 | **868** | | `940d32f` (its child, `main` today) | 23,918 | **868** | So the regression is bisected to **`cd94d35`** and it costs **867 programs** (the first line of the error list is the program itself). Every one of them is a **vertex shader**: ``` VS_TransformSkin_VfxVBuffer_703b1881_Wrapped Vs validator: error: Flags must match usage. VS_TransformPreSkin_VfxVBuffer_c6448ed4_Wrapped Vs validator: error: Flags must match usage. ``` 867 × `Vs`, no other stage. **Why I think it is the marking, not the shaders.** `cd94d35` is the commit that has shaders mark the pages they write through buffer views, and its host side binds two extra root UAVs for that (`VIEW_MARKS`, `VIEW_WRITES` in `MEMORY_SPACE`, `emit/host.rs`). A vertex program whose DXIL now writes a UAV but whose container's flags/PSV do not declare UAV usage is exactly the shape the validator's "Flags must match usage" names. It would not be the first: this same commit changes what a translated module *uses* without necessarily changing what it *declares*. **What I have not done**: I have not read the writer side far enough to point at the line that sets the flags, and I have not tried a fix — the marking is one day old and whoever wrote it knows which of the two ends is easier to change (declare the UAV usage in the flags and PSV, or not mark pages from the vertex stage). What I can say is that a fix is measurable in about two minutes with the command above, and that 24,785 is the number to get back to. **Reproduce** (no game data leaves the machine; the counts are the only thing in a report): ``` victory translate <local shaders.rpf> --validate --list --jobs 10 | grep -c "Flags must match usage" ``` on `ccfb029` and on `cd94d35`. One caveat worth stating: this is the SDK validator 1.9. The 1.7 validator that #1945 describes rejects a fifth of the corpus for its own reasons (PSV0 rebuilding), so a report from a machine with that one will not show this regression clearly — the validator's version matters and is now printed by `translate --validate`. No game data is involved: counts, stage letters and program names. Written with an AI assistant.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:50:44 +00:00
Author
Owner

@⁠BastienRodz on GitHub · 2026-11-25 02:23 UTC · original

Same as #1973, opened a few minutes earlier, which I've taken: missing UAVsAtEveryStage now that cd94d35 gives vertex programs a UAV store. The fix is in progress there; your offline recount would be welcome on its PR.

**@⁠BastienRodz** on GitHub · 2026-11-25 02:23 UTC · [original](https://github.com/Marvisak/VIctory/issues/1987#issuecomment-7150657024) Same as #1973, opened a few minutes earlier, which I've taken: missing `UAVsAtEveryStage` now that `cd94d35` gives vertex programs a UAV store. The fix is in progress there; your offline recount would be welcome on its PR.
Author
Owner

@⁠fiestorra on GitHub · 2026-11-25 02:27 UTC · original

Narrowed with one more measurement: it is the marking, and turning it off restores all 24,785

Same census, same machine, same archive, same validator (SDK 10.0.26100, 1.9), only the option changed — emit::Options { view_marks: false } instead of true in apps/victory/src/translate.rs:571:

build validated Flags must match usage
ccfb029 (before the marking) 24,785 0
940d32f (main, marking on) 23,918 868
940d32f with view_marks: false 24,785 0

So the 867 programs are not a property of the shaders, of the corpus or of the validator: they are what the write-marking emission does to vertex programs. Turning the marking off puts the corpus exactly back where the parent commit had it, to the program.

That is as far as a measurement can take it without choosing between the two fixes, and both are now visible from here:

  • declare the usage the marking adds — the modules that fail are the ones whose DXIL now writes a root UAV (VIEW_WRITES, u1 in MEMORY_SPACE) while the container's flags/PSV for a vertex shader do not say so. Compute, pixel and mesh programs survive the same emission, which is a hint that what is missing is specific to the vertex stage's PSV rather than the flags in general.
  • or do not mark from the vertex stage. Cheaper and honest if a vertex program's writes are rare: the marking exists so the host copies back only what shaders wrote, and a stage that cannot carry the UAV gives that up for its own writes. The cost is measurable too — whatever copy_back_marks loses for vertex writes.

I am not choosing between them: the marking landed yesterday and whoever wrote it knows whether the host side tolerates the missing marks for vertex programs (option two) or whether the PSV is a small change (option one). What I can promise is that either fix is verifiable in two minutes with the table above.

Two notes for whoever picks it up:

  • the marking is on by default, and the only place that turns it on in the offline path is that one line in translate.rs, so a bisect on the census will always land on the same place;
  • the validator version matters: with the 1.7 validator (#1945) this regression is buried under its 15,054 false PSV verdicts, so check translate --validate's first line before believing a count.

No game data is involved: counts and commit hashes.

Written with an AI assistant.

**@⁠fiestorra** on GitHub · 2026-11-25 02:27 UTC · [original](https://github.com/Marvisak/VIctory/issues/1987#issuecomment-7150738926) **Narrowed with one more measurement: it is the marking, and turning it off restores all 24,785** Same census, same machine, same archive, same validator (SDK 10.0.26100, 1.9), only the option changed — `emit::Options { view_marks: false }` instead of `true` in `apps/victory/src/translate.rs:571`: | build | validated | `Flags must match usage` | |---|---|---| | `ccfb029` (before the marking) | 24,785 | 0 | | `940d32f` (`main`, marking on) | 23,918 | **868** | | `940d32f` with `view_marks: false` | **24,785** | **0** | So the 867 programs are not a property of the shaders, of the corpus or of the validator: they are what the write-marking emission does to **vertex** programs. Turning the marking off puts the corpus exactly back where the parent commit had it, to the program. That is as far as a measurement can take it without choosing between the two fixes, and both are now visible from here: - **declare the usage the marking adds** — the modules that fail are the ones whose DXIL now writes a root UAV (`VIEW_WRITES`, `u1` in `MEMORY_SPACE`) while the container's flags/PSV for a vertex shader do not say so. Compute, pixel and mesh programs survive the same emission, which is a hint that what is missing is specific to the vertex stage's PSV rather than the flags in general. - **or do not mark from the vertex stage**. Cheaper and honest if a vertex program's writes are rare: the marking exists so the host copies back only what shaders wrote, and a stage that cannot carry the UAV gives that up for its own writes. The cost is measurable too — whatever `copy_back_marks` loses for vertex writes. I am not choosing between them: the marking landed yesterday and whoever wrote it knows whether the host side tolerates the missing marks for vertex programs (option two) or whether the PSV is a small change (option one). What I can promise is that either fix is verifiable in two minutes with the table above. Two notes for whoever picks it up: - the marking is **on by default**, and the only place that turns it on in the offline path is that one line in `translate.rs`, so a bisect on the census will always land on the same place; - the validator version matters: with the 1.7 validator (#1945) this regression is buried under its 15,054 false PSV verdicts, so check `translate --validate`'s first line before believing a count. No game data is involved: counts and commit hashes. Written with an AI assistant.
Author
Owner

@⁠DesertGamer on GitHub · 2026-11-25 02:27 UTC · original

VIctory V2: community PRs, merged and tested

Open PRs sitting in the queue? V2 pulls them into one build, screens each one (binaries, build scripts, hooks, new deps) and runs tests after every batch.

Where it stands today: launches, runs the menu at 30 fps, plays the intro video, reaches the start screen and loads the world (~50 s). Entering the world is the current blocker: rendering fails with a GPU "device removed" error (tracked in issue #1).

⚠️ Entering the world on a real GPU can hang it and make Windows reset the driver. Try it at your own risk.

Not playable yet, but every batch of merged fixes moves it closer. If you have a PR that's stuck, or a GPU to test on, I'd love your help:
https://DesertGamer/VIctory-V2

Unofficial community fork of Marvisak/VIctory, GPL-3.0.

**@⁠DesertGamer** on GitHub · 2026-11-25 02:27 UTC · [original](https://github.com/Marvisak/VIctory/issues/1987#issuecomment-7150742923) ### VIctory V2: community PRs, merged and tested Open PRs sitting in the queue? V2 pulls them into one build, screens each one (binaries, build scripts, hooks, new deps) and runs tests after every batch. **Where it stands today:** launches, runs the menu at 30 fps, plays the intro video, reaches the start screen and loads the world (~50 s). Entering the world is the current blocker: rendering fails with a GPU "device removed" error (tracked in issue #1). :warning: Entering the world on a real GPU can hang it and make Windows reset the driver. Try it at your own risk. Not playable yet, but every batch of merged fixes moves it closer. If you have a PR that's stuck, or a GPU to test on, I'd love your help: https://DesertGamer/VIctory-V2 *Unofficial community fork of Marvisak/VIctory, GPL-3.0.*
Author
Owner

@⁠BastienRodz on GitHub · 2026-11-25 02:27 UTC · original

PR: #1989 (UAVsAtEveryStage and SFI0 0x4 for non-pixel, non-compute stages with a declared UAV, as DXC collects them below validator 1.8). Could you rerun your offline translate --validate count on its branch, BastienRodz:shader/uavs-at-every-stage, to confirm the 867 come back?

**@⁠BastienRodz** on GitHub · 2026-11-25 02:27 UTC · [original](https://github.com/Marvisak/VIctory/issues/1987#issuecomment-7150756171) PR: #1989 (`UAVsAtEveryStage` and SFI0 `0x4` for non-pixel, non-compute stages with a declared UAV, as DXC collects them below validator 1.8). Could you rerun your offline `translate --validate` count on its branch, `BastienRodz:shader/uavs-at-every-stage`, to confirm the 867 come back?
Author
Owner

@⁠fiestorra on GitHub · 2026-11-25 02:28 UTC · original

Correction to the severity in this report: it costs 867 programs in the validation census, not 867 programs in the title

I wrote the title as "costs 867 vertex programs", and after checking where the validator actually runs, that overstates it. Being precise, because the difference decides how urgent this is:

  • the runtime never validates. crates/victory-gpu/src/shader_cache.rs translates with emit::translate_with(..., Options { view_marks: true }) and does not load dxil.dll at all. Validator::load appears only in tests and in apps/victory/src/translate.rs (the offline --validate path).
  • CI does not gate on it either. .github/workflows/ci.yml runs clippy and cargo test, and nothing in it calls victory translate --validate.

So the 867 vertex programs still translate and still load in the title; what they fail is the offline validator, which is the instrument I used to find this and which several benchmarks in the repository use to rank pull requests by "programs that now validate" (#1247, #1563, and the corpus census in #201).

That makes this a defect in the measurement rather than in the game, and I should have said so from the start. It also changes what a good fix looks like: leaving it unfixed means every later report of the form "N more programs validate" is counting against an instrument that is currently lying about 867 of them — the same failure mode #1945 describes for a different reason.

The measurements stand, and so does the narrowing:

build validated Flags must match usage
ccfb029 (before the marking) 24,785 0
940d32f (marking on, the runtime's option) 23,918 868
940d32f, view_marks: false 24,785 0

and the two candidate fixes from the comment above are unchanged: declare in the vertex stage's PSV/flags the root UAV the marking adds, or do not mark from the vertex stage. The second one has a cost I had not stated clearly either — it gives up copy-back accuracy for whatever a vertex program writes through a buffer view — so it is the less attractive of the two unless the PSV turns out to be hard to change.

What I would want from anyone reading: if the PSV for a vertex shader should carry a UAV entry, that is a small change in container.rs; if it must not, then the marking has to be stage-aware and that is a design decision for whoever wrote it.

No game data is involved: counts, file names and option names.

Written with an AI assistant.

**@⁠fiestorra** on GitHub · 2026-11-25 02:28 UTC · [original](https://github.com/Marvisak/VIctory/issues/1987#issuecomment-7150763148) **Correction to the severity in this report: it costs 867 programs in the *validation census*, not 867 programs in the title** I wrote the title as "costs 867 vertex programs", and after checking where the validator actually runs, that overstates it. Being precise, because the difference decides how urgent this is: - **the runtime never validates.** `crates/victory-gpu/src/shader_cache.rs` translates with `emit::translate_with(..., Options { view_marks: true })` and does not load `dxil.dll` at all. `Validator::load` appears only in tests and in `apps/victory/src/translate.rs` (the offline `--validate` path). - **CI does not gate on it either.** `.github/workflows/ci.yml` runs clippy and `cargo test`, and nothing in it calls `victory translate --validate`. So the 867 vertex programs still translate and still load in the title; what they fail is the **offline validator**, which is the instrument I used to find this and which several benchmarks in the repository use to rank pull requests by "programs that now validate" (#1247, #1563, and the corpus census in #201). That makes this a defect in the *measurement* rather than in the game, and I should have said so from the start. It also changes what a good fix looks like: leaving it unfixed means every later report of the form "N more programs validate" is counting against an instrument that is currently lying about 867 of them — the same failure mode #1945 describes for a different reason. The measurements stand, and so does the narrowing: | build | validated | `Flags must match usage` | |---|---|---| | `ccfb029` (before the marking) | 24,785 | 0 | | `940d32f` (marking on, the runtime's option) | 23,918 | 868 | | `940d32f`, `view_marks: false` | 24,785 | 0 | and the two candidate fixes from the comment above are unchanged: declare in the vertex stage's PSV/flags the root UAV the marking adds, or do not mark from the vertex stage. The second one has a cost I had not stated clearly either — it gives up copy-back accuracy for whatever a vertex program writes through a buffer view — so it is the less attractive of the two unless the PSV turns out to be hard to change. What I would want from anyone reading: if the PSV for a vertex shader should carry a UAV entry, that is a small change in `container.rs`; if it must not, then the marking has to be stage-aware and that is a design decision for whoever wrote it. No game data is involved: counts, file names and option names. Written with an AI assistant.
Author
Owner

@⁠fiestorra on GitHub · 2026-11-25 02:29 UTC · original

Ruled out the obvious candidate: the marking does already declare RAW_BUFFERS

Before anyone spends time on the hypothesis I led with, the negative result:

memory_space_handle in crates/victory-shader/src/emit/shader.rs — the one that makes the u1 handle for VIEW_WRITES — ends with

self.flags |= flags::RAW_BUFFERS;

so a module that writes the marking bitmap does declare raw-buffer usage, and the Flush to zero/RAW_BUFFERS (1 << 4) bit is not what the validator is missing. root_uav_handle and root_srv_handle do the same. So "forgot to set the flag" is not the fix, and I would rather say it than have two people test it.

What that leaves, as far as I can see from here:

  1. the flag the validator wants is a different one — the check compares the module's declared ShaderFlags against recomputed usage, and raw-buffer access may not be the bit that a UAV write trips; the marking is the first thing in this emitter that writes a UAV from a vertex program, so a bit that was never needed before may now be;
  2. it is the vertex stage's PSV rather than the flags — Psv in container.rs lists only samplers and CBVs (Binding { kind: 1 sampler, 2 CBV }), which is what PSV0 carries for every stage, so a UAV cannot be declared there; if the validator is comparing PSV0's runtime-info against a module that uses a UAV, the answer is that the marking must not be emitted for a stage whose PSV cannot say so;
  3. something else in the marking's emission on the vertex path, which the frame the dump would show and I have not looked at.

The experiment that decides between them, and the one I would run next if this were mine: dump one failing program's module (VICTORY_EMIT_DUMP on a build with view_marks: true), run dxc -dumpbin on it, and read the declared dx.shaderFlags and the PSV0 next to the dx.op.bufferStore the marking adds. The census shows exactly which programs to pick — any VS_*VfxVBuffer* from the list in the report.

Everything else in this issue stands: the regression is the marking (view_marks: false returns 24,785), it affects the offline validator and not the title, and CI does not gate on it.

No game data is involved: flags, struct field names and counts.

Written with an AI assistant.

**@⁠fiestorra** on GitHub · 2026-11-25 02:29 UTC · [original](https://github.com/Marvisak/VIctory/issues/1987#issuecomment-7150787685) **Ruled out the obvious candidate: the marking does already declare `RAW_BUFFERS`** Before anyone spends time on the hypothesis I led with, the negative result: `memory_space_handle` in `crates/victory-shader/src/emit/shader.rs` — the one that makes the `u1` handle for `VIEW_WRITES` — ends with ```rust self.flags |= flags::RAW_BUFFERS; ``` so a module that writes the marking bitmap **does** declare raw-buffer usage, and the `Flush to zero`/`RAW_BUFFERS` (`1 << 4`) bit is not what the validator is missing. `root_uav_handle` and `root_srv_handle` do the same. So "forgot to set the flag" is not the fix, and I would rather say it than have two people test it. What that leaves, as far as I can see from here: 1. **the flag the validator wants is a different one** — the check compares the module's declared `ShaderFlags` against recomputed usage, and raw-buffer access may not be the bit that a **UAV write** trips; the marking is the first thing in this emitter that writes a UAV from a *vertex* program, so a bit that was never needed before may now be; 2. **it is the vertex stage's PSV rather than the flags** — `Psv` in `container.rs` lists only samplers and CBVs (`Binding { kind: 1 sampler, 2 CBV }`), which is what PSV0 carries for every stage, so a UAV cannot be declared there; if the validator is comparing PSV0's runtime-info against a module that uses a UAV, the answer is that the marking must not be emitted for a stage whose PSV cannot say so; 3. **something else in the marking's emission on the vertex path**, which the frame the dump would show and I have not looked at. **The experiment that decides between them**, and the one I would run next if this were mine: dump one failing program's module (`VICTORY_EMIT_DUMP` on a build with `view_marks: true`), run `dxc -dumpbin` on it, and read the declared `dx.shaderFlags` and the `PSV0` next to the `dx.op.bufferStore` the marking adds. The census shows exactly which programs to pick — any `VS_*VfxVBuffer*` from the list in the report. Everything else in this issue stands: the regression is the marking (`view_marks: false` returns 24,785), it affects the offline validator and not the title, and CI does not gate on it. No game data is involved: flags, struct field names and counts. Written with an AI assistant.
Author
Owner

@⁠Calvix2k on GitHub · 2026-11-25 02:32 UTC · original

The fix for this is zed6000's patch in #1973 and is open as #1977 ("Shaders: declare UAVsAtEveryStage for vertex/geometry programs with UAVs"): it sets DXIL shader flag 16 plus the SFI0 feature bit 0x4 when a program that is not pixel, compute or mesh carries root UAVs or one of the written-pages/view-mark handles — which is exactly what cd94d35 started binding in vertex programs.

zed6000 measured the counts your census shows: 940d32f + patch gives +867 validated, 0 lost, and ccfb029 + patch gives 0 gained, 0 lost (back to 24,785). Your 868-line error list is the 867 programs plus the header line.

On the validator: your run says SDK dxil.dll 1.9 while default_path picks the newest SDK folder; mine picks 1.7 from 10.0.26100 (the FileVersion/engine mismatch in #1945). The flag failures are independent of that — they are Flags must match usage, not PSV0 — so the census comparison holds either way.

**@⁠Calvix2k** on GitHub · 2026-11-25 02:32 UTC · [original](https://github.com/Marvisak/VIctory/issues/1987#issuecomment-7150861828) The fix for this is zed6000's patch in #1973 and is open as **#1977** ("Shaders: declare UAVsAtEveryStage for vertex/geometry programs with UAVs"): it sets DXIL shader flag 16 plus the `SFI0` feature bit `0x4` when a program that is not pixel, compute or mesh carries root UAVs or one of the written-pages/view-mark handles — which is exactly what `cd94d35` started binding in vertex programs. zed6000 measured the counts your census shows: `940d32f` + patch gives **+867 validated, 0 lost**, and `ccfb029` + patch gives 0 gained, 0 lost (back to 24,785). Your 868-line error list is the 867 programs plus the header line. On the validator: your run says SDK `dxil.dll` 1.9 while `default_path` picks the newest SDK folder; mine picks 1.7 from 10.0.26100 (the FileVersion/engine mismatch in #1945). The flag failures are independent of that — they are `Flags must match usage`, not PSV0 — so the census comparison holds either way.
Author
Owner

@⁠fiestorra on GitHub · 2026-11-25 02:44 UTC · original

All 868 are VfxVBuffer vertex programs: the ones that write a buffer through a view

One more cut of the census that narrows this a lot. Every failing program's name contains VfxVBuffer, and nothing else does:

prefix count
VS_Transform… 421
VS_TransformSkin… 398
VS_TransformPreSkin… 26
VS_PedTransformSkin… 12
VS_PedTransformPreSkin… 11
total 868, all with VfxVBuffer in the name

That is the strongest confirmation of the mechanism I have without reading the emitted module: VfxVBuffer is the class of vertex shaders whose purpose is to write a vertex buffer through a view. They are exactly the vertex programs where the write marking has something to mark — the other vertex programs write nothing, so the marking never runs in them, and they still validate.

Which also says something about the size of the problem and about the fix:

  • it is not 868 arbitrary vertex programs, it is one shader family, so the effect on anything the title does is bounded: those programs write their buffer through a view, and the validator refuses the module that marks the write;
  • if the answer is the second candidate (do not mark from the vertex stage), the cost is precisely the copy-back accuracy of this family — which is the thing a VfxVBuffer shader exists to produce, so it would be a bad trade for them;
  • which leaves declaring the usage as the better of the two, and the question is which declaration the validator is missing: the flags already carry RAW_BUFFERS (I checked), PSV0 cannot carry a UAV in its resource list, so it is probably the module's dx.shaderFlags needing a UAV/typed-UAV bit, or PSV0's runtime info for the vertex stage having a field that says "uses UAVs" that we leave at zero.

If someone can dump one module (VICTORY_EMIT_DUMP with view_marks: true, pick any VS_…VfxVBuffer…) and run dxc -dumpbin, the difference between its dx.shaderFlags and a compute program's is the answer. I would do it myself but pulling one container out of the archive is the part I have not solved without a CLI for it — translate --list names the offset but not the length, and I will not guess at boundaries inside a shader pack.

No game data is involved: program name prefixes and counts.

Written with an AI assistant.

**@⁠fiestorra** on GitHub · 2026-11-25 02:44 UTC · [original](https://github.com/Marvisak/VIctory/issues/1987#issuecomment-7151117005) **All 868 are `VfxVBuffer` vertex programs: the ones that write a buffer through a view** One more cut of the census that narrows this a lot. Every failing program's name contains **`VfxVBuffer`**, and nothing else does: | prefix | count | |---|---| | `VS_Transform…` | 421 | | `VS_TransformSkin…` | 398 | | `VS_TransformPreSkin…` | 26 | | `VS_PedTransformSkin…` | 12 | | `VS_PedTransformPreSkin…` | 11 | | **total** | **868**, all with `VfxVBuffer` in the name | That is the strongest confirmation of the mechanism I have without reading the emitted module: `VfxVBuffer` is the class of vertex shaders whose *purpose* is to write a vertex buffer through a view. They are exactly the vertex programs where the write marking has something to mark — the other vertex programs write nothing, so the marking never runs in them, and they still validate. Which also says something about the size of the problem and about the fix: - it is not 868 arbitrary vertex programs, it is **one shader family**, so the effect on anything the title does is bounded: those programs write their buffer through a view, and the validator refuses the module that marks the write; - if the answer is the second candidate (do not mark from the vertex stage), the cost is precisely the copy-back accuracy of *this* family — which is the thing a `VfxVBuffer` shader exists to produce, so it would be a bad trade for them; - which leaves declaring the usage as the better of the two, and the question is which declaration the validator is missing: the flags already carry `RAW_BUFFERS` (I checked), PSV0 cannot carry a UAV in its resource list, so it is probably the **module's `dx.shaderFlags` needing a UAV/typed-UAV bit**, or `PSV0`'s runtime info for the vertex stage having a field that says "uses UAVs" that we leave at zero. If someone can dump one module (`VICTORY_EMIT_DUMP` with `view_marks: true`, pick any `VS_…VfxVBuffer…`) and run `dxc -dumpbin`, the difference between its `dx.shaderFlags` and a compute program's is the answer. I would do it myself but pulling one container out of the archive is the part I have not solved without a CLI for it — `translate --list` names the offset but not the length, and I will not guess at boundaries inside a shader pack. No game data is involved: program name prefixes and counts. Written with an AI assistant.
Author
Owner

@⁠Calvix2k on GitHub · 2026-11-25 02:45 UTC · original

Correction to my comment above: I closed #1977 in favour of #1989 (BastienRodz) after Dathinel's mesh fixture showed my stage predicate still missed mesh shaders. Same two bits (flag 16 and SFI0 0x4), plus mesh, plus a test that reads the ShaderFlags word out of dx.entryPoints. The corpus numbers in this issue apply to #1989 unchanged.

fiestorra's cut fits that: all 868 are VfxVBuffer vertex programs, i.e. exactly the ones cd94d35 made declare the view-write bitmap u1, and a vertex program that declares a UAV must carry the flag.

**@⁠Calvix2k** on GitHub · 2026-11-25 02:45 UTC · [original](https://github.com/Marvisak/VIctory/issues/1987#issuecomment-7151148811) Correction to my comment above: I closed #1977 in favour of **#1989** (BastienRodz) after Dathinel's mesh fixture showed my stage predicate still missed mesh shaders. Same two bits (flag 16 and `SFI0` `0x4`), plus mesh, plus a test that reads the `ShaderFlags` word out of `dx.entryPoints`. The corpus numbers in this issue apply to #1989 unchanged. fiestorra's cut fits that: all 868 are `VfxVBuffer` vertex programs, i.e. exactly the ones `cd94d35` made declare the view-write bitmap `u1`, and a vertex program that declares a UAV must carry the flag.
Author
Owner

@⁠fiestorra on GitHub · 2026-11-25 02:46 UTC · original

I tried to pull one container out of the pack to dump its module — the offsets are pack-relative, so that is a bigger job than it looked

The next step I suggested needs one failing program's emitted module, and I tried to get it without a shader-pack parser. It did not work, and the negative result is worth writing down so the next person does not repeat it:

  • victory shader-info <pack> --verbose does print one line per container with an offset, e.g.

    shaders.rpf@0x53cca VS_Transform_VfxVBuffer_e1f01ad2_Wrapped: no parsable DXIL program, native Vs 1600 B
    

    and the next line's offset (0x54c00) looks like the end of the previous container, which is what tempted me.

  • Those are not file offsets. Reading 3,894 bytes at 0x53cca (the distance to the next line's offset) and handing them to victory translate gives containers 0: it parses nothing. The sixteen bytes at that offset are e7 dc 0d 00 7e 0c 00 00 38 0e 00 00 6d 56 09 38, a pack entry header rather than a container, and searching ±4 KB around it for DXBC finds no magic at all.

So the offset is relative to something in the pack (an entry table, or a decompressed view of it), and extracting a single container needs the victory-formats pack parser, not arithmetic on the printed numbers. That is a small tool to write, and it is not this issue — but it is the concrete blocker in front of "dump the module and read dx.shaderFlags".

What this leaves for whoever picks the fix up:

  1. the family is VfxVBuffer, all 868 of them, which is exactly the vertex programs that write a buffer through a view — so the marking runs in them and nowhere else in the vertex stage;
  2. the obvious flag is already set (memory_space_handle does flags |= RAW_BUFFERS), PSV0 cannot carry a UAV in its resource list, so the missing declaration is somewhere else — most likely in the module's dx.shaderFlags for a UAV write, or in what PSV0's runtime info says about the vertex stage;
  3. getting the dump requires the pack parser, or a build with VICTORY_EMIT_DUMP on the whole pack (26,503 files locally) and a find for the one name — which works today if someone wants to spend the disk space and the minute: that is what I would do next, and I would rather say so than claim the dump was impossible.

No game data is involved: offsets, hex headers and counts.

Written with an AI assistant.

**@⁠fiestorra** on GitHub · 2026-11-25 02:46 UTC · [original](https://github.com/Marvisak/VIctory/issues/1987#issuecomment-7151179047) **I tried to pull one container out of the pack to dump its module — the offsets are pack-relative, so that is a bigger job than it looked** The next step I suggested needs one failing program's emitted module, and I tried to get it without a shader-pack parser. It did not work, and the negative result is worth writing down so the next person does not repeat it: - `victory shader-info <pack> --verbose` does print one line per container with an offset, e.g. ``` shaders.rpf@0x53cca VS_Transform_VfxVBuffer_e1f01ad2_Wrapped: no parsable DXIL program, native Vs 1600 B ``` and the next line's offset (`0x54c00`) looks like the end of the previous container, which is what tempted me. - **Those are not file offsets.** Reading 3,894 bytes at `0x53cca` (the distance to the next line's offset) and handing them to `victory translate` gives `containers 0`: it parses nothing. The sixteen bytes at that offset are `e7 dc 0d 00 7e 0c 00 00 38 0e 00 00 6d 56 09 38`, a pack entry header rather than a container, and searching ±4 KB around it for `DXBC` finds no magic at all. So the offset is relative to something in the pack (an entry table, or a decompressed view of it), and extracting a single container needs the `victory-formats` pack parser, not arithmetic on the printed numbers. That is a small tool to write, and it is not this issue — but it is the concrete blocker in front of "dump the module and read `dx.shaderFlags`". What this leaves for whoever picks the fix up: 1. **the family is `VfxVBuffer`**, all 868 of them, which is exactly the vertex programs that write a buffer through a view — so the marking runs in them and nowhere else in the vertex stage; 2. the obvious flag is already set (`memory_space_handle` does `flags |= RAW_BUFFERS`), PSV0 cannot carry a UAV in its resource list, so the missing declaration is somewhere else — most likely in the module's `dx.shaderFlags` for a UAV write, or in what PSV0's runtime info says about the vertex stage; 3. getting the dump requires the pack parser, or a build with `VICTORY_EMIT_DUMP` on the whole pack (26,503 files locally) and a `find` for the one name — which works today if someone wants to spend the disk space and the minute: that is what I would do next, and I would rather say so than claim the dump was impossible. No game data is involved: offsets, hex headers and counts. Written with an AI assistant.
Author
Owner

@⁠fiestorra on GitHub · 2026-11-25 02:52 UTC · original

Dumped one failing module: its flags are not obviously wrong, and the resource that matters is declared — so the check is stage-sensitive

I got the module out this time, without extracting a container: VICTORY_EMIT_DUMP over the whole pack (25,573 files written locally, then deleted) and picked one VS_…VfxVBuffer… from the dump.

What the failing module declares, from dxc -dumpbin (SDK 10.0.26100):

!64 = !{i32 0, i64 1075314704}          ; entry property 0 (shader flags) = 0x40180010
!0  = !{!1, !4, !6, null}               ; dx.resources: SRVs, UAVs, CBVs
!1  = !{!2, !3}                         ; two ByteAddressBuffers (spaces 1, registers 255 and 2)
!4  = !{!5}
!5  = !{i32 0, %struct.RWByteAddressBuffer* undef, !"", i32 2, i32 1, …}  ; the marking's bitmap, space 2 register 1
!6  = !{!7}                             ; UserData at space 0 register 0

and its body does one createHandleFromBinding, four dx.op.rawBufferLoad.f32, and the marking's stores.

So:

  • the UAV the marking writes is declared in dx.resources (a RWByteAddressBuffer at space 2, register 1), so "the module does not declare the resource it uses" is not the answer either;
  • the declared flags are 0x40180010, and modules that do validate declare the same kind of values: sampling 40 passing pixel and compute modules here gives 0xc0080000 (14), 0x40000000 (6), 0xc0180000 (3), 0x40080000 (2), 0x40180000 (2), 0xc0000000 (2), 0xc0080010 (2), and three with the 0x1… atomic bits. 0x40180010 is not an outlier by itself — 0xc0080010 and 0x1c8180010 have the same bit 4 (raw buffers) set and validate.

That leaves the least comfortable conclusion, and I would rather say it than imply progress: the flags and resources of the failing vertex module look like the flags and resources of modules that validate, so the rejection is in how the validator treats those on a vertex stage — or in something I am not seeing in the module at all. There is no validating vertex shader that writes through a view to compare against, because every such vertex shader in this corpus is one of the 868.

The next thing I would do, and the reason I am stopping here: read the check itself. dxil.dll is closed, but the same check exists in the open DXC sources (DxilValidation.cpp), and searching it for "Flags must match usage" and reading which fields it compares tells the answer in a few minutes for someone who has the sources at hand — or for me next round, with git clone of DirectXShaderCompiler. Guessing at bits from the outside has cost me two rounds already and produced four negative results; the source will not.

To be explicit about what I ruled out, since each of these is a plausible-looking fix that is not one:

candidate status
the marking forgets RAW_BUFFERS no — memory_space_handle sets it, and the module shows bit 4
PSV0 cannot carry the UAV, so it must not be marked no — pixel and compute modules write UAVs with the same PSV shape and validate
the module does not declare the UAV resource no — dx.resources has the RWByteAddressBuffer at space 2 register 1
the declared flags are wrong in isolation not evident — passing modules declare the same value families

No game data is involved in this comment: flags, metadata node shapes and counts. The dump was local and has been deleted.

Written with an AI assistant.

**@⁠fiestorra** on GitHub · 2026-11-25 02:52 UTC · [original](https://github.com/Marvisak/VIctory/issues/1987#issuecomment-7151296569) **Dumped one failing module: its flags are not obviously wrong, and the resource that matters is declared — so the check is stage-sensitive** I got the module out this time, without extracting a container: `VICTORY_EMIT_DUMP` over the whole pack (25,573 files written locally, then deleted) and picked one `VS_…VfxVBuffer…` from the dump. What the failing module declares, from `dxc -dumpbin` (SDK 10.0.26100): ``` !64 = !{i32 0, i64 1075314704} ; entry property 0 (shader flags) = 0x40180010 !0 = !{!1, !4, !6, null} ; dx.resources: SRVs, UAVs, CBVs !1 = !{!2, !3} ; two ByteAddressBuffers (spaces 1, registers 255 and 2) !4 = !{!5} !5 = !{i32 0, %struct.RWByteAddressBuffer* undef, !"", i32 2, i32 1, …} ; the marking's bitmap, space 2 register 1 !6 = !{!7} ; UserData at space 0 register 0 ``` and its body does one `createHandleFromBinding`, four `dx.op.rawBufferLoad.f32`, and the marking's stores. So: - **the UAV the marking writes is declared** in `dx.resources` (a `RWByteAddressBuffer` at space 2, register 1), so "the module does not declare the resource it uses" is not the answer either; - the **declared flags are `0x40180010`**, and modules that *do* validate declare the same kind of values: sampling 40 passing pixel and compute modules here gives `0xc0080000` (14), `0x40000000` (6), `0xc0180000` (3), `0x40080000` (2), `0x40180000` (2), `0xc0000000` (2), `0xc0080010` (2), and three with the `0x1…` atomic bits. `0x40180010` is not an outlier by itself — `0xc0080010` and `0x1c8180010` have the same bit 4 (raw buffers) set and validate. That leaves the least comfortable conclusion, and I would rather say it than imply progress: **the flags and resources of the failing vertex module look like the flags and resources of modules that validate**, so the rejection is in how the validator treats those on a *vertex* stage — or in something I am not seeing in the module at all. There is no validating vertex shader that writes through a view to compare against, because every such vertex shader in this corpus is one of the 868. The next thing I would do, and the reason I am stopping here: read the check itself. `dxil.dll` is closed, but the same check exists in the open DXC sources (`DxilValidation.cpp`), and searching it for "Flags must match usage" and reading which fields it compares tells the answer in a few minutes for someone who has the sources at hand — or for me next round, with `git clone` of DirectXShaderCompiler. Guessing at bits from the outside has cost me two rounds already and produced four negative results; the source will not. To be explicit about what I ruled out, since each of these is a plausible-looking fix that is not one: | candidate | status | |---|---| | the marking forgets `RAW_BUFFERS` | no — `memory_space_handle` sets it, and the module shows bit 4 | | PSV0 cannot carry the UAV, so it must not be marked | no — pixel and compute modules write UAVs with the same PSV shape and validate | | the module does not declare the UAV resource | no — `dx.resources` has the `RWByteAddressBuffer` at space 2 register 1 | | the declared flags are wrong in isolation | not evident — passing modules declare the same value families | No game data is involved in this comment: flags, metadata node shapes and counts. The dump was local and has been deleted. Written with an AI assistant.
Author
Owner

@⁠fiestorra on GitHub · 2026-11-25 03:07 UTC · original

Fixed: the missing bit was "UAVs at every shader stage" (16) plus its feature bit (0x4), and the corpus is back to 24,785

The sentence I was missing last round was in the validator's own message, which translate was throwing away:

error: Flags must match usage. (note: Flags declared=1075314704, actual=1075380240)

actual - declared = 65536 = 1 << 16, on every one of the 868. Bit 16 of the shader flags is documented in DXIL.rst as "UAVs at every shader stage — set when a vertex, hull, domain, or geometry shader declares one or more UAVs". The write marking put a UAV into vertex programs that never had one, and the emitter never set the flag.

Declaring the flag alone is not enough: the validator then compares the container's SFI0 with the module's flags, and the next error is Container part 'Feature Info' does not match expected for module. DXC's DxilShaderFlags::GetFeatureInfo maps bit 16 to ShaderFeatureInfo_UAVsAtEveryStage = 0x0004, so that bit goes with it.

Three measured steps over the same local 1.0.2.1 archive (26,503 containers), validator SDK 10.0.26100 dxil.dll 1.9:

change Flags must match usage Feature Info validated
none (main 940d32f) 871 0 23,918
flag 16 only 0 867 23,918
flag 16 and feature 0x4 0 0 24,785

24,785 is the count the parent commit ccfb029 had, so the 868 VfxVBuffer vertex programs are back to validating and nothing else moved.

Two things came with it, because without them this would not have been findable:

  • translate --validate keeps the validator's note: line, appended to the error it already reported. The old line said "Flags must match usage" and nothing else; the note says which flag, which is the difference between four rounds of guessing and a one-line fix.
  • the flags-to-SFI0 mapping moved out of finish into feature_info, with a test that pins every bit against DXC's values (STENCIL_REF 0x200, TYPED_UAV_LOADS 0x800, UAVS_AT_EVERY_STAGE 0x4, ROVS 0x1000, WAVE_OPS 0x4000, INT64 0x8000, ATOMIC64_TYPED 0x400000, RESOURCE_HEAP 0x2000000, SAMPLER_HEAP 0x4000000, ATOMIC64_HEAP 0x10000000). That pair is what broke here, and a table is cheaper to check than a chain of ifs in a 900-line function.

Recipe: cargo test -p victory-shader --locked --lib 248 passed, 3 ignored; cargo test --workspace --locked 26 suites with the one failure main also has in a session without a desktop (lifecycle::tests::showing_a_title_window_shows_its_stand_in); clippy --workspace --all-targets with and without --all-features clean under -D warnings; rustfmt --check with the same two hunks main already has in shader.rs and no others (I reverted the two unrelated lines rustfmt wanted to reflow, so the diff carries no formatting churn).

What this does not do: it does not make the marking cheaper or change what it marks — the flag is a declaration of what the module already does. And it does not touch the 735 programs refused for "entry function performs some operation that is incompatible with the shader stage" or the 195 with "an address in an SGPR that is no root parameter"; those are separate families with their own causes.

No game data is involved: flag values, counts and error text.

Written with an AI assistant.

**@⁠fiestorra** on GitHub · 2026-11-25 03:07 UTC · [original](https://github.com/Marvisak/VIctory/issues/1987#issuecomment-7151615079) **Fixed: the missing bit was "UAVs at every shader stage" (16) plus its feature bit (0x4), and the corpus is back to 24,785** The sentence I was missing last round was in the validator's own message, which `translate` was throwing away: ``` error: Flags must match usage. (note: Flags declared=1075314704, actual=1075380240) ``` `actual - declared = 65536 = 1 << 16`, on every one of the 868. Bit 16 of the shader flags is documented in `DXIL.rst` as **"UAVs at every shader stage — set when a vertex, hull, domain, or geometry shader declares one or more UAVs"**. The write marking put a UAV into vertex programs that never had one, and the emitter never set the flag. Declaring the flag alone is not enough: the validator then compares the container's `SFI0` with the module's flags, and the next error is `Container part 'Feature Info' does not match expected for module`. DXC's `DxilShaderFlags::GetFeatureInfo` maps bit 16 to `ShaderFeatureInfo_UAVsAtEveryStage = 0x0004`, so that bit goes with it. Three measured steps over the same local 1.0.2.1 archive (26,503 containers), validator SDK 10.0.26100 `dxil.dll` 1.9: | change | `Flags must match usage` | `Feature Info` | validated | |---|---|---|---| | none (`main` `940d32f`) | 871 | 0 | 23,918 | | flag 16 only | 0 | 867 | 23,918 | | flag 16 and feature `0x4` | **0** | **0** | **24,785** | 24,785 is the count the parent commit `ccfb029` had, so the 868 `VfxVBuffer` vertex programs are back to validating and nothing else moved. **Two things came with it**, because without them this would not have been findable: - `translate --validate` keeps the validator's `note:` line, appended to the error it already reported. The old line said "Flags must match usage" and nothing else; the note says *which* flag, which is the difference between four rounds of guessing and a one-line fix. - the flags-to-`SFI0` mapping moved out of `finish` into `feature_info`, with a test that pins every bit against DXC's values (`STENCIL_REF` 0x200, `TYPED_UAV_LOADS` 0x800, `UAVS_AT_EVERY_STAGE` 0x4, `ROVS` 0x1000, `WAVE_OPS` 0x4000, `INT64` 0x8000, `ATOMIC64_TYPED` 0x400000, `RESOURCE_HEAP` 0x2000000, `SAMPLER_HEAP` 0x4000000, `ATOMIC64_HEAP` 0x10000000). That pair is what broke here, and a table is cheaper to check than a chain of `if`s in a 900-line function. Recipe: `cargo test -p victory-shader --locked --lib` 248 passed, 3 ignored; `cargo test --workspace --locked` 26 suites with the one failure `main` also has in a session without a desktop (`lifecycle::tests::showing_a_title_window_shows_its_stand_in`); `clippy --workspace --all-targets` with and without `--all-features` clean under `-D warnings`; `rustfmt --check` with the same two hunks `main` already has in `shader.rs` and no others (I reverted the two unrelated lines rustfmt wanted to reflow, so the diff carries no formatting churn). What this does **not** do: it does not make the marking cheaper or change what it marks — the flag is a declaration of what the module already does. And it does not touch the 735 programs refused for "entry function performs some operation that is incompatible with the shader stage" or the 195 with "an address in an SGPR that is no root parameter"; those are separate families with their own causes. No game data is involved: flag values, counts and error text. Written with an AI assistant.
Author
Owner

@⁠fiestorra on GitHub · 2026-11-25 03:29 UTC · original

A compute shader has no derivatives to sample with: 735 programs, all Cs, all refused for it — and sampleLevel at level 0 fixes them

The next class after #1987, and this time the reason was in the run I had already made: the validator's note: line said

Function: main: error: Entry function performs some operation that is incompatible with the shader stage or other entry properties.
Function: main: error: Function uses features incompatible with the shader stage (cs) of the entry function.

735 programs, every one of them a compute shader (735 x Cs, no other stage). I dumped three of them (VICTORY_EMIT_DUMP) and disassembled with dxc -dumpbin:

billboard_nobump:CS_RaytracingResolve_a56bfb9c_Wrapped   Cs   threads (32,1,1), wave 32
  dx.op.sample (implicit)   3
  dx.op.sampleLevel       129
  dx.op.sampleCmpLevelZero  +
cloth_default:CS_RaytracingResolve_b1139868_Wrapped      Cs   threads (32,1,1)
  dx.op.sample (implicit)   3
  dx.op.sampleLevel       130

Three implicit dx.op.sample next to hundreds of explicit ones, in a stage that has no neighbours to take derivatives from. dx.op.sample is not a legal operation for cs — no shader model makes it one without the mesh/amplification derivatives feature — and the console's image_sample in that stage has no derivatives either: level 0 is what the instruction means there.

So the lowering now asks the stage: a compute program samples at level 0 with sampleLevel (62) and keeps sample (60) everywhere the implicit form is legal. The choice is sample_op(compute), and the test pins the pair.

Measured on the offline census over the same local 1.0.2.1 archive (26,503 containers), validator SDK 10.0.26100 dxil.dll 1.9:

build incompatible with the shader stage validated
main 940d32f 735 23,918
this branch 0 24,653
this branch + #2016 0 25,520

25,520 is 1,602 more programs than main: the 868 vertex programs of #1987 and these 735, minus the one that was in both classes.

One caveat worth stating, because it is the difference between "valid" and "right": the console program samples with whatever filter and coordinate the shader computed, and level 0 is the honest reading of "implicit level in a stage with no derivatives". If a title's compute shader relied on something else — a derivative register the console keeps per lane — this would change what it samples. That is worth a picture comparison on the raytracing resolve passes, which are the ones in this class, and I have not run the title to look at them.

Recipe: cargo test -p victory-shader --locked --lib 249 passed, 3 ignored; cargo test --workspace --locked 26 suites with the one failure main also has in a session without a desktop; clippy --workspace --all-targets with and without --all-features clean under -D warnings; rustfmt --check with the same 19 hunks main already has in lower.rs and no others.

No game data is involved: program names, counts, operation names and thread-group sizes.

Written with an AI assistant.

**@⁠fiestorra** on GitHub · 2026-11-25 03:29 UTC · [original](https://github.com/Marvisak/VIctory/issues/1987#issuecomment-7151957173) **A compute shader has no derivatives to sample with: 735 programs, all `Cs`, all refused for it — and `sampleLevel` at level 0 fixes them** The next class after #1987, and this time the reason was in the run I had already made: the validator's `note:` line said ``` Function: main: error: Entry function performs some operation that is incompatible with the shader stage or other entry properties. Function: main: error: Function uses features incompatible with the shader stage (cs) of the entry function. ``` 735 programs, **every one of them a compute shader** (`735 x Cs`, no other stage). I dumped three of them (`VICTORY_EMIT_DUMP`) and disassembled with `dxc -dumpbin`: ``` billboard_nobump:CS_RaytracingResolve_a56bfb9c_Wrapped Cs threads (32,1,1), wave 32 dx.op.sample (implicit) 3 dx.op.sampleLevel 129 dx.op.sampleCmpLevelZero + cloth_default:CS_RaytracingResolve_b1139868_Wrapped Cs threads (32,1,1) dx.op.sample (implicit) 3 dx.op.sampleLevel 130 ``` Three implicit `dx.op.sample` next to hundreds of explicit ones, in a stage that has no neighbours to take derivatives from. `dx.op.sample` is not a legal operation for `cs` — no shader model makes it one without the mesh/amplification derivatives feature — and the console's `image_sample` in that stage has no derivatives either: level 0 is what the instruction means there. So the lowering now asks the stage: a compute program samples at level 0 with `sampleLevel` (62) and keeps `sample` (60) everywhere the implicit form is legal. The choice is `sample_op(compute)`, and the test pins the pair. Measured on the offline census over the same local 1.0.2.1 archive (26,503 containers), validator SDK 10.0.26100 `dxil.dll` 1.9: | build | `incompatible with the shader stage` | validated | |---|---|---| | `main` `940d32f` | 735 | 23,918 | | this branch | **0** | **24,653** | | this branch + #2016 | **0** | **25,520** | 25,520 is 1,602 more programs than `main`: the 868 vertex programs of #1987 and these 735, minus the one that was in both classes. One caveat worth stating, because it is the difference between "valid" and "right": the console program samples with whatever filter and coordinate the shader computed, and level 0 is the honest reading of "implicit level in a stage with no derivatives". If a title's compute shader relied on something else — a derivative register the console keeps per lane — this would change what it samples. That is worth a picture comparison on the raytracing resolve passes, which are the ones in this class, and I have not run the title to look at them. Recipe: `cargo test -p victory-shader --locked --lib` **249 passed, 3 ignored**; `cargo test --workspace --locked` 26 suites with the one failure `main` also has in a session without a desktop; `clippy --workspace --all-targets` with and without `--all-features` clean under `-D warnings`; `rustfmt --check` with the same 19 hunks `main` already has in `lower.rs` and no others. No game data is involved: program names, counts, operation names and thread-group sizes. Written with an AI assistant.
Author
Owner

@⁠fiestorra on GitHub · 2026-11-25 03:39 UTC · original

Checked the addition by merging everything: 23,918 → 25,520 validated, and what is left

I claimed in #2027 that the two shader fixes add up to 25,520 from 23,918. Rather than trust the arithmetic, I merged all sixteen of my open branches onto main 940d32f at once and ran the census on the result (same archive, same 26,503 containers, same validator, SDK 10.0.26100 dxil.dll 1.9):

validated 25,520   (main: 23,918)

So the arithmetic holds: +1,602, and the other fourteen pull requests change nothing here because they are in the GPU, CLI and HLE crates rather than the translator — which is what they should do.

Two of my own branches do conflict with each other when stacked, and it is worth knowing before someone merges in a hurry:

  • #1767 and #2016, both in apps/victory/src/translate.rs, on the same Err(text) arm: #2016 appends the validator's note: line inline, #1767 has validator_reason(&text) as a helper. The resolution is obvious (the note belongs inside the helper) but it is a resolution, not a fast-forward;
  • #1731 and #1630, both appending tests at the end of crates/victory-gpu/src/resource.rs.

That is normal for work in the same corner and does not affect mergeability against main — every branch is MERGEABLE/CLEAN on its own — but if the maintainer merges one and then the other, the second needs the rebase. I would rather say which two than let it be discovered at merge time.

What is left in the census, in order, and none of it is a one-bit fix like the last two:

count class what it needs
195 resources: an address in an SGPR that is no root parameter a memory address computed in an SGPR that does not come from a root parameter; the translator tracks addresses by their root parameter, so this is address resolution for computed bases, not a flag
71 vertex plus primitive output size is greater than 32768 mesh shaders whose output signature is bigger than DXIL allows; either the signature is being emitted wrong or the title's mesh programs are being asked for as mesh when they should be something else
40 emit: a register joining a lane mask and data, read as data a register the compiler reuses for a mask on one path and data on another, read as data — a corner of the structurisation
36 emit: a descriptor read only as data the same shape for descriptors

None of those four has a one-line answer, which is why I stopped at the two that did and would rather leave the analysis above than start a third and leave it half-done.

No game data is involved: counts and message text.

Written with an AI assistant.

**@⁠fiestorra** on GitHub · 2026-11-25 03:39 UTC · [original](https://github.com/Marvisak/VIctory/issues/1987#issuecomment-7152125948) **Checked the addition by merging everything: 23,918 → 25,520 validated, and what is left** I claimed in #2027 that the two shader fixes add up to 25,520 from 23,918. Rather than trust the arithmetic, I merged **all sixteen of my open branches** onto `main` `940d32f` at once and ran the census on the result (same archive, same 26,503 containers, same validator, SDK 10.0.26100 `dxil.dll` 1.9): ``` validated 25,520 (main: 23,918) ``` So the arithmetic holds: +1,602, and the other fourteen pull requests change nothing here because they are in the GPU, CLI and HLE crates rather than the translator — which is what they should do. Two of my own branches do conflict **with each other** when stacked, and it is worth knowing before someone merges in a hurry: - **#1767 and #2016**, both in `apps/victory/src/translate.rs`, on the same `Err(text)` arm: #2016 appends the validator's `note:` line inline, #1767 has `validator_reason(&text)` as a helper. The resolution is obvious (the note belongs inside the helper) but it is a resolution, not a fast-forward; - **#1731 and #1630**, both appending tests at the end of `crates/victory-gpu/src/resource.rs`. That is normal for work in the same corner and does not affect mergeability against `main` — every branch is `MERGEABLE`/`CLEAN` on its own — but if the maintainer merges one and then the other, the second needs the rebase. I would rather say which two than let it be discovered at merge time. **What is left in the census**, in order, and none of it is a one-bit fix like the last two: | count | class | what it needs | |---|---|---| | 195 | `resources: an address in an SGPR that is no root parameter` | a memory address computed in an SGPR that does not come from a root parameter; the translator tracks addresses by their root parameter, so this is address resolution for computed bases, not a flag | | 71 | `vertex plus primitive output size is greater than 32768` | mesh shaders whose output signature is bigger than DXIL allows; either the signature is being emitted wrong or the title's mesh programs are being asked for as mesh when they should be something else | | 40 | `emit: a register joining a lane mask and data, read as data` | a register the compiler reuses for a mask on one path and data on another, read as data — a corner of the structurisation | | 36 | `emit: a descriptor read only as data` | the same shape for descriptors | None of those four has a one-line answer, which is why I stopped at the two that did and would rather leave the analysis above than start a third and leave it half-done. No game data is involved: counts and message text. Written with an AI assistant.
Author
Owner

@⁠reboot0000-cmd on GitHub · 2026-11-25 06:13 UTC · original

Independent confirmation of cd94d35, plus the half that neither this issue nor #1973 states, which decides which of the three candidate fixes is actually complete.

Bisect. Done the same way on this machine against a 400-container unpacked slice of shaders.rpf (the archive holds no raw DXBC — every container is a compressed SGD5 record, so a byte slice cannot work; a carved corpus makes a bisect step ~50 s instead of ~10 min). Nine steps, one answer: first bad cd94d35, parent ccfb0299 clean. Full-archive before/after on 940d32f: VS+PS 13,338 → 14,205 validated (+867, class absent), compute 1,886 / 2,621 and mesh 8,694 / 8,765 unchanged, every other tally line identical.

Why the fix has to be in two places, measured. Our module carries dx.valver = {1, 6}, which selects DXC's validator-1.6 branch: it compares the entry-point shader-flags property against module usage and ignores SFI0. That was proven by sweeping SFI0 on one failing container — 0x0, all-ones, and every single bit — the validator note came back byte-identical each time (Flags declared=0x40100010, actual=0x40110010, i.e. used-but-undeclared bit 16, "UAVs at every shader stage"). And setting bit 16 in the entry property without SFI0 0x4 does not pass either: the error moves to Container part 'Feature Info' does not match expected for module. So flag-only and SFI0-only are both wrong; a reviewer comparing #1977 / #1989 / #2016 should check for both halves, which all three appear to include (#2016's port of GetFeatureInfo is the more general way to get this right, since the same trap will recur for other feature bits).

Also worth recording, because it changes what "fixed" means here: the driver is not the blocker for these 867. A full translate --validate --pipelines on 940d32f6 (RTX 4090, Agility 1.614.1 via #463, DXC 1.8 validator, 43 min, no device removal) created 2,191 of 2,191 vertex pipelines and 12,014 of 12,014 pixel pipelines — all 867 ran despite failing validation. The only creation-stage failures in the entire run were 394 compute programs, 382 of which do pass validation. Details on #1247.

One cross-thread correction relevant to the tables in both issues: this box's default_path validator reports FileVersion 1.8.2502 but is DXC 1.7.2308 (101.7.2308.24), which false-rejects ~15k modules on the PSV0 string-table comparison — see #1945. Measuring "validated" totals with that engine and comparing them to totals from a 1.8/1.9 engine will not reconcile. Counts and offsets only, no title data.

**@⁠reboot0000-cmd** on GitHub · 2026-11-25 06:13 UTC · [original](https://github.com/Marvisak/VIctory/issues/1987#issuecomment-7154566585) Independent confirmation of `cd94d35`, plus the half that neither this issue nor #1973 states, which decides which of the three candidate fixes is actually complete. **Bisect.** Done the same way on this machine against a 400-container unpacked slice of `shaders.rpf` (the archive holds no raw `DXBC` — every container is a compressed SGD5 record, so a byte slice cannot work; a carved corpus makes a bisect step ~50 s instead of ~10 min). Nine steps, one answer: first bad `cd94d35`, parent `ccfb0299` clean. Full-archive before/after on `940d32f`: VS+PS **13,338 → 14,205** validated (+867, class absent), compute **1,886 / 2,621** and mesh **8,694 / 8,765** unchanged, every other tally line identical. **Why the fix has to be in two places, measured.** Our module carries `dx.valver = {1, 6}`, which selects DXC's validator-1.6 branch: it compares the *entry-point shader-flags property* against module usage and **ignores `SFI0`**. That was proven by sweeping `SFI0` on one failing container — 0x0, all-ones, and every single bit — the validator note came back byte-identical each time (`Flags declared=0x40100010, actual=0x40110010`, i.e. used-but-undeclared bit 16, "UAVs at every shader stage"). And setting bit 16 in the entry property *without* `SFI0 0x4` does not pass either: the error moves to `Container part 'Feature Info' does not match expected for module`. So flag-only and SFI0-only are both wrong; a reviewer comparing #1977 / #1989 / #2016 should check for both halves, which all three appear to include (#2016's port of `GetFeatureInfo` is the more general way to get this right, since the same trap will recur for other feature bits). **Also worth recording, because it changes what "fixed" means here:** the driver is not the blocker for these 867. A full `translate --validate --pipelines` on `940d32f6` (RTX 4090, Agility 1.614.1 via #463, DXC 1.8 validator, 43 min, no device removal) created **2,191 of 2,191 vertex pipelines and 12,014 of 12,014 pixel pipelines** — all 867 ran despite failing validation. The only creation-stage failures in the entire run were 394 compute programs, 382 of which *do* pass validation. Details on #1247. **One cross-thread correction relevant to the tables in both issues:** this box's `default_path` validator reports `FileVersion 1.8.2502` but is DXC **1.7.2308** (`101.7.2308.24`), which false-rejects ~15k modules on the PSV0 string-table comparison — see #1945. Measuring "validated" totals with that engine and comparing them to totals from a 1.8/1.9 engine will not reconcile. Counts and offsets only, no title data.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 12:46 UTC · original · edited 2026-11-25 21:45 UTC

Automated triage for the maintainers.

Thanks for the bisect and the flag analysis. This is the same defect as #1973, and it is fixed in main by a1a2077 ("Shaders: vertex, geometry and mesh programs with UAVs say so in their flags"). In crates/victory-shader/src/emit/shader.rs, Shader::finish sets flags::UAVS_EVERY_STAGE (bit 16) and the SFI0 bit 0x4 for any vertex, geometry or mesh program that declares a UAV range (root UAVs, the memory bitmap, the view-write bitmap). That is the pair your note line (declared=…, actual=…, a difference of 1 << 16) pointed to.

Independently confirmed since the last triage: an offline census on 67e8ae1 (which contains a1a2077) has Flags must match usage at 0 (867 on 940d32f), with every emitted vertex and pixel program validating (14,242 of 14,242).

#2016 is superseded by this commit except for its note: line in translate --validate, which could be offered on its own. The 735 compute programs refused for implicit sampling are a separate change (#2027) and not part of this issue.

Proposed close as fixed in main (a1a2077), the same as #1973. This issue will be closed in 48 hours unless the reporter replies or a maintainer removes the triage: proposed close label.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 12:46 UTC · [original](https://github.com/Marvisak/VIctory/issues/1987#issuecomment-7162845450) · edited 2026-11-25 21:45 UTC <!-- victory-issue-triage v1 verdict=proposed-close seen=2026-11-25T19:53:04Z at=2026-11-25T21:58:00Z --> Automated triage for the maintainers. Thanks for the bisect and the flag analysis. This is the same defect as #1973, and it is fixed in `main` by a1a2077 ("Shaders: vertex, geometry and mesh programs with UAVs say so in their flags"). In `crates/victory-shader/src/emit/shader.rs`, `Shader::finish` sets `flags::UAVS_EVERY_STAGE` (bit 16) and the `SFI0` bit `0x4` for any vertex, geometry or mesh program that declares a UAV range (root UAVs, the memory bitmap, the view-write bitmap). That is the pair your note line (`declared=…, actual=…`, a difference of `1 << 16`) pointed to. Independently confirmed since the last triage: an offline census on `67e8ae1` (which contains a1a2077) has `Flags must match usage` at 0 (867 on `940d32f`), with every emitted vertex and pixel program validating (14,242 of 14,242). #2016 is superseded by this commit except for its `note:` line in `translate --validate`, which could be offered on its own. The 735 compute programs refused for implicit sampling are a separate change (#2027) and not part of this issue. Proposed close as fixed in `main` (a1a2077), the same as #1973. This issue will be closed in 48 hours unless the reporter replies or a maintainer removes the `triage: proposed close` label. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠BaggyALPHA on GitHub · 2026-11-25 19:53 UTC · original

Corpus confirmation that a1a2077 closed this: Flags must match usage is 867 → 0, and every emitted vertex and pixel program now validates.

@⁠BastienRodz asked on #1989 for offline translate reruns; here are two on the same archive and validator, before and after the fix landed on main.

Offline translate <archive> --list --validate --jobs 6, title 1.0.2.1's shader archive, official DXC archive dxil.dll (1.8) rather than the installed SDK engine, release build, Windows 11 26300.

Flags must match usage vertex/pixel validated total validated
main 940d32f (before) 867 13,338 of 14,205 emitted 23,918
main 67e8ae1 (with a1a2077) 0 14,242 of 14,242 emitted 24,846

The 23,918 is the same number this issue's title reports for the regressed state, measured independently here, which is a good sign the two censuses are comparable. The after figure is above the 24,785 quoted as the pre-regression baseline, because other commits in the same 82 also raised emission by 74 programs.

Nothing from the game: counts, validator strings and commit ids. Full per-reason tables for both runs are on #1481.

AI-assisted (Claude Code); figures are from the two runs described.

**@⁠BaggyALPHA** on GitHub · 2026-11-25 19:53 UTC · [original](https://github.com/Marvisak/VIctory/issues/1987#issuecomment-7172894897) **Corpus confirmation that `a1a2077` closed this: `Flags must match usage` is 867 → 0, and every emitted vertex and pixel program now validates.** @⁠BastienRodz asked on #1989 for offline `translate` reruns; here are two on the same archive and validator, before and after the fix landed on `main`. Offline `translate <archive> --list --validate --jobs 6`, title 1.0.2.1's shader archive, official DXC archive `dxil.dll` (1.8) rather than the installed SDK engine, release build, Windows 11 26300. | | `Flags must match usage` | vertex/pixel validated | total validated | |---|---:|---:|---:| | `main` `940d32f` (before) | **867** | 13,338 of 14,205 emitted | 23,918 | | `main` `67e8ae1` (with `a1a2077`) | **0** | **14,242 of 14,242 emitted** | 24,846 | The 23,918 is the same number this issue's title reports for the regressed state, measured independently here, which is a good sign the two censuses are comparable. The after figure is above the 24,785 quoted as the pre-regression baseline, because other commits in the same 82 also raised emission by 74 programs. Nothing from the game: counts, validator strings and commit ids. Full per-reason tables for both runs are [on #1481](https://git.gtahub.st/github/Marvisak--VIctory/issues/1481). AI-assisted (Claude Code); figures are from the two runs described.
This discussion has been locked. Commenting is limited to contributors.
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#1987
No description provided.