[Ready to merge] Shaders: geometry shaders (legacy ES-GS) translate, and pipelines with a geometry stage get host pipelines #877
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#877
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@permadiego on GitHub · 2026-11-24 13:15 UTC · original
PR creation is limited to collaborators, so this is a branch ready to merge: permadiego/VIctory@shader/geometry-shaders (two commits, 6e8f760 and 828f825, on top of
ffe310e). Happy to open it as a PR if access opens up.What changed
The title's geometry pipelines (
VS_VoxelizeGeneric_*+GS_VoxelizeGeneric_*+PS_VoxelizeVisiblity_*, 195 GS records, 13 distinct triples) use the console's legacy merged ES-GS with both rings on chip: the vertex container'sEsprogram writes each vertex to the ESGS ring in LDS, and theGsprogram reads three vertices from it, writes its emitted vertices to the GSVS ring in LDS and signals them withs_sendmsgGS_OP_EMIT/GS_OP_CUT, with noexp. Today every GS fails with "resources: an address in an SGPR that is no root parameter" (the ring-table pointer in user data 0/1), and pipelines with a geometry stage get no host pipeline.The record. Each
Gsrecord embeds its copy shader: theGsstage data holds a complete 0x54-byte record for it at +0x34 (code at the end of the payload) and Vs-style stage data at +0x88, sovs_ioreads its outputs. The GSVS vertex size is at +0x28c (4 + 4 x outputs dwords), the max vertex count at +0x284.Translation (6e8f760).
native.rs:StageIo::Gs(GeometryIo)(the copy shader's code and outputs, max vertices, GSVS vertex size);Esstage data parsed like a VS.io.rsrings(): classifies LDS accesses by their address: input vertex k's offset (v0 lo/hi, v1 lo) plus a constant is an ESGS read of vertex k; lane index times a stride plus a uniform is the lane's own ring slot.copy_exports()decodes the copy shader generically: which GSVS dword or constant eachexp pos0/exp param<n>component takes.lower.rs:Esring writes becomestoreOutput(param n = row n); its closings_setpcto the GS becomes a return.Gsring reads becomeloadInputwith the vertex index; GSVS writes go to a per-thread array; atGS_OP_EMITthe copy shader's outputs are stored from that array andemitStreamfollows;GS_OP_CUTiscutStream. Outputs are named as a normal VS's, so the title's pixel shaders link.gs_6_6with geometry state metadata (triangle in, triangle strip out, max vertices from the record, one stream), PSV0 geometry fields.execsetup becomes a no-op: on the host every invocation is a real primitive.victory translatecounts geometry programs and the ES halves of vertex containers.GPU (828f825).
emit::translate_stage(container, HwStage);shader_cache::host_shadertakes the stage, with a separate cache key for the ES translation.pipeline.rs:Program { Main, Es, Gs }. A vertex container in a pipeline with a geometry stage is translated as itsEsprogram; one container can be a VS in one pipeline and an ES in another.pipeline/host.rs: the PSO gets the GS bytecode and its root parameters at geometry visibility (user data atb0, root views, static samplers, like the other stages); topology type triangle. Pipelines without a GS keep their exact behaviour and library names.Shortcuts (marked in code): triangle input and triangle-strip output are fixed; the ES vertex and instance IDs are taken from v5 and v8 (the VS's plus 5); one output stream.
Measured
victory translate --validate --list shaders.rpf,mainffe310eagainst this branch: 195 of 195 geometry programs and 195 of 195 ES halves validate; vertex/pixel 12,155, compute 1,417 and mesh 8,152 validated on both, 0 lost.On an AMD Radeon Vega 7 (Windows 10, Agility SDK 1.618.5) and on WARP 1.0.22, all 13 distinct VS(ES) + GS + PS triples from the title create their PSOs (13/13 on each), so the three stages' signatures link and the driver compiles them.
cargo test -p victory-shaderon that device: 120 passed; the one failure,waterfall_tests::lanes_load_from_the_buffer_their_nested_arms_choseon the AMD hardware, also fails onmain. Clippy is clean.Not verified
No draw with the title's shaders and real bindings, so the input vertex order and winding against the console are not checked.
🤖 Generated with Claude Code
@MichaelSmithAI on GitHub · 2026-11-24 13:28 UTC · original
The host geometry stage also produces the expected pixels through the guest draw path. On RTX 4090 under Wine/vkd3d-proton 3.2, a source-built geometry shader changed green vertex output to red at all 64 target pixels. We also found that a triangle-input GS could reach binding with an incompatible recorded topology. The follow-up checks topology during preparation and preserves direct rectangles, which expand to triangles. Both the list and rectangle readbacks passed. This uses host-compiled stages, so the console ring vertex order and winding still need their own comparison. Follow-up and regression on your branch
@fuzeofficlal on GitHub · 2026-11-24 13:29 UTC · original
I ran a source-built ES → GS → PS draw on
828f825. Both variants used the same three input vertices, the same copy shader, and the same 4×4 target cleared to transparent black. The only difference was how the last vertex was emitted.GS/EMIT_CUT, thenGS_DONE/NOP: all 16 pixels had the expected color.GS_DONE/EMIT_CUT: all 16 pixels stayed clear, on both the native hardware adapter and software WARP.gs_messageon this head returns before reading the operation onGS_DONE. The GFX10 message reference listsEMIT_CUTas a supported operation for that message.Follow-up with the off-screen regression test makes
GS_DONEuse the existing emit/cut handling. Both forms then produced 16/16 expected pixels on both backends. The shader and GPU library suites passed 121 and 50 tests, with one ignored in each. The readback covers the final vertex in one synthetic triangle.@LAKSHYA-cmd-tech on GitHub · 2026-11-24 13:42 UTC · original
Verified and merged downstream in PR #24. Links all 13 distinct VS(ES) + GS + PS triples for \VS_VoxelizeGeneric_*\ and validates 195/195 geometry programs with host pipeline compilation and D3D12 pipeline caching.
@fiestorra on GitHub · 2026-11-24 14:37 UTC · original
Independent run on another machine: your measured numbers reproduce exactly.
Method: my own copy of the package (build
b99f876b74d4a77f03af5f878223b27bd647b5c35a79d5decd9f716504239e93), a clean worktree per commit,cargo build --release -p victory, thenvictory translate <shaders.rpf> --validate --listwith the default--jobs(16 logical cores, about 74 s per pass). Your two commits sit onffe310e, which is current main, so this is a clean before/after on the same base.ffe310e828f825Your stage numbers match mine exactly — vertex plus pixel 12,155, compute 1,417, mesh 8,152, identical on both sides, nothing lost ✓. And
21,724 + 195 + 195 = 22,114: the entire change in the totals is the geometry programs and their ES halves.an address in an SGPR that is no root parametergoes 195 → 0 and is the only reason row that changes anywhere in the run ✓ so nothing else moved, in either direction. For context, the open work aimed at that reason row (#302,#489,#710) leaves all 195 exactly where they are, measured the same way; this branch is the only one that reaches them, because it is the only one written against the geometry stage.One thing I can add from the same data: with that row gone, the 165 remaining resource-tracking stops carry no concentration left. The largest single family in any of them is 3 programs; the biggest reason is
a descriptor read from the first lane of computed VGPRs, 34 mesh and 4 vertex programs spread over manyMS_VS_*/MSNC_VS_*/VS_*containers. If you want the next unit after this merges, that one is defined by a reason rather than by a family, which may be why it has stayed unclaimed.I cannot open PRs either, so consider this a +1 from an independent measurement, on a different GPU and CPU, offline, with the counts reconciling.
Written with an AI assistant.
@Ctrl-Alt-Haze on GitHub · 2026-11-24 16:51 UTC · original
Independent verification of
permadiego/VIctory@shader/geometry-shaders(828f825) on Windows 11, RTX 5070 Ti + WARP (VICTORY_D3D12_DEBUG=1), dxil.dll1.8.2502.11, Rust1.98.1againstupstream/main(ffe310eb):ffe310eb;policy(154 ok), bothclippychecks,workspace(342 passed, 0 failed, 6 ignored),victory-shader --features host(120/0/1 ign RTX & WARP), andvictory-gpu --features diagnostics(53/0/1 ign RTX & WARP) all pass with 0 D3D12 debug errors/warnings.@fuzeofficlal's inspection on828f825:Lower::gs_messagestill hasif msg == MSG_GS_DONE { return Ok(()); }before handlingop & 2(EMIT) /op & 1(CUT), soGS_DONEpaired withEMIT_CUTdrops the emitted vertex. Incorporating that fix and a host/WARP ES→GS→PS readback test before opening the PR would make it ready to land.AI-assisted verification on local RTX 5070 Ti + WARP; no game data.
@Marvisak on GitHub · 2026-11-25 06:58 UTC · original · edited 2026-11-25 09:55 UTC
Automated triage for the maintainers.
main(940d32f) still refuses the title's geometry programs: the ring-table pointer in user data fails resource tracking with "an address in an SGPR that is no root parameter" (crates/victory-shader/src/resource.rs), and the only geometry-stage emission onmainis the rectangle-list expansion inemit/rect.rs.The branch here is based on
ffe310e. A measurement in the comments against940d32fshows it would gain the 195 geometry programs but lose 271 programsmainhas learned to translate since, so it needs a rebase before it can be compared. Open PRs #1315 (single-stream triangle geometry programs) and #1924 (rebase of #1399 with a batched GSVS write fix) cover the same 195 programs on currentmainwithout losses. If this branch does something neither of them does, please say which. Otherwise review effort is best spent on those PRs. Pull requests are open to everyone, so a rebased branch can be opened as a PR. TheGS_DONEwithEMIT_CUTcase found in the comments is worth folding into whichever lands.The body quotes the title's internal shader program names. Material from the game must not be posted here; shader hashes and refusal reasons are enough to identify programs.
Generated by Claude Code
@r4tedx on GitHub · 2026-11-25 07:29 UTC · original
A measurement of this issue's branch against current
main, next to the two open PRs that cover the same programs.Same 642 containers, same command (
victory translate --validate --list, CPU anddxil.dllonly), each branch's own build:main940d32fmain940d32f828f8250d45a591aa7225The 271 are not a flaw of the design here: the branch is on
ffe310e, 319 commits behind, and they are programsmainhas learned to translate since. But it means the branch cannot go in as it is, and "ready to merge" no longer describes it.The title's 195 geometry programs are covered on current
mainby #1315 (merges cleanly, labelled a merge candidate by the triage) and by #1924 (needs a rebase). The two are compared at #1315.So my suggestion: either rebase this branch onto
940d32f, and I will rerun the count at the new head so the three can be compared fairly, or close this issue once one of the two PRs lands. If your implementation does something neither of them does, saying which would help the maintainers choose.Local title data was used for the counts only (offline, counts and reasons).
AI-assisted (Claude Code).