Shader & GPU: merged geometry stages (rebase of #1399, with the batched GSVS write fix) #1924
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!1924
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1924"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@slatefield on GitHub · 2026-11-25 01:03 UTC · original
slatefield:up-1399-rebase→main· +1570 −75 · 22 files · 3 commits · openRebase 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.@Marvisak on GitHub · 2026-11-25 02:18 UTC · original
Automated triage for the maintainers.
This pull request does not merge cleanly into
main. Conflicting files:crates/victory-shader/src/emit/bvh_tests.rs,crates/victory-shader/src/emit/host.rs,crates/victory-shader/src/emit/lower.rs,crates/victory-shader/src/emit/memory_tests.rs,crates/victory-shader/src/emit/mod.rs,crates/victory-shader/src/emit/semantics_tests.rsand 4 more.It will be reviewed once it is rebased onto the current
main.Generated by Claude Code
@r4tedx on GitHub · 2026-11-25 07:29 UTC · original
@slatefield a pointer and a suggestion, since the comparison of this PR with #1315 sits there and not here: #1315
Same 642 containers, same command (
victory translate --validate --list, CPU anddxil.dllonly), each branch's own build:main940d32fmain940d32f1aa72250d45a59So the two tie on the title's 195 geometry programs. This PR also validates 20
VS_*VfxVBuffer*vertex programs thatmainemits and the validator refuses (Flags must match usage), which has nothing to do with geometry.emit::tests::merged_geometry_stages_draw_their_triangleat1aa7225passes on WARP here (496 lit pixels, interleaved and batched); that is the software adapter only.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
main940d32f, merges cleanly and carries the triage's merge-candidate label; this one carries needs-rebase. My suggestion to the maintainers was to take one of the two, not both. Concretely:mainis the one #1989 and #2016 target; I have not checked whether those cover these 20;Local title data was used for the counts only (offline, counts and reasons); the test uses none.
AI-assisted (Claude Code).
@zed6000 on GitHub · 2026-11-25 21:02 UTC · original
Measured offline on the title's shaders (the method in #1247:
victory translate --validate --listovershaders.rpf1.0.2.1, dxil.dll 1.8.2502, program by program). These are the 195 geometry programs that fail on main with "an address in an SGPR that is no root parameter", the largest remaining shader gap and the one #293 ranks highest by dropped draws.2900907vs its base940d32f1aa7225vs its base4118f3313f91ca(resolution below)-D warningsclean with and without--all-featuresThe +390 is all 195 geometry programs (
gs_6_6) plus their 195 export halves (vs_6_6, newly listed as programs), all validating. No program is left with the SGPR-address reason. #1399 and this PR gain exactly the same programs.Rebase onto
13f91ca: 19 conflict hunks in 11 files. Every one is the same pattern: main's write marks (Options/view_marks) and this PR's geometry stages (gs/Geometry) touch the same lines, and both sides are kept:emit/lower.rs: union of theioandirimports (GsInput,GsOp,LdsOutputalongside main'sBlock,Phi);view_marksandgsboth inPartsand its three initializers.emit/mod.rs: main's rectangle doc line plus this PR's "Merged geometry stages" paragraph; main'sOptionsstruct kept, with thetranslatedoc naming geometry too;view_marks: options.view_marksandgsboth set.emit/host.rs:view_marks: falseandgs: None.emit/rect.rs: the union of both import lines.view_marks: falseandgs: Noneboth in each initializer.emit/memory_tests.rs(added on main after this PR's base) buildsPartsin two places, lines 554 and 670, and needsgs: Nonethere, or the tests don't compile (E0063).Offline counts only; no program names or data.
@zed6000 on GitHub · 2026-11-26 02:41 UTC · original
An update to the resolution above, for main
63bcca4. Main has moved since13f91ca. Merging the13f91caport onto63bcca4adds one more conflict hunk plus four test initializers git doesn't flag:crates/victory-shader/src/emit/lower.rs, one hunk: main's newcode_table_startand this PR'smerged_wave_maskssit at the same spot. Keep both: endcode_table_startwith its}and putmerged_wave_masksafter it.gs: None,in thelower::Parts { .. }initializers main added since:emit/crosslane_tests.rs, theds_bpermutetest inemit/lower.rs,emit/memory_tests.rs(a second one) andemit/synthetic_tests.rs. Without them, the test build fails with E0063missing field gs. The same applies to new tests in PRs that land first, such as #385'semit/lower/phi.rsand #1737'spermlane_tests.rs.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).
cargo test -p victory-shader --libpasses 305/0, andcargo clippy -p victory-shader --all-targets --locked -- -D warningsis clean.Offline counts only; no program names or data.
1aa7225fb8to35ea67b00c@DenRakEiw on GitHub · 2026-11-25 03:34 UTC · original · reviewed
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— okCONFLICTINGwithorigin/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).
@slatefield on GitHub · 2026-11-26 11:07 UTC · original
Rebased onto current
main63bcca4following zed6000's resolution note above, and force-pushed. The branch is now three commits: wbkepler's geometry commit, molodayamama's batched-write fix, and one resolution commit on top.What the resolution did, beyond the list in that note:
Parts/Options/tester harnesses carry both main'sview_marksand the geometrygsfield, everywhere.lower.rskeeps bothcode_table_start(main) andmerged_wave_masks(this PR), and the imports are the union.Partsinitializers main added since the base gotgs: None:memory_tests(the two the note names),crosslane_tests, theds_bpermuteandclmultests inlower.rs,synthetic_tests, and the harnesses inhost.rs/mod.rs(those last ones areHostShaderliterals, where my first pass wrongly added it and the compiler caught it).Checked here, Linux box with no GPU: Windows-target clippy
--all-targets, with and without--all-features, clean; nativecargo check -p victory-shader --libpasses. The Linux test build fails insuper::super::validatorexactly as it does on unmodified63bcca4(the validator module is Windows-only and the shader tests are not gated), so the suite itself has to run on Windows; zed6000's run at the equivalent tree was 305/0. No game data.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.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.