Geometry shaders: the 195 "address in an SGPR that is no root parameter" failures are one merged ES+GS shader #138

Open
opened 2026-11-26 03:36:48 +00:00 by github-bot · 3 comments
Owner

@⁠arminkhaleghirod on GitHub · 2026-11-24 21:47 UTC · original

The largest translation failure class left on main (4e17478, translate --validate over the whole title) is 195 × resources: an address in an SGPR that is no root parameter. All 195 are the title's Gs programs, and they are builds of one geometry shader. Writing down what it is, so nobody fixes the error message and calls it done.

What it is

  • Each Gs program pairs with an Es program (the vertex half), which sits in the matching vertex container next to the normal Vs. The console links the two into one merged ES+GS stage when the pipeline is created.
  • ES half: fetches vertices, writes 32-byte records to LDS, s_barrier, then jumps into the GS half with s_setpc_b64.
  • GS half: reads its input vertices from LDS (offsets in v0/v1), writes 3 output vertices per lane to LDS (80 bytes each), sends GS_EMIT/GS_CUT/GS_DONE. There's no export, so the runtime reads the output from LDS.
  • The failing load (at 0x44 in every one): s_load_dword at +0xb8 from a pointer in user data 0/1. That looks like the runtime's own table, not a title resource. The value read becomes the LDS base of the GS output.

Why not just accept the pointer
Resource tracking could take it in a few lines, but io::raise and emit only run for Vs/Ps/Cs/Ms. The 195 would just drop out of the count with nothing translated, like the Es programs today.

What real support needs

  1. Pair each Es with its Gs and translate them as one DXIL geometry shader.
  2. Model the ES→GS handoff through LDS as GS input vertices.
  3. Map the GS output records plus GS_EMIT/GS_CUT to DXIL stream emits. The output signature is in the container, but mapping LDS offsets to its rows needs the merged-stage stage data that native.rs doesn't read yet.
  4. Treat the runtime table (user data 0/1) and the system SGPRs as known inputs.
  5. A geometry-stage emit and pipeline path (only the built-in rectangle GS exists).

Static analysis only, no code yet.

**@⁠arminkhaleghirod** on GitHub · 2026-11-24 21:47 UTC · [original](https://github.com/fxceless/victory-fork/issues/138) The largest translation failure class left on main (4e17478, `translate --validate` over the whole title) is 195 × `resources: an address in an SGPR that is no root parameter`. All 195 are the title's Gs programs, and they are builds of one geometry shader. Writing down what it is, so nobody fixes the error message and calls it done. **What it is** - Each Gs program pairs with an Es program (the vertex half), which sits in the matching vertex container next to the normal Vs. The console links the two into one merged ES+GS stage when the pipeline is created. - ES half: fetches vertices, writes 32-byte records to LDS, `s_barrier`, then jumps into the GS half with `s_setpc_b64`. - GS half: reads its input vertices from LDS (offsets in v0/v1), writes 3 output vertices per lane to LDS (80 bytes each), sends `GS_EMIT`/`GS_CUT`/`GS_DONE`. There's no export, so the runtime reads the output from LDS. - The failing load (at 0x44 in every one): `s_load_dword` at +0xb8 from a pointer in user data 0/1. That looks like the runtime's own table, not a title resource. The value read becomes the LDS base of the GS output. **Why not just accept the pointer** Resource tracking could take it in a few lines, but `io::raise` and `emit` only run for Vs/Ps/Cs/Ms. The 195 would just drop out of the count with nothing translated, like the Es programs today. **What real support needs** 1. Pair each Es with its Gs and translate them as one DXIL geometry shader. 2. Model the ES→GS handoff through LDS as GS input vertices. 3. Map the GS output records plus `GS_EMIT`/`GS_CUT` to DXIL stream emits. The output signature is in the container, but mapping LDS offsets to its rows needs the merged-stage stage data that `native.rs` doesn't read yet. 4. Treat the runtime table (user data 0/1) and the system SGPRs as known inputs. 5. A geometry-stage emit and pipeline path (only the built-in rectangle GS exists). Static analysis only, no code yet.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:36:48 +00:00
Author
Owner

@⁠CDR-0000 on GitHub · 2026-11-24 22:15 UTC · original

Data point for prioritising: in six runs reaching the lit prologue, the title never binds a pipeline with a geometry stage.

RTX 3080 Ti, fork main (4e17478/2119b0e), release and diag builds, with and without VICTORY_BVH_BUILDER=1 (boot, menus, opening cutscene, prison-yard prologue; 60–245 s each). First-bind lines by stage in the latest run: compute 699, pixel 526, vertex 329, mesh 260, geometry 0 — and no no host pipeline: only vertex, mesh, pixel and compute stages are translated refusal in any of the six logs, which is what a draw with one of these pipelines would log today (pipeline/host.rs, HostPipeline::new).

So the 195 GS_VoxelizeGeneric_* programs aren't on any path the fork currently reaches; full merged ES+GS support would show up in the translate count but not on screen until a scene that voxelizes is reached. If someone knows where the title uses them (a later mission, a settings toggle, the GI path once ray tracing works), that would tell us when it's worth doing.

Written with Claude Code (Claude Opus 5.5); the runs are mine.

**@⁠CDR-0000** on GitHub · 2026-11-24 22:15 UTC · [original](https://github.com/fxceless/victory-fork/issues/138#issuecomment-7145997962) **Data point for prioritising: in six runs reaching the lit prologue, the title never binds a pipeline with a geometry stage.** RTX 3080 Ti, fork `main` (`4e17478`/`2119b0e`), release and diag builds, with and without `VICTORY_BVH_BUILDER=1` (boot, menus, opening cutscene, prison-yard prologue; 60–245 s each). First-bind lines by stage in the latest run: compute 699, pixel 526, vertex 329, mesh 260, **geometry 0** — and no `no host pipeline: only vertex, mesh, pixel and compute stages are translated` refusal in any of the six logs, which is what a draw with one of these pipelines would log today (`pipeline/host.rs`, `HostPipeline::new`). So the 195 `GS_VoxelizeGeneric_*` programs aren't on any path the fork currently reaches; full merged ES+GS support would show up in the translate count but not on screen until a scene that voxelizes is reached. If someone knows where the title uses them (a later mission, a settings toggle, the GI path once ray tracing works), that would tell us when it's worth doing. Written with Claude Code (Claude Opus 5.5); the runs are mine.
Author
Owner

@⁠avt0m4t48 on GitHub · 2026-11-24 22:16 UTC · original

I built three synthetic container tests on fork main 2119b0e. They confirm the native reader retains the ES record from the vertex container and the GS record from the geometry container. The ES barrier is followed by an indirect exit. A synthetic GS load through an unbound SGPR at 0x44 reproduces the reported resource error. The pipeline-facing translator still emits the ordinary VS and refuses a GS-only container. Source-built fixture

cargo test --offline --locked -p victory-shader --lib merged_geometry_fixture passed all three on Linux. The full shader suite passed 173 tests, with two ignored. The fixture isolates the current translator boundary. It uses illustrative LDS fields and does not establish the console LDS layout or in-game geometry usage.

At the pipeline boundary both containers are available. A first pairing test can use two PSOs sharing a GS container with different ES records, so a future translation and cache key have to distinguish both inputs. The LDS field-to-signature mapping and runtime address provenance still need independent evidence. AI-assisted using Codex.

**@⁠avt0m4t48** on GitHub · 2026-11-24 22:16 UTC · [original](https://github.com/fxceless/victory-fork/issues/138#issuecomment-7146034671) I built three synthetic container tests on fork main `2119b0e`. They confirm the native reader retains the ES record from the vertex container and the GS record from the geometry container. The ES barrier is followed by an indirect exit. A synthetic GS load through an unbound SGPR at `0x44` reproduces the reported resource error. The pipeline-facing translator still emits the ordinary VS and refuses a GS-only container. [Source-built fixture](https://github.com/avt0m4t48/victory-fork/commit/46da3fcc6abdbdafb3fa0e4325a7f26d5a163c8d) `cargo test --offline --locked -p victory-shader --lib merged_geometry_fixture` passed all three on Linux. The full shader suite passed 173 tests, with two ignored. The fixture isolates the current translator boundary. It uses illustrative LDS fields and does not establish the console LDS layout or in-game geometry usage. At the pipeline boundary both containers are available. A first pairing test can use two PSOs sharing a GS container with different ES records, so a future translation and cache key have to distinguish both inputs. The LDS field-to-signature mapping and runtime address provenance still need independent evidence. AI-assisted using Codex.
Author
Owner

@⁠Revens2 on GitHub · 2026-11-24 23:29 UTC · original

Step 1 is up as #309: the GS half of the merged stage now reads its SGPRs (user data 0/1 as the runtime table pointer), so the 'no root parameter' failure goes away for it and emission stops at an explicit 'GS emit' (counted on its own line in translate). Not measured over the title; not run in game. Remaining steps are #311 (stage data), #312 (ES half and LDS handoff), #313 (GS output, GS_EMIT/GS_CUT), #314 (pipeline path). Thanks to the comments above: with no geometry pipeline bound in the prologue runs, steps 4 and 5 will not show on screen until a scene that uses one.

**@⁠Revens2** on GitHub · 2026-11-24 23:29 UTC · [original](https://github.com/fxceless/victory-fork/issues/138#issuecomment-7147462239) Step 1 is up as #309: the GS half of the merged stage now reads its SGPRs (user data 0/1 as the runtime table pointer), so the 'no root parameter' failure goes away for it and emission stops at an explicit 'GS emit' (counted on its own line in translate). Not measured over the title; not run in game. Remaining steps are #311 (stage data), #312 (ES half and LDS handoff), #313 (GS output, GS_EMIT/GS_CUT), #314 (pipeline path). Thanks to the comments above: with no geometry pipeline bound in the prologue runs, steps 4 and 5 will not show on screen until a scene that uses one.
This discussion has been locked. Commenting is limited to contributors.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/fxceless--victory-fork#138
No description provided.