Repository navigation
Shader & GPU: merged geometry stages (rebase of #1399, with the batched GSVS write fix) - #1924
slatefield wants to merge 3 commits into
Conversation
|
Automated triage for the maintainers. This pull request does not merge cleanly into It will be reviewed once it is rebased onto the current Generated by Claude Code |
DenRakEiw
left a comment
There was a problem hiding this comment.
Tested PR head directly on Windows 11 x64 (NVIDIA GeForce RTX 5090 + WARP, Rust 1.98.1 MSVC):
cargo test -p victory-shader --lib emit::rect::— passed on both RTX 5090 hardware andVICTORY_D3D12_WARP=1cargo clippy -p victory-shader --all-targets— 0 warningscargo xtask policy— ok- Merge status: Currently
CONFLICTINGwithorigin/main(940d32f). Once rebased ontomain, happy to re-verify the full merged-geometry test suite on RTX 5090 + WARP and approve!
AI-assisted (Gemini 4 Neon).
…ometry programs as gs_6_6) Conflicts: Parts gains both gs (this PR) and view_marks (main); the direct barycentrics read keeps this branch's SV_Barycentrics input. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@slatefield a pointer and a suggestion, since the comparison of this PR with #1315 sits there and not here: #1315 (comment) Same 642 containers, same command (
So the two tie on the title's 195 geometry programs. This PR also validates 20 Where they differ is in what is refused rather than guessed: the four open risks this PR's description lists (LDS layout taken from signature rows, defaults for missing PSV0 geometry state, non-zero streams, a write whose signature row is missing) are each a refusal in #1315; the linked comment says how. #1315 also has a test for the batched ring writes that this PR's second commit fixes. Where they stand: #1315 is on
Local title data was used for the counts only (offline, counts and reasons); the test uses none. AI-assisted (Claude Code). |
|
Measured offline on the title's shaders (the method in #1247:
The +390 is all 195 geometry programs ( Rebase onto
Offline counts only; no program names or data. |
|
An update to the resolution above, for main
Measured on that merge (offline, the title's shaders, RX 7900 XTX): +390, 0 lost again (195 geometry + 195 export halves; 25,240 validate against main's 24,850). Offline counts only; no program names or data. |
…etry programs as gs_6_6) The console runs a vertex shader that feeds a geometry shader, and that geometry shader, as the two halves of one wave, the vertices between them in LDS. An export program now translates to a plain vertex shader (its LDS writes are its outputs) and a geometry program to a geometry shader (its LDS reads are its input primitive's vertices, its LDS writes the outputs of the vertex its next stream message emits). - native: `StageIo::Es` / `StageIo::Gs(GsIo)` stage data. - resource: the geometry stage's own table (`GS_TABLE`, s[8:9]). - io: ring reads and writes raised to inputs and outputs by row and channel; `s_sendmsg` GS / GS_DONE raised to emit, cut and done. - emit: the geometry-shader state of rectangle lists (`Shader::gs`, the `GSState` and `PSV0` it writes) is generalized from "triangles in, strips out, n vertices" to a `Geometry` (input primitive, output topology, maximum vertices, instances; one stream) that the generated rectangle shader and title shaders share. Lowering: vertex-axis `loadInput`, `emitStream` / `cutStream` / `emitThenCutStream`, `primitiveID`, `gsInstanceID`, the prologue's lane masks as "every invocation", no barrier and a return for the export program's handover. 16-bit values in the rings and streams other than 0 are refused. - gpu: a title's geometry shader takes the host pipeline's geometry stage (root parameters visible to it); a pipeline with one and a rectangle-list topology is refused with a reason rather than chained. - app: `translate` counts export and geometry programs; the pipeline pre-build makes records with an export and a geometry stage. Tests: stage data, I/O raising, and a merged pair drawn on the host (export program as vertex shader, geometry program after it). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…elds together Resolution of the rebase onto current main, following zed6000's note in the PR: main's write marks (Options/view_marks) and the geometry stages (gs/Geometry) are both kept in Parts, Options and the tester harnesses, code_table_start and merged_wave_masks both stay in lower.rs, and the test initializers main added since get gs: None. No behaviour change on either side. Windows-target clippy --all-targets, with and without --all-features, clean; the native lib check passes. The Linux test build fails on the validator module exactly as main does (pre-existing on 63bcca4).
1aa7225 to
35ea67b
Compare
|
Rebased onto current What the resolution did, beyond the list in that note:
Checked here, Linux box with no GPU: Windows-target clippy The triage should now see a clean merge. The open review risks in the description are unchanged, and #1315 remains the other candidate the maintainers may prefer. |
Rebase of #1399 onto current
main(4118f33), plus the regression fix a tester published in that PR's own comment thread. Two commits, both with their authors: the merged-geometry support is wbkepler's, the batched-write fix is molodayamama's. If #1399 is updated first, take that one.Why it matters: current
mainrefuses ES and GS stages in four places (victory-shader/src/native.rs,io.rs,emit/mod.rs, andvictory-gpu/src/pipeline/host.rs), so pipelines with a merged geometry program never get a host pipeline and their draws are dropped. The tester measurement on this PR is +195 programs overmain, 0 lost, all of them the "an address in an SGPR that is no root parameter" class, and the README's "merged geometry stages (195 programs)" plus the missing band of distant geometry is this.The second commit is why this one should not be merged without it:
sinan-cmyk's static review found, andmolodayamamareproduced on an RTX 4060, that a geometry shader that writes a vertex's outputs before the previous vertex's emit (a compiler batching writes) renders 0 lit pixels instead of 496, while still validating as DXIL. The fix queues the ring writes by vertex and lowers each slot before its emit, with a regression test (emit::tests::merged_geometry_stages_draw_their_triangle).Rebase conflicts, 3 hunks:
native.rskeeps main'svs_outputs(data)wrapper from the mesh fix and moves the body intovs_outputs_at(data, at, count_at)for GS outputs;io.rskeeps main's corrected 9-bit meshexp primwording plus the PR's merged-geometry paragraph;lower.rsone test literal gainsgs: None. A per-file comparison of added/removed lines against the original PR shows 20 of 21 files identical in both directions, the only delta being thevs_outputswrapper. The ordering fix cherry-picked with no conflicts.Checked here:
cargo test -p victory-shader --lib146 passed, 2 ignored (main baseline 144; the PR's two Linux-runnable tests are counted);victory-formats38,victory-game15,victory-core13,victory-pipeline7, all pass; Windows-target clippy--all-targetswith and without--all-featuresclean forvictory-shaderandvictory-gpu;cargo xtask policy182 files ok.Not checked, needs a Windows GPU: the two
#[cfg(windows)]tests (thedxil.dllvalidation of the emittedvs_6_6/gs_6_6and the live draw comparison), the whole-pipeline wiring, and the whole-title program count re-measured on this base. The PR's own review thread also lists open risks that this rebase does not change: the LDS layout assumed to follow signature rows rather thanparamslots, silent defaults for missingPSV0geometry state, non-zero streams with no host consumer, and a write whose signature row is missing being dropped. Refusing those (as the review suggests) is a follow-up that belongs in the same file, not in the rebase.