Shaders: merged ES+GS stage reads its SGPRs, stops at "GS emit" (#138, step 1) #309

Open
github-bot wants to merge 2 commits from github-bot/gh-309 into main AGit
Owner

@⁠Revens2 on GitHub · 2026-11-24 23:29 UTC · original
Revens2:fix/issue-138 → main · +617 −12 · 8 files · 2 commits · open

Step 1 of #138 (the 195 an address in an SGPR that is no root parameter failures are one merged ES+GS shader). This does not translate geometry shaders. It makes the GS half read the merged stage's SGPRs, so that failure stops hiding what is left, and it stops cleanly at a named error instead.

What is in it

  • StageIo::Gs: the GS record is now tagged (its stage data is still not read), and io::raise accepts it: no exports, and the first two user-data dwords (s8, s9 of the merged stage) are Input::RuntimeTable, the pointer the issue found at user data 0/1, when the root layout puts nothing there.
  • Resource tracking: through resource::track_merged (the merged layout of both halves), in a geometry program a load through that pair is traced to a new resource::RUNTIME_TABLE address (with the load's offset) instead of failing. It applies to the geometry stage only and only to dwords the merged layout leaves free; any other unbound SGPR pair, the same load in other stages, and a geometry program tracked on its own with plain track or emit::translate fail as before. A pointer whose high half was overwritten is refused.
  • merged::pair_es_gs: pairs the ES program (vertex container) with the GS program (geometry container): ES and GS stages, same wave size, one meaning per user-data dword (the halves share the SGPRs; both halves' ranges of one table pointer are kept), merged root layout. emit::translate_merged_gs(es, gs) runs a pair through tracing and I/O raising.
  • emit::emit refuses a geometry program with GS_EMIT ("GS emit"); emit::translate now takes a geometry container that far too (it used to say the container had no vertex, pixel, compute or mesh program).
  • victory translate: geometry programs are counted on their own geometry line (programs, resources traced, I/O raised, stopped at GS emit) and no longer appear in the failure list. The ES half they pair with is not in their container, so the line says user data 0 and 1 are taken as free (an assumption, not a pairing).

Tested

  • New unit tests on synthetic GCN programs and containers (13): the runtime-table load in a geometry program, the same load in VS/PS/MS/ES still failing, the layout taking precedence, other SGPR pairs and an overwritten high half still failing, geometry I/O raising, ES+GS pairing and its refusals (swapped stages, wave size, conflicting user data), and synthetic containers going through translate and translate_merged_gs to GS emit.
  • cargo build --workspace --locked, cargo test --workspace --locked -- --test-threads=4: 511 passed, 0 failed, 7 ignored (Windows, this branch on current main, after the review fixes).

Not tested

  • victory translate over the title: not run, so the 195 moving from the failure list to the geometry line is expected, not measured. Those programs may stop earlier on something else (structurisation, an instruction the translator lacks); that would show as a new failure reason.
  • That s8/s9 is the runtime table's pointer is the issue's static analysis, not checked against the console runtime; its contents are not modeled.
  • No run in game: nothing the pipeline binds changes (the host still has no geometry path beyond the rectangle one).

Still to do (not in this PR)

  • Read the merged stage data (output signature, LDS layout of the records the ES half hands over).
  • The ES half and the ES to GS handoff through LDS (s_barrier, s_setpc_b64), GS input vertices.
  • Output records in LDS and GS_EMIT / GS_CUT / GS_DONE as DXIL stream emits; LDS in general.
  • A geometry-stage pipeline path: a pairing/cache key that carries both the ES and the GS container, the host pipeline with a translated geometry shader.

Follow-up issues, one per step: #311 (stage data), #312 (ES half and LDS handoff), #313 (GS output and GS_EMIT / GS_CUT), #314 (pipeline path). #138 stays open.

AI use
Written with Claude Code (Claude Sonnet 5.5). The tests are synthetic programs; no title shaders or game files were read.

**@⁠Revens2** on GitHub · 2026-11-24 23:29 UTC · [original](https://github.com/fxceless/victory-fork/pull/309) `Revens2:fix/issue-138` → `main` · +617 −12 · 8 files · 2 commits · open Step 1 of #138 (the 195 `an address in an SGPR that is no root parameter` failures are one merged ES+GS shader). This does not translate geometry shaders. It makes the GS half read the merged stage's SGPRs, so that failure stops hiding what is left, and it stops cleanly at a named error instead. **What is in it** - `StageIo::Gs`: the GS record is now tagged (its stage data is still not read), and `io::raise` accepts it: no exports, and the first two user-data dwords (s8, s9 of the merged stage) are `Input::RuntimeTable`, the pointer the issue found at user data 0/1, when the root layout puts nothing there. - Resource tracking: through `resource::track_merged` (the merged layout of both halves), in a geometry program a load through that pair is traced to a new `resource::RUNTIME_TABLE` address (with the load's offset) instead of failing. It applies to the geometry stage only and only to dwords the merged layout leaves free; any other unbound SGPR pair, the same load in other stages, and a geometry program tracked on its own with plain `track` or `emit::translate` fail as before. A pointer whose high half was overwritten is refused. - `merged::pair_es_gs`: pairs the ES program (vertex container) with the GS program (geometry container): ES and GS stages, same wave size, one meaning per user-data dword (the halves share the SGPRs; both halves' ranges of one table pointer are kept), merged root layout. `emit::translate_merged_gs(es, gs)` runs a pair through tracing and I/O raising. - `emit::emit` refuses a geometry program with `GS_EMIT` ("GS emit"); `emit::translate` now takes a geometry container that far too (it used to say the container had no vertex, pixel, compute or mesh program). - `victory translate`: geometry programs are counted on their own `geometry` line (programs, resources traced, I/O raised, stopped at GS emit) and no longer appear in the failure list. The ES half they pair with is not in their container, so the line says user data 0 and 1 are taken as free (an assumption, not a pairing). **Tested** - New unit tests on synthetic GCN programs and containers (13): the runtime-table load in a geometry program, the same load in VS/PS/MS/ES still failing, the layout taking precedence, other SGPR pairs and an overwritten high half still failing, geometry I/O raising, ES+GS pairing and its refusals (swapped stages, wave size, conflicting user data), and synthetic containers going through `translate` and `translate_merged_gs` to `GS emit`. - `cargo build --workspace --locked`, `cargo test --workspace --locked -- --test-threads=4`: 511 passed, 0 failed, 7 ignored (Windows, this branch on current `main`, after the review fixes). **Not tested** - `victory translate` over the title: not run, so the 195 moving from the failure list to the `geometry` line is expected, not measured. Those programs may stop earlier on something else (structurisation, an instruction the translator lacks); that would show as a new failure reason. - That s8/s9 is the runtime table's pointer is the issue's static analysis, not checked against the console runtime; its contents are not modeled. - No run in game: nothing the pipeline binds changes (the host still has no geometry path beyond the rectangle one). **Still to do (not in this PR)** - Read the merged stage data (output signature, LDS layout of the records the ES half hands over). - The ES half and the ES to GS handoff through LDS (`s_barrier`, `s_setpc_b64`), GS input vertices. - Output records in LDS and `GS_EMIT` / `GS_CUT` / `GS_DONE` as DXIL stream emits; LDS in general. - A geometry-stage pipeline path: a pairing/cache key that carries both the ES and the GS container, the host pipeline with a translated geometry shader. Follow-up issues, one per step: #311 (stage data), #312 (ES half and LDS handoff), #313 (GS output and `GS_EMIT` / `GS_CUT`), #314 (pipeline path). #138 stays open. **AI use** Written with Claude Code (Claude Sonnet 5.5). The tests are synthetic programs; no title shaders or game files were read.
The 195 "an address in an SGPR that is no root parameter" failures are the
GS half of one merged ES+GS stage (#138). Step 1 of its support, without
emitting anything:

- StageIo::Gs and io::raise for a geometry program. User data 0 and 1 of
  the merged stage (s8, s9) are the console runtime's table pointer when the
  root layout puts nothing there; resource tracking traces a load through it
  to resource::RUNTIME_TABLE instead of failing. Other stages and other
  unbound SGPRs fail as before.
- merged::pair_es_gs pairs the ES program (vertex container) with the GS
  program (geometry container): same wave size, one meaning per user-data
  dword, merged root layout. emit::translate_merged_gs runs the pair as far
  as emission.
- emit refuses a geometry program with GS_EMIT ("GS emit"). `translate`
  counts those on their own "geometry" line, not among the failures.

Not done: DXIL geometry emission, the ES to GS handoff through LDS, the
output records, GS_EMIT/GS_CUT, the host pipeline. The runtime table's
contents and the GS stage data are not read.

Refs #138

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
pair_es_gs keeps both halves' ranges of one descriptor table pointer
instead of calling them a user-data conflict. The runtime table pointer
is only inferred through resource::track_merged, i.e. for the merged
layout of a pair (translate_merged_gs) or, in victory translate, as a
stated assumption for an unpaired geometry program: a geometry program
traced alone no longer takes user data 0 and 1 as free.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:40:30 +00:00
Author
Owner

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

Both review findings fixed in the new commit on this branch.

  • Shared table pointer (merged.rs): pair_es_gs now keeps both halves' ranges when they list the same descriptor-table root parameter (same user data, SGPR count and root slot) with a different table offset or base register. A different root parameter or type on the same dword is still a conflict. New test: the_same_table_pointer_with_other_ranges_in_each_half_is_one_parameter.
  • Runtime table inference (resource.rs): it is made only through resource::track_merged, i.e. with the merged layout of a pair (translate_merged_gs), no longer by plain track. A geometry container on its own (emit::translate) fails again with "an address in an SGPR that is no root parameter", since its ES half could own those dwords. victory translate cannot pair containers, so it still tracks geometry programs with track_merged, and its geometry line now says the ES half is unpaired and user data 0 and 1 are taken as free. New tests: the_runtime_table_needs_the_merged_layout, a_geometry_container_alone_does_not_trace.

Tested: cargo build --workspace --locked, cargo test --workspace --locked -- --test-threads=4: 511 passed, 0 failed, 7 ignored (Windows). Not run in game, not measured over the title.

Written with Claude Code (Claude Sonnet 5.5).

**@⁠Revens2** on GitHub · 2026-11-24 23:45 UTC · [original](https://github.com/fxceless/victory-fork/pull/309#issuecomment-7147769660) Both review findings fixed in the new commit on this branch. - **Shared table pointer (`merged.rs`)**: `pair_es_gs` now keeps both halves' ranges when they list the same descriptor-table root parameter (same user data, SGPR count and root slot) with a different table offset or base register. A different root parameter or type on the same dword is still a conflict. New test: `the_same_table_pointer_with_other_ranges_in_each_half_is_one_parameter`. - **Runtime table inference (`resource.rs`)**: it is made only through `resource::track_merged`, i.e. with the merged layout of a pair (`translate_merged_gs`), no longer by plain `track`. A geometry container on its own (`emit::translate`) fails again with "an address in an SGPR that is no root parameter", since its ES half could own those dwords. `victory translate` cannot pair containers, so it still tracks geometry programs with `track_merged`, and its geometry line now says the ES half is unpaired and user data 0 and 1 are taken as free. New tests: `the_runtime_table_needs_the_merged_layout`, `a_geometry_container_alone_does_not_trace`. Tested: `cargo build --workspace --locked`, `cargo test --workspace --locked -- --test-threads=4`: 511 passed, 0 failed, 7 ignored (Windows). Not run in game, not measured over the title. Written with Claude Code (Claude Sonnet 5.5).
Author
Owner

@⁠Revens2 on GitHub · 2026-11-25 07:10 UTC · original

Rebased on main (a26859f), head now 90ec93b. One conflict (the doc comment of translate), resolved by keeping both texts. The two commits and the review fixes are unchanged in meaning. cargo build --workspace --locked ok; cargo test -p victory-shader -p victory-gpu --locked: 137 + 230 passed, 0 failed. Ready for another review pass.

**@⁠Revens2** on GitHub · 2026-11-25 07:10 UTC · [original](https://github.com/fxceless/victory-fork/pull/309#issuecomment-7155562971) Rebased on main (a26859f), head now 90ec93b. One conflict (the doc comment of `translate`), resolved by keeping both texts. The two commits and the review fixes are unchanged in meaning. `cargo build --workspace --locked` ok; `cargo test -p victory-shader -p victory-gpu --locked`: 137 + 230 passed, 0 failed. Ready for another review pass.
Author
Owner

@⁠Revens2 on GitHub · 2026-11-25 09:35 UTC · original

@⁠codex review (head rebased on origin/main; earlier findings were addressed before the rebase)

**@⁠Revens2** on GitHub · 2026-11-25 09:35 UTC · [original](https://github.com/fxceless/victory-fork/pull/309#issuecomment-7158532722) @⁠codex review (head rebased on origin/main; earlier findings were addressed before the rebase)
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-24 23:29 UTC · original · edited 2026-11-25 09:39 UTC

Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-25T09:39:51.428622Z 90ec93b Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@⁠codex review" or "@⁠codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-24 23:29 UTC · [original](https://github.com/fxceless/victory-fork/pull/309#issuecomment-7147456714) · edited 2026-11-25 09:39 UTC <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"90ec93bef615698d59c5e633e72f0ad97dfb1532","has_any_findings":true,"has_unresolved_findings":true,"status":"completed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} --> <details> <summary><strong>Codex Review Summary</strong>: ✅ Completed</summary> This comment shows the latest Codex review activity on this pull request. | Review | Status | Commit | Review trigger | | --- | --- | --- | --- | | 📝 **Code Review** | ✅ **Completed** <relative-time datetime="2026-11-25T09:39:51.428622Z">2026-11-25T09:39:51.428622Z</relative-time> | `90ec93b` | Manual request | <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@⁠codex review" or "@⁠codex security review". Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. </details> </details>
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-24 23:33 UTC · original
On crates/victory-shader/src/merged.rs line 79 (outdated):

@@ -0,0 +1,156 @@
+//! The merged ES+GS stage (a geometry shader), step 1 of its support.
+//!
+//! The console links two programs into one hardware stage when it creates a
+//! pipeline with a geometry shader: the ES program, which sits in the vertex
+//! container next to the ordinary VS, and the GS program, which is all the
+//! geometry container holds. Both run on the same wave, so they share one
+//! SGPR file: eight system SGPRs first, then the user data of the root
+//! signature ([`HwStage::user_sgpr`]).
+//!
+//! What this step knows, from the title's programs as the issue on this
+//! (fork issue 138) writes it down (static analysis, not a run):
+//!
+//! * The GS half loads from a pointer in user data 0 and 1 (s8 and s9) that
+//!   is no root parameter: the console runtime's own table. [`RUNTIME_TABLE`]
+//!   names it; resource tracking takes the pair as that table when the root
+//!   layout puts nothing there, and [`crate::io::Input::RuntimeTable`] names
+//!   the two dwords.
+//! * A root parameter is the same in both halves: [`pair_es_gs`] merges the
+//!   two layouts and refuses programs that disagree about a user-data dword.
+//!
+//! What it does not do yet: translate the stage. The ES half hands its
+//! records over through LDS, the GS half reads them from there and writes
+//! its output vertices there too, with `s_sendmsg` GS_EMIT, GS_CUT and
+//! GS_DONE; none of that is modeled. Emission refuses a geometry program with
+//! [`crate::emit::GS_EMIT`].
+
+use crate::ShaderError::{self, Malformed};
+use crate::native::{HwStage, NativeProgram, RootParam};
+
+/// The first user-data dword of the runtime table pointer: it takes dwords 0
+/// (low half) and 1 (high half) of the merged stage's user data.
+pub const RUNTIME_TABLE: u8 = 0;
+
+/// An ES program and the GS program it is linked with.
+#[derive(Debug, Clone, PartialEq, Eq)]
+pub struct MergedGs {
+    pub es: NativeProgram,
+    pub gs: NativeProgram,
+    /// The root parameters of the merged stage: those of either half, by user
+    /// data (a parameter both halves list is in it once).
+    pub layout: Vec<RootParam>,
+}
+
+impl MergedGs {
+    /// The GS program as the merged stage runs it: the code of the GS half
+    /// with the root layout of both halves, which is what its user SGPRs
+    /// hold.
+    pub fn program(&self) -> NativeProgram {
+        NativeProgram {
+            layout: self.layout.clone(),
+            ..self.gs.clone()
+        }
+    }
+}
+
+/// Pairs an ES program with the GS program of the same pipeline.
+///
+/// Fails when the programs are not an ES and a GS, run at different wave
+/// sizes, or disagree about what a user-data dword holds (the two halves
+/// share the SGPRs, so a dword has one meaning).
+pub fn pair_es_gs(es: NativeProgram, gs: NativeProgram) -> Result<MergedGs, ShaderError> {
+    if es.stage != HwStage::Es {
+        return Err(Malformed("the vertex half of a merged stage is not an ES program"));
+    }
+    if gs.stage != HwStage::Gs {
+        return Err(Malformed("the geometry half of a merged stage is not a GS program"));
+    }
+    if es.wave64 != gs.wave64 {
+        return Err(Malformed("ES and GS programs run at different wave sizes"));
+    }
+    let mut layout = es.layout.clone();
+    for g in &gs.layout {
+        let overlaps = |e: &RootParam| {
+            let end = |p: &RootParam| u32::from(p.user_data) + p.sgprs;
+            u32::from(e.user_data) < end(g) && u32::from(g.user_data) < end(e)
+        };
+        match layout.iter().find(|e| overlaps(e)) {
+            Some(e) if e == g => {}
+            Some(_) => return Err(Malformed("ES and GS programs disagree about a user-data dword")),

P2 Badge Allow shared table pointers with distinct range mappings

When ES and GS use different ranges of the same descriptor-table root parameter, their RootParams overlap at the same user-data pointer but can differ in table_offset_dwords or base_register. Since a RootParam can encode a table range, this branch rejects a valid pair as a dword conflict, so translate_merged_gs never reaches resource tracking or GS_EMIT. Treat entries for the same table pointer as compatible while retaining both range mappings.

Useful? React with 👍 / 👎.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-24 23:33 UTC · [original](https://github.com/fxceless/victory-fork/pull/309#discussion_r4688013999) On `crates/victory-shader/src/merged.rs` line 79 (outdated): ```diff @@ -0,0 +1,156 @@ +//! The merged ES+GS stage (a geometry shader), step 1 of its support. +//! +//! The console links two programs into one hardware stage when it creates a +//! pipeline with a geometry shader: the ES program, which sits in the vertex +//! container next to the ordinary VS, and the GS program, which is all the +//! geometry container holds. Both run on the same wave, so they share one +//! SGPR file: eight system SGPRs first, then the user data of the root +//! signature ([`HwStage::user_sgpr`]). +//! +//! What this step knows, from the title's programs as the issue on this +//! (fork issue 138) writes it down (static analysis, not a run): +//! +//! * The GS half loads from a pointer in user data 0 and 1 (s8 and s9) that +//! is no root parameter: the console runtime's own table. [`RUNTIME_TABLE`] +//! names it; resource tracking takes the pair as that table when the root +//! layout puts nothing there, and [`crate::io::Input::RuntimeTable`] names +//! the two dwords. +//! * A root parameter is the same in both halves: [`pair_es_gs`] merges the +//! two layouts and refuses programs that disagree about a user-data dword. +//! +//! What it does not do yet: translate the stage. The ES half hands its +//! records over through LDS, the GS half reads them from there and writes +//! its output vertices there too, with `s_sendmsg` GS_EMIT, GS_CUT and +//! GS_DONE; none of that is modeled. Emission refuses a geometry program with +//! [`crate::emit::GS_EMIT`]. + +use crate::ShaderError::{self, Malformed}; +use crate::native::{HwStage, NativeProgram, RootParam}; + +/// The first user-data dword of the runtime table pointer: it takes dwords 0 +/// (low half) and 1 (high half) of the merged stage's user data. +pub const RUNTIME_TABLE: u8 = 0; + +/// An ES program and the GS program it is linked with. +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct MergedGs { + pub es: NativeProgram, + pub gs: NativeProgram, + /// The root parameters of the merged stage: those of either half, by user + /// data (a parameter both halves list is in it once). + pub layout: Vec<RootParam>, +} + +impl MergedGs { + /// The GS program as the merged stage runs it: the code of the GS half + /// with the root layout of both halves, which is what its user SGPRs + /// hold. + pub fn program(&self) -> NativeProgram { + NativeProgram { + layout: self.layout.clone(), + ..self.gs.clone() + } + } +} + +/// Pairs an ES program with the GS program of the same pipeline. +/// +/// Fails when the programs are not an ES and a GS, run at different wave +/// sizes, or disagree about what a user-data dword holds (the two halves +/// share the SGPRs, so a dword has one meaning). +pub fn pair_es_gs(es: NativeProgram, gs: NativeProgram) -> Result<MergedGs, ShaderError> { + if es.stage != HwStage::Es { + return Err(Malformed("the vertex half of a merged stage is not an ES program")); + } + if gs.stage != HwStage::Gs { + return Err(Malformed("the geometry half of a merged stage is not a GS program")); + } + if es.wave64 != gs.wave64 { + return Err(Malformed("ES and GS programs run at different wave sizes")); + } + let mut layout = es.layout.clone(); + for g in &gs.layout { + let overlaps = |e: &RootParam| { + let end = |p: &RootParam| u32::from(p.user_data) + p.sgprs; + u32::from(e.user_data) < end(g) && u32::from(g.user_data) < end(e) + }; + match layout.iter().find(|e| overlaps(e)) { + Some(e) if e == g => {} + Some(_) => return Err(Malformed("ES and GS programs disagree about a user-data dword")), ``` **<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Allow shared table pointers with distinct range mappings** When ES and GS use different ranges of the same descriptor-table root parameter, their `RootParam`s overlap at the same user-data pointer but can differ in `table_offset_dwords` or `base_register`. Since a `RootParam` can encode a table range, this branch rejects a valid pair as a dword conflict, so `translate_merged_gs` never reaches resource tracking or `GS_EMIT`. Treat entries for the same table pointer as compatible while retaining both range mappings. Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-24 23:33 UTC · original
On crates/victory-shader/src/resource.rs line 600 (outdated):

@@ -582,6 +589,17 @@ impl<'a> Tracer<'a> {
         })
     }
 
+    /// Whether `reg` is the low half of the console runtime's table pointer
+    /// ([`RUNTIME_TABLE`]): the first two user-data dwords of a geometry
+    /// program, when the root layout puts no parameter on either.
+    fn runtime_table(&self, reg: Reg) -> bool {
+        let first = self.stage.user_sgpr(crate::merged::RUNTIME_TABLE);
+        self.stage == HwStage::Gs
+            && reg == Reg::S(first)
+            && self.param_of(reg).is_none()
+            && self.param_of(Reg::S(first + 1)).is_none()

P2 Badge Consult the merged layout before classifying a runtime-table load

If the ES half owns user-data dword 0 or 1 but the GS record omits that parameter, this check sees both dwords as free and classifies an s_load through s8:s9 as a runtime-table access. The batch path in apps/victory/src/translate.rs::translate_programs calls resource::track with the GS-only p.layout, so it can report those root-parameter reads as successfully traced; only translate_merged_gs supplies the union. Use the merged layout for this inference, or avoid making it for an unpaired GS.

Useful? React with 👍 / 👎.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-24 23:33 UTC · [original](https://github.com/fxceless/victory-fork/pull/309#discussion_r4688014007) On `crates/victory-shader/src/resource.rs` line 600 (outdated): ```diff @@ -582,6 +589,17 @@ impl<'a> Tracer<'a> { }) } + /// Whether `reg` is the low half of the console runtime's table pointer + /// ([`RUNTIME_TABLE`]): the first two user-data dwords of a geometry + /// program, when the root layout puts no parameter on either. + fn runtime_table(&self, reg: Reg) -> bool { + let first = self.stage.user_sgpr(crate::merged::RUNTIME_TABLE); + self.stage == HwStage::Gs + && reg == Reg::S(first) + && self.param_of(reg).is_none() + && self.param_of(Reg::S(first + 1)).is_none() ``` **<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Consult the merged layout before classifying a runtime-table load** If the ES half owns user-data dword 0 or 1 but the GS record omits that parameter, this check sees both dwords as free and classifies an `s_load` through `s8:s9` as a runtime-table access. The batch path in `apps/victory/src/translate.rs::translate_programs` calls `resource::track` with the GS-only `p.layout`, so it can report those root-parameter reads as successfully traced; only `translate_merged_gs` supplies the union. Use the merged layout for this inference, or avoid making it for an unpaired GS. Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
@ -305,0 +313,4 @@
let first = native.stage.user_sgpr(crate::merged::RUNTIME_TABLE);
let taken = native.layout.iter().any(|p| {
let at = u32::from(native.stage.user_sgpr(p.user_data));
at < u32::from(first) + 2 && u32::from(first) < at + p.sgprs
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-25 09:39 UTC · original

P2 Badge Check geometry root-range arithmetic before adding

For a malformed GS FSSM entry with user_data = 0 and sgprs near u32::MAX, native_programs preserves the raw sgprs, so this end calculation can overflow: overflow-checking builds panic, while wrapping builds can mark s8:s9 as free and report them as RuntimeTable inputs instead of rejecting the layout. Use a checked or bounded end here and in merged::pair_es_gs, which makes the same calculation.

Useful? React with 👍 / 👎.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-25 09:39 UTC · [original](https://github.com/fxceless/victory-fork/pull/309#discussion_r4692983289) **<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Check geometry root-range arithmetic before adding** For a malformed GS FSSM entry with `user_data = 0` and `sgprs` near `u32::MAX`, `native_programs` preserves the raw `sgprs`, so this end calculation can overflow: overflow-checking builds panic, while wrapping builds can mark s8:s9 as free and report them as `RuntimeTable` inputs instead of rejecting the layout. Use a checked or bounded end here and in `merged::pair_es_gs`, which makes the same calculation. Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-24 23:33 UTC · original · reviewed

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5ad26761f2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@⁠codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@⁠codex address that feedback".

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-24 23:33 UTC · [original](https://github.com/fxceless/victory-fork/pull/309#pullrequestreview-6049109976) · **reviewed** <!-- codex-review-receipt:v1 --> ### 💡 Codex Review Here are some automated review suggestions for this pull request. **Reviewed commit:** `5ad26761f2` <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@⁠codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@⁠codex address that feedback". </details>
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-25 09:39 UTC · original · reviewed

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 90ec93bef6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@⁠codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@⁠codex address that feedback".

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-25 09:39 UTC · [original](https://github.com/fxceless/victory-fork/pull/309#pullrequestreview-6055131431) · **reviewed** <!-- codex-review-receipt:v1 --> ### 💡 Codex Review Here are some automated review suggestions for this pull request. **Reviewed commit:** `90ec93bef6` <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@⁠codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@⁠codex address that feedback". </details>
Author
Owner

@⁠slauko on GitHub · 2026-11-26 10:44 UTC · original

A number for step 1, from a Wine run of the title (RTX 3080 Ti, vkd3d-proton ec20719, uiliannn's line):

victory translate --list over the pack names every refusal. Of 228 refused containers, 196 are the title's voxelization geometry shaders, all refused at the same place:

shaders.rpf@0xbd7b8e3 GS_VoxelizeGeneric_b300ca2e_Wrapped #d82a0a5a22471c77 ~b8bb2fac Gs at 0x44
    resources: an address in an SGPR that is no root parameter

(the rest: 29 FidelityFX containers with no DXIL part (SM5 or older), one shadow-mask compute program with a lane mask holding lanes elsewhere read as data.)

What those 196 cost a run: the pipeline library has no pipeline whose stage set includes one of them, so every draw that binds such a pipeline is dropped — in the cell, 340 to 350 of ~5,000 draws a frame (dropped ... without a host pipeline), and 1,017 pipelines bound once that never get made. That is the title's voxelized (traced-shadow/GI) work, so nothing that would show on screen as geometry; it is the lighting side.

If step 1 makes the stage read its SGPRs, that alone would put ~1,000 pipelines and ~350 draws a frame back into the run here. Not a speed claim — the draws are missing, so they would cost frame time — but a picture claim.

**@⁠slauko** on GitHub · 2026-11-26 10:44 UTC · [original](https://github.com/fxceless/victory-fork/pull/309#issuecomment-7189775936) A number for step 1, from a Wine run of the title (RTX 3080 Ti, vkd3d-proton `ec20719`, uiliannn's line): `victory translate --list` over the pack names every refusal. Of 228 refused containers, **196 are the title's voxelization geometry shaders**, all refused at the same place: ``` shaders.rpf@0xbd7b8e3 GS_VoxelizeGeneric_b300ca2e_Wrapped #d82a0a5a22471c77 ~b8bb2fac Gs at 0x44 resources: an address in an SGPR that is no root parameter ``` (the rest: 29 FidelityFX containers with `no DXIL part (SM5 or older)`, one shadow-mask compute program with `a lane mask holding lanes elsewhere read as data`.) What those 196 cost a run: the pipeline library has no pipeline whose stage set includes one of them, so every draw that binds such a pipeline is dropped — in the cell, **340 to 350 of ~5,000 draws a frame** (`dropped ... without a host pipeline`), and 1,017 pipelines bound once that never get made. That is the title's voxelized (traced-shadow/GI) work, so nothing that would show on screen as geometry; it is the lighting side. If step 1 makes the stage read its SGPRs, that alone would put ~1,000 pipelines and ~350 draws a frame back into the run here. Not a speed claim — the draws are missing, so they would *cost* frame time — but a picture claim.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/309/head:github-bot/gh-309'
git switch 'github-bot/gh-309'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-309'
git switch 'github-bot/gh-309'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-309'
git switch 'github-bot/gh-309'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-309'
git switch 'main'
git merge --squash 'github-bot/gh-309'
git switch 'main'
git merge --ff-only 'github-bot/gh-309'
git switch 'main'
git merge 'github-bot/gh-309'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.