Repository navigation
Conversation
A translated mesh shader declared the console's vertex and primitive
maxima (up to 256 each) whatever its outputs took, so wide outputs at
those maxima passed the 32 KiB that D3D12 allows a mesh shader and the
validator refused the module ("vertex plus primitive output size is
greater than 32768").
The prologue now measures the outputs as the validator does (4 bytes
per component of every vertex and primitive signature element, times
the maxima rounded up to 32). Past the cap, the maxima come down to the
lane count: lane n writes only vertex n and primitive n, so no group
writes more. Outputs that pass the cap even at the lane count are still
emitted as before, with the lower maxima, so no draw that works today is
dropped.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Verified Not covered: DispatchMesh on a real host device (no game data or Windows GPU run here) and the interaction with the game's mesh pipelines. |
|
Native DispatchMesh check for
The local test ran with |
|
Tested on Windows 11 + retail Tested
Not tested: Live GPU / WARP runtime execution. AI use: Antigravity ( |
|
I measured #459 on the full 26,503-container corpus (A/B: Reason, from one failing module ( So the programs in this group are the ones where the lanes already reach the maximum; lowering the maxima to the lane count cannot reduce them. To clear them the maxima would have to go below the lane count, with the prologue culling lanes whose vertex/primitive index exceeds the new maximum (and their exports), or the output rows reduced. I haven't checked whether either is safe for these programs — just reporting that the current rule does not touch them. AI-assisted (Claude Code). I ran the census on Windows 10, RTX 4080; no game data beyond shader hashes. |
|
Data point, offline against main With this PR, the 53 mesh modules rejected with After #306, these 53 are the only validator rejections left on this corpus (see my comment on #306). |
… lane count past 32 KiB) AnoHunted's Marvisak#459: a mesh shader whose declared vertex and primitive maxima take more than D3D12's 32 KiB of outputs declares the lane count instead, where that is lower. No textual conflict. Mechanical, crates/victory-shader/src/emit/mod.rs: git placed Marvisak#459's three test items at the end of the file, inside `atomic_tests` (Marvisak#48's module, which is last in this tree); they are moved to the end of `tests`, where Marvisak#459 has them, and its `emit` call passes `Target::ANY` (Marvisak#223's argument). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Seven more upstream PRs are in (Marvisak#493, Marvisak#483, Marvisak#206, Marvisak#469, Marvisak#459, Marvisak#454, Marvisak#579) and the wave64 stack is at Marvisak#439's head 965ce30. Records how each was combined with what the tree had, that a capped view heap keeps 2^18 dynamic slots and why, Marvisak#189 and Marvisak#578 as left out, and a new section with testers' reports from the title: the set without the world-entry hang on three NVIDIA cards and how this tree differs from it, VICTORY_SKIP_WAVE64 as the switch to try, and Marvisak#136 bisected as making every frame black. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Measured on the full retail shader pack (26,503 containers) with With this PR the 53 mesh programs refused with "vertex plus primitive output size is greater than 32768" are still all refused (VS/PS 12172, CS 1670, MS 8129 validated, same as main). So on the real pack the lowered maxima do not bring them under 32 KiB, or the path is not taken for them: they may all be in the "still past 32 KiB at the lane count" |
…rol flow; waterfall loops proven) Marvisak#566 is stacked on Marvisak#307, which this tree holds as its first two commits (the tree's resource.rs was identical to ffa6635's). The merge so also brings Marvisak#307's last two commits, 077ec8b and 6285e19. Git found upstream main as the base, which sets Marvisak#307's own lines against themselves; each file was merged with ffa6635 as the base instead. - crates/victory-shader/src/resource.rs: Marvisak#566's, unchanged (the tree had no edits of its own there). - crates/victory-shader/src/emit/lower.rs: no conflict on that base. The tree's lowering is kept (Marvisak#307's waterfall arm of v_readfirstlane before the console-flow form, fetched_index through Marvisak#483's heap guard), with Marvisak#566's Source::LanePhi arms and tests. lane_heap_index joins the indices heap_index and fetched_index return, so each is already guarded. Marvisak#226's annotation test passes the per-lane form to track. - crates/victory-shader/src/structure.rs: both sides' additions kept: MAX_MEMO (Marvisak#288) with MAX_MEET, and in Structured the wave64 stack's execs, others and pairs with Marvisak#566's reach and paired_masks. paired_masks is filled last, since it takes the masks pairs reads. - crates/victory-shader/src/emit/mod.rs: translate keeps Marvisak#309's spill forwarding and Marvisak#223's target, structures first and passes the per-lane form to track as Marvisak#566 does. The threading retry of emit passes its own. The tests' helpers (Marvisak#223's, Marvisak#306's, Marvisak#459's, Marvisak#48's) pass it too. - apps/victory/src/translate.rs: Marvisak#566's arm (Source::LanePhi is no leaf); the tree's fix already counted Fetched as loaded, as 077ec8b does. - docs/architecture.md: no conflict on that base; Marvisak#566's text. - emit/image_tests.rs (Marvisak#160), emit/lane_read_loop_tests.rs (Marvisak#439), sgpr_spill.rs (Marvisak#309, Marvisak#320): track takes the per-lane form. Helpers that return the error keep the order of failures (resources, I/O, then structure). - emit/waterfall_tests.rs (new, Marvisak#566): lower::Parts gets the tree's target, console_cf and per_lane_only; the dispatch fills Marvisak#483's guard dwords. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Thank you @Proudnoob4, @iurysf, @slint6614-dev and @LocranKing for the corpus runs, and @fuzeofficlal for the native DispatchMesh check. Together they settle it. The lowering is correct: the 64/64 module validates, is identical to one declaring 64/64 from the start, and draws the same on NVIDIA and AMD. But it clears none of the real 53, so they must all exceed 32 KiB even at their lane count. Getting them under the limit needs the program's real vertex and primitive counts: the |
Some mesh programs export more per-vertex components than fit D3D12's
32 KiB even at one vertex per lane (65-68 components from 128 lanes).
dxil.dll refuses them ("vertex plus primitive output size is greater
than 32768"), and drivers that build the pipeline anyway run undefined
behaviour.
The prologue measures the outputs as the validator does (4 bytes per
component of every vertex and primitive element, times the maxima
rounded up to 32) and, past the cap, brings the maxima down to the lane
count: lane n writes only vertex n and primitive n. This part is
AnoHunted's, from the closed Marvisak#459; on its own it clears none of these
programs, but a linked program needs it to fit.
emit::translate_linked re-emits such a mesh program and its pixel
program for each other: arbitrary values the pixel program never reads
leave both signatures, read ones end after their last read component.
D3D12 links equal masks only, so both sides change together. Elements
stay in the program while it is lowered (16-bit halves are placed from
every element of a row); exports past the linked columns are dropped
and the signature is cut when the module is finished
(lower::Parts::linked_cols). The pipeline uses the linked pair when its
bindings equal the originals; otherwise nothing changes.
Co-authored-by: AnoHunted <360473103+AnoHunted@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…instead of hiding them FSPX modules (bare or in a DXBC ACCC part) are parsed for their thread group, wave size and GFX10 code size; translate() reports them as unsupported rather than a missing DXIL part. Device slot 67 (DeserializeComputePipelineStateX) logs its pieces and returns E_FAIL (VICTORY_SLOT67_HR, diagnostics build, picks another result); VICTORY_FSPX_REJECT_SLOT62 fails slot 62 for FSPX modules. Refs Marvisak#459 Co-authored-by: JMAN730 <JMAN730@users.noreply.github.com>
…nostics-459-111a Shaders: parse FSPX compute modules; fail device slot 67 (Marvisak#459)
What
container::mesh_output_bytesmeasures a mesh shader's outputs the way the DXIL validator does: 4 bytes percomponent of every vertex and every primitive signature element, times the vertex and primitive maxima, each
rounded up to a multiple of 32. It reads the same
SigElements the signature metadata,OSG1/PSG1andPSV0arewritten from.
MESH_OUTPUT_LIMITis 32 KiB.mesh_prologuechecks the size before it callssetMeshOutputCounts:setMeshOutputCounts, the entry's mesh state andPSV0all get the lowered values.(marked
shortcut:): drivers have been seen to take such modules, and refusing them would drop draws that maywork today. Whether to refuse them instead is the owner's call; it is a one-line change.
emit::container::tests::mesh_output_size_counts_components_and_aligned_maxima: the size on syntheticsignature elements. Components count, not rows (two elements sharing a row add up separately), the maxima
round up to 32, and the boundary is exactly 32,768 bytes.
emit::tests::mesh_maxima_past_the_lanes_come_down_to_fit: a synthetic mesh program goes throughemit. Ithas 64 lanes, declares 256 vertices and 256 primitives, and exports the position plus 6 vertex rows and 2
primitive rows. That is 28 + 8 components: 36 KiB at 256, 9 KiB at 64.
PSV0must now say 64/64. With 1 + 1rows it fits at 256 and must keep 256/256. Where
dxil.dllis found, each module must also pass the validator.emit::tests::mesh_outputs_past_32_kib_at_the_lane_count_keep_the_lane_maxima: 128 lanes, 256/256, positionplus 15 vertex rows and 2 primitive rows. That is 72 components, 36 KiB even at 128. It still translates, and
PSV0must say 128/128.Why
#201 lists 53 translated mesh shaders that
dxil.dllrefuses with "vertex plus primitive output size is greaterthan 32768". The prologue declared the console's maxima (up to 256 and 256) whatever the outputs took. It refused
only maxima above 256.
The rule:
d3d/MeshShader.md, section "Mesh shader output size limits":vert_attr_bytes * ALIGN32(n_verts) + prim_attr_bytes * ALIGN32(n_prims) <= 32,768. The attribute bytes are thenumber of scalar attributes times 4.
Sm.MeshShaderOutputSize("For shader '%0', vertex plus primitive output size isgreater than %1.",
utils/hct/hctdb.py).ValidateEntrySignaturesinlib/DxilValidation/DxilValidation.cpp(v1.8.2502, the version Corpus census: 185 emitted DXIL modules fail dxil.dll validation #201 used) sums
GetRows() * GetCols()over every element of the output signaturetimes
ALIGN32(maxVertexCount). It adds the same sum over the primitive signature timesALIGN32(maxPrimitiveCount). The total times 4 is compared withkMaxMSOutputTotalBytes = 1024 * 32(
include/dxc/DXIL/DxilConstants.h). Our elements are one row each, so the count iscols.Why lowering is safe. The same spec makes
SetMeshOutputCountscounts past the declared maxima undefined, andwrites past them too: "The hardware implementation is not required to clamp or mask out of bounds writes." So the
maxima may only come down where the module provably writes no more than the new values. In the translated module,
lane n writes only vertex n and primitive n:
storeVertexOutput,storePrimitiveOutputandemitIndicesalltake the flat thread id, as the console's NGG exports do. No vertex or primitive index reaches the lane count
(
[numthreads]), so maxima above it name slots that no lane ever writes. Lowering them takes away nothing theshader writes.
that vertex before either, so it was already undefined.
setMeshOutputCountsbut never written, noteven culled by the prologue, so their indices were undefined. With the lowered count they are not declared.
What cannot be derived. The console's real counts come from one lane's
s_sendmsgGS_ALLOC_REQ(m0 = vertices | primitives << 12), a run-time value. The translator finds that message only to place barriers,
and it lowers to nothing. It does not track the counts. So nothing below the lane count is provable, and a
shader whose outputs pass 32 KiB even there keeps an out-of-spec module (with smaller maxima than before).
No draw is lost. #201 says the D3D12 runtime created pipelines for all 8,191 emitted mesh modules, so these
shaders may draw today on drivers that accept them; this change keeps emitting the ones it cannot bring under the
cap. I could not check how the 53 split between "fits at the lane count" and "still over" (no access to that
corpus). #71 reports NVIDIA hangs in mesh passes; outputs past the limit are one possible factor,
not shown to be the cause.
Tested
Windows 11, NVIDIA GeForce RTX 5080, Rust 1.98.1.
dxil.dllfrom Microsoft's DXC release v1.9.2609(
VICTORY_DXILpointing at itsbin\x64\dxil.dll), so the validator steps of the tests ran (no "validationskipped" line on either side).
Main and branch side by side in one job (
--test-threads=1):cargo test -p victory-shader --lib mesh_ -- --nocapture: main 4 passed; branch 7 passed, 0 failed. The newmesh_maxima_past_the_lanes_come_down_to_fitmodules passdxil.dll's validator.cargo test -p victory-shader --lib: main 69 passed; branch 72 passed, 0 failed (constant_color_validatesand the existing translated-mesh draw test pass on both).
cargo test --workspace: main 264 passed, 0 failed, 4 ignored; branch 267 passed, 0 failed, 4 ignored.cargo clippy -p victory-shader --tests: no warnings on main or on the branch.emittests on main with the tests alone and no fix (an earlier version of the second test, which thenexpected a refusal):
mesh_maxima_past_the_lanes_come_down_to_fitfails (PSV0declares(256, 256)where(64, 64)is expected). The current..._keep_the_lane_maximatest was not run on main; main declares(256, 256)there, so it would fail its(128, 128)check the same way.Not tested
AI-assisted (Claude Code, Claude Opus 5.5). No game files were used.