Repository navigation
Conversation
… SFI0
The write marking added on 2026-11-25 puts a UAV into programs that never had
one, and the validator recomputes the shader flags from what a module
declares: a vertex shader holding a UAV must carry ShaderFlags bit 16
("UAVs at every shader stage", DXIL.rst) or it is refused with "Flags must
match usage". Declaring the module flag is not enough on its own - the
feature part has to agree, or the next error is "Container part 'Feature
Info' does not match expected for module" - so the SFI0 bit 0x4
(ShaderFeatureInfo_UAVsAtEveryStage) goes with it.
The flags-to-feature mapping moves out of `finish` into `feature_info`, which
is what makes the pair testable, and a test pins every bit against DXC's
values.
Measured on the offline census over a local 1.0.2.1 shader archive (26,503
containers), validator = SDK 10.0.26100 dxil.dll 1.9:
before Flags must match usage 871, validated 23,918
flags Feature Info instead of it 867, validated 23,918
both neither 0, validated 24,785
i.e. the 868 VfxVBuffer vertex programs that cd94d35 cost (Marvisak#1987) validate
again, and the corpus is back to the parent commit's count.
`translate --validate` also keeps the validator's `note:` line now, because
"Flags must match usage" comes with "note: Flags declared=..., actual=..."
and that pair is what identifies the missing bit; without it the reason was
one line that said nothing about which flag.
|
I reproduced the flags mismatch with a small synthetic vertex shader on native Linux, independently of the title corpus. I supplied an At I checked eight combinations in total: vertex/compute × with/without the buffer store × write marking on/off. The other seven containers were byte-for-byte identical between revisions and passed |
|
Ran on Windows 11 with an RTX 3070 (Ampere, driver 616.56), debug build, at AI-assisted (Claude Code). |
|
I compared this head (
The three new cases are emitter tests. Starting from the copy-through vertex shader and rectangle geometry shader in Changing only the predicate in this branch to #1989's stage and binding conditions made all nine emitter cases and all six cases of the earlier stage fixture validate. The missing conditions are geometry/mesh stages and the These are validator results for synthetic shaders. They do not measure how often these cases occur in a title. AI-assisted. |
`dx.op.sample` takes derivatives, and a compute shader has none: the validator refuses the module with "Function uses features incompatible with the shader stage (cs) of the entry function". Measured on the offline census over a local 1.0.2.1 shader archive (26,503 containers), validator SDK 10.0.26100 dxil.dll 1.9, the class is 735 programs, every one of them a compute shader, and the ones dumped all carry three uses of the implicit `sample` next to hundreds of explicit `sampleLevel`: billboard_nobump:CS_RaytracingResolve_a56bfb9c_Wrapped Cs cloth_default:CS_RaytracingResolve_b1139868_Wrapped Cs threads (32,1,1), wave 32, no shader flags declared The console's `image_sample` in that stage has no derivatives to take either, so level 0 is what it means; emitting `sampleLevel` with 0 keeps the meaning and makes the module valid. Census before and after, same archive, same validator: before incompatibles 735, validated 23,918 after incompatibles 0, validated 24,653 stacked on Marvisak#2016 (the vertex UAV flags): 25,520 validated, from 23,918 on main. The choice of operation is `sample_op`, which is also what the test pins: `("sampleLevel.f32", 62)` for a compute stage, `("sample.f32", 60)` elsewhere.
|
A full-corpus run, so reviewers can compare this with #1989, which fixes the same regression (#1987). Offline
The same counts and the same remaining refusals (735 compute, 71 mesh) as #1989. On this corpus the two are interchangeable; the difference is in the code (stage predicate, mesh handling, tests). AI use: Claude Code (Claude Opus 5.5) ran the builds and wrote this; counts only, no game data. |
|
Two things before this lands, because there are now two open PRs for the same bit (#1989 and this one): 1. Mesh shaders are still missed. Your condition keeps
2. The Corpus confirmation from this machine, for the body: |
catminou4
left a comment
There was a problem hiding this comment.
Tested locally: macOS arm64, rustc 1.98.1, PR head merged into main 940d32f, cargo test -p victory-shader --locked.
145 passed / 0 failed / 2 ignored. Vertex shader declaring a UAV says so in flags and SFI0 (+1 test) — mixed apps+shader PR; shader half verified here, apps half Windows-only.
DenRakEiw
left a comment
There was a problem hiding this comment.
Verified locally merged onto origin/main (940d32f, Windows 11 x64, Rust 1.98.1 MSVC):
cargo test -p victory-shader --lib emit::shader::— 1 passed, 0 failed (the_feature_bits_follow_the_shader_flags)cargo clippy -p victory-shader -p victory --all-targets— 0 warningscargo xtask policy— ok (183 files ok)
Clean fix setting the UAV shader flags and SFI0 feature info bits for vertex shaders declaring UAVs (fixing #1987 / 867 vertex programs). Looks great.
AI-assisted (Gemini 4 Neon).
`dx.op.sample` takes derivatives, and a compute shader has none: the validator refuses the module with "Function uses features incompatible with the shader stage (cs) of the entry function". Measured on the offline census over a local 1.0.2.1 shader archive (26,503 containers), validator SDK 10.0.26100 dxil.dll 1.9, the class is 735 programs, every one of them a compute shader, and the ones dumped all carry three uses of the implicit `sample` next to hundreds of explicit `sampleLevel`: billboard_nobump:CS_RaytracingResolve_a56bfb9c_Wrapped Cs cloth_default:CS_RaytracingResolve_b1139868_Wrapped Cs threads (32,1,1), wave 32, no shader flags declared The console's `image_sample` in that stage has no derivatives to take either, so level 0 is what it means; emitting `sampleLevel` with 0 keeps the meaning and makes the module valid. Census before and after, same archive, same validator: before incompatibles 735, validated 23,918 after incompatibles 0, validated 24,653 stacked on Marvisak#2016 (the vertex UAV flags): 25,520 validated, from 23,918 on main. The choice of operation is `sample_op`, which is also what the test pins: `("sampleLevel.f32", 62)` for a compute stage, `("sample.f32", 60)` elsewhere.
… SFI0
The write marking added on 2026-11-25 puts a UAV into programs that never had
one, and the validator recomputes the shader flags from what a module
declares: a vertex shader holding a UAV must carry ShaderFlags bit 16
("UAVs at every shader stage", DXIL.rst) or it is refused with "Flags must
match usage". Declaring the module flag is not enough on its own - the
feature part has to agree, or the next error is "Container part 'Feature
Info' does not match expected for module" - so the SFI0 bit 0x4
(ShaderFeatureInfo_UAVsAtEveryStage) goes with it.
The flags-to-feature mapping moves out of `finish` into `feature_info`, which
is what makes the pair testable, and a test pins every bit against DXC's
values.
Measured on the offline census over a local 1.0.2.1 shader archive (26,503
containers), validator = SDK 10.0.26100 dxil.dll 1.9:
before Flags must match usage 871, validated 23,918
flags Feature Info instead of it 867, validated 23,918
both neither 0, validated 24,785
i.e. the 868 VfxVBuffer vertex programs that cd94d35 cost (Marvisak#1987) validate
again, and the corpus is back to the parent commit's count.
The reporting side of that fix (keeping the validator's `note:` line) is
Marvisak#1767's, which is where it belongs: this change is only what the modules
declare.
|
Trimmed back to the fix itself: the note handling moved to #1767, and the queue is conflict-free This pull request no longer touches So what is left here is only what the modules declare: the shader flags for a vertex program that holds a UAV, the The point of trimming it: keeping the note here as well made #1767 and this conflict in Re-checked after the change: No game data is involved: flag values, counts and file names. Written with an AI assistant. |
|
The trimmed head still has
Not blocking the nicer |
|
Automated triage for the maintainers. This duplicates open PR #1989, which fixes the same regression (#1987) more completely and merges cleanly. Both set The This PR will be closed in 48 hours unless the author pushes a change or a maintainer removes the label. CI: passing ( Generated by Claude Code |
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
translatewas throwing away:actual - declared = 65536 = 1 << 16, on every one of the 868. Bit 16 of the shader flags is documented inDXIL.rstas "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
SFI0with the module's flags, and the next error isContainer part 'Feature Info' does not match expected for module. DXC'sDxilShaderFlags::GetFeatureInfomaps bit 16 toShaderFeatureInfo_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.dll1.9:Flags must match usageFeature Infomain940d32f)0x424,785 is the count the parent commit
ccfb029had, so the 868VfxVBuffervertex programs are back to validating and nothing else moved.Two things came with it, because without them this would not have been findable:
translate --validatekeeps the validator'snote: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.SFI0mapping moved out offinishintofeature_info, with a test that pins every bit against DXC's values (STENCIL_REF0x200,TYPED_UAV_LOADS0x800,UAVS_AT_EVERY_STAGE0x4,ROVS0x1000,WAVE_OPS0x4000,INT640x8000,ATOMIC64_TYPED0x400000,RESOURCE_HEAP0x2000000,SAMPLER_HEAP0x4000000,ATOMIC64_HEAP0x10000000). That pair is what broke here, and a table is cheaper to check than a chain ofifs in a 900-line function.Recipe:
cargo test -p victory-shader --locked --lib248 passed, 3 ignored;cargo test --workspace --locked26 suites with the one failuremainalso has in a session without a desktop (lifecycle::tests::showing_a_title_window_shows_its_stand_in);clippy --workspace --all-targetswith and without--all-featuresclean under-D warnings;rustfmt --checkwith the same two hunksmainalready has inshader.rsand 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.