Shaders: emit a merged ES+GS pair as a vertex and a geometry shader (#313) #381

Open
Revens2 wants to merge 8 commits from upstream-pr/381 into main
Revens2 commented 2026-11-25 00:12:11 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by Revens2 on 2026-11-25T00:12:11Z.


Step 4 of #138, for #313. Stacked on #373 (#312), itself on #367 (#311) and #309: the diff here includes theirs until they merge; the commit of this step is the last one. Base is main because the stacked branches are not in this repository.

What is in it

  • translate_merged_gs now returns two host shaders (MergedShaders): a vertex shader and a geometry shader, instead of stopping at GS emit. New emit/gs.rs holds the plan and its notes.
  • ES half as a DXIL vertex shader: each record dword it writes to LDS is a channel of a synthetic TEXCOORD<row> register (32-bit integers, dword k = row k / 4, channel k % 4). The rewrite is of the machine code: ds_write_b32..b128 becomes the exp param<row> of the same size, s_barrier a s_nop, the s_setpc_b64 handover an s_endpgm.
  • GS half as a DXIL geometry shader (triangles in, triangle strip out, stream 0, one instance): reads of an input vertex's record are loadInput of that signature; its own LDS writes/reads go to a private array at the offset from the first record written; the k-th GS_EMIT copies record k to the output signature (storeOutput) and calls emitStream; GS_CUT is cutStream; the runtime-table scalar load reads 0. The array and maxvertexcount come from the emit count of the code.
  • merged::limits, handoff::own_accesses, an Overrides hook in emit_program_with and Shader.geometry carry this; Vs I/O raising also accepts the ES stage.
  • A geometry container alone is still refused (its input vertices and runtime table come from the ES half). victory translate keeps counting those on the geometry line.

Tested

  • Synthetic GCN programs only: the record signature, the ES half's rewritten code and outputs, the GS plan (emit numbering, record/array sizes, 15 stores / 2 reads for 3 emits, a signature that does not fit is refused), and a pair end to end: DXIL program kinds, GS inputs equal VS outputs register for register, GS outputs equal the container's signature, and the DXIL validator accepts both modules (present on this machine, Windows).
  • cargo build --workspace --locked, cargo test --workspace --locked --no-fail-fast -- --test-threads=4: all green (243 passed in victory-shader, 0 failed).

Not tested / assumed (none read from the stage data or checked on a title program)

  • An output record has 4 dwords per signature register: dword 4 * row + col is that channel of the output with that register, records back to back; the written range must be exactly one record per emit or the program is refused.
  • Emits are numbered in code order, so emits on alternative arms are refused; triangle strip topology and one instance; the ES vertex id is in v0.
  • The GS input convention (vertex offsets in the halves of v0/v1) is the ISA's for a merged stage, not checked.
  • Nothing is bound by the host yet (#314: pipeline with GS between VS and PS); not run in game. How many of the 195 failing programs this unblocks is non verifie.

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

🤖 Generated with Claude Code

<!-- greyfinch-sync:fxceless/victory-fork:issue:6594099121 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/381). Originally posted by [Revens2](https://github.com/Revens2) on 2026-11-25T00:12:11Z. --- Step 4 of #138, for #313. **Stacked on #373 (#312), itself on #367 (#311) and #309**: the diff here includes theirs until they merge; the commit of this step is the last one. Base is `main` because the stacked branches are not in this repository. **What is in it** - `translate_merged_gs` now returns two host shaders (`MergedShaders`): a vertex shader and a geometry shader, instead of stopping at `GS emit`. New `emit/gs.rs` holds the plan and its notes. - ES half as a DXIL vertex shader: each record dword it writes to LDS is a channel of a synthetic `TEXCOORD<row>` register (32-bit integers, dword `k` = row `k / 4`, channel `k % 4`). The rewrite is of the machine code: `ds_write_b32`..`b128` becomes the `exp param<row>` of the same size, `s_barrier` a `s_nop`, the `s_setpc_b64` handover an `s_endpgm`. - GS half as a DXIL geometry shader (triangles in, triangle strip out, stream 0, one instance): reads of an input vertex's record are `loadInput` of that signature; its own LDS writes/reads go to a private array at the offset from the first record written; the k-th `GS_EMIT` copies record k to the output signature (`storeOutput`) and calls `emitStream`; `GS_CUT` is `cutStream`; the runtime-table scalar load reads 0. The array and `maxvertexcount` come from the emit count of the code. - `merged::limits`, `handoff::own_accesses`, an `Overrides` hook in `emit_program_with` and `Shader.geometry` carry this; `Vs` I/O raising also accepts the ES stage. - A geometry container alone is still refused (its input vertices and runtime table come from the ES half). `victory translate` keeps counting those on the `geometry` line. **Tested** - Synthetic GCN programs only: the record signature, the ES half's rewritten code and outputs, the GS plan (emit numbering, record/array sizes, 15 stores / 2 reads for 3 emits, a signature that does not fit is refused), and a pair end to end: DXIL program kinds, GS inputs equal VS outputs register for register, GS outputs equal the container's signature, and **the DXIL validator accepts both modules** (present on this machine, Windows). - `cargo build --workspace --locked`, `cargo test --workspace --locked --no-fail-fast -- --test-threads=4`: all green (243 passed in victory-shader, 0 failed). **Not tested / assumed (none read from the stage data or checked on a title program)** - An output record has 4 dwords per signature register: dword `4 * row + col` is that channel of the output with that register, records back to back; the written range must be exactly one record per emit or the program is refused. - Emits are numbered in code order, so emits on alternative arms are refused; triangle strip topology and one instance; the ES vertex id is in v0. - The GS input convention (vertex offsets in the halves of v0/v1) is the ISA's for a merged stage, not checked. - Nothing is bound by the host yet (#314: pipeline with GS between VS and PS); not run in game. How many of the 195 failing programs this unblocks is `non verifie`. **AI use** Written with Claude Code (Claude Sonnet 5.5). The tests are synthetic programs; no title shaders or game files were read. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
chatgpt-codex-connector[bot commented 2026-11-25 01:11:34 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by chatgpt-codex-connector[bot] on 2026-11-25T00:21:15Z.

Review: COMMENTED


💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 050913ec1d

ℹ️ 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".

<!-- greyfinch-sync:fxceless/victory-fork:review:6049605672 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/381#pullrequestreview-6049605672). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-25T00:21:15Z. **Review:** COMMENTED --- <!-- codex-review-receipt:v1 --> ### 💡 Codex Review Here are some automated review suggestions for this pull request. **Reviewed commit:** `050913ec1d` <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>
chatgpt-codex-connector[bot commented 2026-11-25 01:11:58 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by chatgpt-codex-connector[bot] on 2026-11-25T00:12:23Z.


Codex Review Summary: ❌ Failed

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

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-25T09:35:39.482795Z
We couldn’t complete this review. Comment @codex review to try again.
dc33623 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.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7148261965 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/381#issuecomment-7148261965). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-25T00:12:23Z. --- <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"dc3362390e92529b65534e8f41a72e391ce108e8","has_any_findings":true,"has_unresolved_findings":true,"status":"failed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} --> <details> <summary><strong>Codex Review Summary</strong>: ❌ Failed</summary> This comment shows the latest Codex review activity on this pull request. | Review | Status | Commit | Review trigger | | --- | --- | --- | --- | | 📝 **Code Review** | ❌ **Failed** <relative-time datetime="2026-11-25T09:35:39.482795Z">2026-11-25T09:35:39.482795Z</relative-time><br/>We couldn’t complete this review. Comment `@codex review` to try again. | `dc33623` | 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>
Revens2 commented 2026-11-25 01:12:03 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by Revens2 on 2026-11-25T00:44:55Z.


Review findings handled in 1c4de71 (with tests on synthetic programs):

  • s_sendmsghalt: a halting GS_EMIT / GS_CUT is refused (a halting GS_EMIT or GS_CUT); the lowering handled s_sendmsg only, so it would have been dropped silently.
  • Output signature usage: the emits now mark each component they store, so the emitted OSG1 says they are written (checked on the read-write mask of every row).
  • Input offset multiplier: a vertex read is accepted only when its offset half is scaled to bytes (x4); other scales are refused.
  • Returned vertex shader kind: MergedShaders::vertex is now HwStage::Vs (the geometry one Gs).
  • Runtime table loads: not proven, narrowed. Every load from the table still reads as zero, taken to be the base of the output records; what the translator can check is that the program reads one field of the table only (a second field is refused: more than one field read from the runtime table). That the one field is the output base, and is used as nothing else, is an assumption on a title program that nothing here checks; it stays in the list of what is assumed.
  • Also refused: a half-precision geometry output (it was passed through as raw bits).

cargo test -p victory-shader --lib --locked: 251 passed, 0 failed.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7148834466 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/381#issuecomment-7148834466). Originally posted by [Revens2](https://github.com/Revens2) on 2026-11-25T00:44:55Z. --- Review findings handled in 1c4de71 (with tests on synthetic programs): - **`s_sendmsghalt`**: a halting `GS_EMIT` / `GS_CUT` is refused (`a halting GS_EMIT or GS_CUT`); the lowering handled `s_sendmsg` only, so it would have been dropped silently. - **Output signature usage**: the emits now mark each component they store, so the emitted `OSG1` says they are written (checked on the read-write mask of every row). - **Input offset multiplier**: a vertex read is accepted only when its offset half is scaled to bytes (x4); other scales are refused. - **Returned vertex shader kind**: `MergedShaders::vertex` is now `HwStage::Vs` (the geometry one `Gs`). - **Runtime table loads**: not proven, narrowed. Every load from the table still reads as zero, taken to be the base of the output records; what the translator can check is that the program reads one field of the table only (a second field is refused: `more than one field read from the runtime table`). That the one field is the output base, and is used as nothing else, is an assumption on a title program that nothing here checks; it stays in the list of what is assumed. - Also refused: a half-precision geometry output (it was passed through as raw bits). `cargo test -p victory-shader --lib --locked`: 251 passed, 0 failed.
chatgpt-codex-connector[bot commented 2026-11-25 01:12:10 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by chatgpt-codex-connector[bot] on 2026-11-25T00:21:15Z.

Code review location: crates/victory-shader/src/emit/lower.rs; line 4778

@@ -4653,6 +4774,9 @@ impl<'a> Lower<'a> {
                     .op(self.cur, "barrier", Attr::NoDuplicate, void, 80, &[mode]);
                 Ok(())
             }
+            Fields::Sopp { .. } if name == "s_sendmsg" && self.x.gs.is_some() => {
+                self.gs_message(inst, (b, i))

P2 Badge Dispatch s_sendmsghalt geometry messages

merged::message_of and GsPlan recognize both s_sendmsg and s_sendmsghalt, so a halt-form GS_EMIT or GS_CUT is counted and assigned in the plan. This dispatch only calls gs_message for s_sendmsg; the halt form falls through as a no-op, leaving the returned shader with a reserved vertex or cut that it never emits. Handle both opcodes, including their halt behavior, or refuse the halt form.

Useful? React with 👍 / 👎.

<!-- greyfinch-sync:fxceless/victory-fork:review-comment:4688458045 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/381#discussion_r4688458045). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-25T00:21:15Z. **Code review location:** `crates/victory-shader/src/emit/lower.rs`; line 4778 ~~~~diff @@ -4653,6 +4774,9 @@ impl<'a> Lower<'a> { .op(self.cur, "barrier", Attr::NoDuplicate, void, 80, &[mode]); Ok(()) } + Fields::Sopp { .. } if name == "s_sendmsg" && self.x.gs.is_some() => { + self.gs_message(inst, (b, i)) ~~~~ --- **<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Dispatch `s_sendmsghalt` geometry messages** `merged::message_of` and `GsPlan` recognize both `s_sendmsg` and `s_sendmsghalt`, so a halt-form `GS_EMIT` or `GS_CUT` is counted and assigned in the plan. This dispatch only calls `gs_message` for `s_sendmsg`; the halt form falls through as a no-op, leaving the returned shader with a reserved vertex or cut that it never emits. Handle both opcodes, including their halt behavior, or refuse the halt form. Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
chatgpt-codex-connector[bot commented 2026-11-25 01:12:10 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by chatgpt-codex-connector[bot] on 2026-11-25T00:21:15Z.

Code review location: crates/victory-shader/src/emit/lower.rs; line 4299

@@ -4191,6 +4201,113 @@ impl<'a> Lower<'a> {
             .collect()
     }
 
+    /// A geometry program LDS access ([`super::gs::GsPlan`]): a read of an
+    /// input vertex record is `loadInput`, the records it writes and reads
+    /// back are an array of its own. `false` for what is no LDS access
+    /// (`ds_swizzle`, permutes).
+    fn gs_ds(&mut self, inst: &Inst, site: Site) -> Result<bool, Why> {
+        let name = inst.name();
+        if name.starts_with("ds_swizzle") || name.contains("permute") {
+            return Ok(false);
+        }
+        let x = self.x;
+        let Some(g) = x.gs.as_ref() else {
+            return Ok(false);
+        };
+        let Fields::Ds { data, .. } = &inst.fields else {
+            unreachable!()
+        };
+        let guard = self.guard(site.0, site.1)?;
+        let c = self.cur;
+        if let Some(r) = g.reads.get(&site) {
+            for k in 0..r.count {
+                let d = r.dword + k;
+                let (id, col) = (d / 4, d % 4);
+                let known = self.s.inputs.get(id as usize).is_some_and(|e| u32::from(e.cols) > col);
+                if !known {
+                    return Err("a read of a record dword the signature does not have");
+                }
+                let args = [
+                    self.s.m.i32(id),
+                    self.s.m.i32(0),
+                    self.s.m.i8(col as u8),
+                    self.s.m.i32(u32::from(r.vertex)),
+                ];
+                let i32t = self.s.t.i32;
+                let v = self.s.op(c, "loadInput.i32", Attr::ReadNone, i32t, 4, &args);
+                self.write(inst, Reg::V(r.reg + k as u8), v, guard);
+            }
+            return Ok(true);
+        }
+        if let Some(&(at, count, _)) = g.stores.get(&site) {
+            let vals = self.vgprs(inst, data.first().ok_or("an LDS write")?, count as u8)?;
+            let arr = self.s.lds();
+            let open = self.begin_guarded(guard);
+            for (k, v) in vals.into_iter().enumerate() {
+                let index = self.s.m.i32(at + k as u32);
+                let p = self.s.m.element(self.cur, arr, index);
+                self.s.m.store(self.cur, p, v);
+            }
+            self.end_guarded(open, &[]);
+            return Ok(true);
+        }
+        if let Some(&(at, count, reg)) = g.loads.get(&site) {
+            let arr = self.s.lds();
+            for k in 0..count {
+                let index = self.s.m.i32(at + k);
+                let p = self.s.m.element(c, arr, index);
+                let v = self.s.m.load(c, p);
+                self.write(inst, Reg::V(reg + k as u8), v, guard);
+            }
+            return Ok(true);
+        }
+        Err("an LDS access the geometry plan does not cover")
+    }
+
+    /// `s_sendmsg` of a geometry program: `GS_EMIT` writes the next record
+    /// of the array to the outputs and emits the vertex, `GS_CUT` ends the
+    /// strip; the other messages (`GS_DONE`, allocation) are left out.
+    fn gs_message(&mut self, _inst: &Inst, site: Site) -> Result<(), Why> {
+        let x = self.x;
+        let Some(g) = x.gs.as_ref() else {
+            return Ok(());
+        };
+        let Some(&(n, msg)) = g.messages.get(&site) else {
+            return Ok(());
+        };
+        let guard = self.guard(site.0, site.1)?;
+        let open = self.begin_guarded(guard);
+        let void = self.s.t.void;
+        let stream = self.s.m.i8(0);
+        if msg.vertices() == 1 {
+            let arr = self.s.lds();
+            let outputs = self.s.outputs.clone();
+            for (id, e) in outputs.iter().enumerate() {
+                let row = e.row.ok_or("a geometry output without a register")?;
+                for k in 0..e.cols {
+                    let c = self.cur;
+                    let dword = n * g.record_dwords + 4 * row + u32::from(e.col) + u32::from(k);
+                    let index = self.s.m.i32(dword);
+                    let p = self.s.m.element(c, arr, index);
+                    let bits = self.s.m.load(c, p);
+                    let (name, value) = if e.comp == 9 {
+                        ("storeOutput.f32", self.as_float(bits))
+                    } else {
+                        ("storeOutput.i32", bits)
+                    };
+                    let args = [self.s.m.i32(id as u32), self.s.m.i32(0), self.s.m.i8(k), value];
+                    self.s.op(self.cur, name, Attr::NoUnwind, void, 5, &args);

P2 Badge Mark geometry output components as written

When the GS writes outputs through this GS_EMIT path, the elements parsed from OSG1 have usage = 0, and these storeOutput calls never update the corresponding usage bits. Unlike the normal output lowering path, the resulting geometry signature is serialized as if none of those components were used, so it does not describe the values the shader stores and can mislead downstream stage linkage. Mark each component as it is stored.

Useful? React with 👍 / 👎.

<!-- greyfinch-sync:fxceless/victory-fork:review-comment:4688458052 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/381#discussion_r4688458052). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-25T00:21:15Z. **Code review location:** `crates/victory-shader/src/emit/lower.rs`; line 4299 ~~~~diff @@ -4191,6 +4201,113 @@ impl<'a> Lower<'a> { .collect() } + /// A geometry program LDS access ([`super::gs::GsPlan`]): a read of an + /// input vertex record is `loadInput`, the records it writes and reads + /// back are an array of its own. `false` for what is no LDS access + /// (`ds_swizzle`, permutes). + fn gs_ds(&mut self, inst: &Inst, site: Site) -> Result<bool, Why> { + let name = inst.name(); + if name.starts_with("ds_swizzle") || name.contains("permute") { + return Ok(false); + } + let x = self.x; + let Some(g) = x.gs.as_ref() else { + return Ok(false); + }; + let Fields::Ds { data, .. } = &inst.fields else { + unreachable!() + }; + let guard = self.guard(site.0, site.1)?; + let c = self.cur; + if let Some(r) = g.reads.get(&site) { + for k in 0..r.count { + let d = r.dword + k; + let (id, col) = (d / 4, d % 4); + let known = self.s.inputs.get(id as usize).is_some_and(|e| u32::from(e.cols) > col); + if !known { + return Err("a read of a record dword the signature does not have"); + } + let args = [ + self.s.m.i32(id), + self.s.m.i32(0), + self.s.m.i8(col as u8), + self.s.m.i32(u32::from(r.vertex)), + ]; + let i32t = self.s.t.i32; + let v = self.s.op(c, "loadInput.i32", Attr::ReadNone, i32t, 4, &args); + self.write(inst, Reg::V(r.reg + k as u8), v, guard); + } + return Ok(true); + } + if let Some(&(at, count, _)) = g.stores.get(&site) { + let vals = self.vgprs(inst, data.first().ok_or("an LDS write")?, count as u8)?; + let arr = self.s.lds(); + let open = self.begin_guarded(guard); + for (k, v) in vals.into_iter().enumerate() { + let index = self.s.m.i32(at + k as u32); + let p = self.s.m.element(self.cur, arr, index); + self.s.m.store(self.cur, p, v); + } + self.end_guarded(open, &[]); + return Ok(true); + } + if let Some(&(at, count, reg)) = g.loads.get(&site) { + let arr = self.s.lds(); + for k in 0..count { + let index = self.s.m.i32(at + k); + let p = self.s.m.element(c, arr, index); + let v = self.s.m.load(c, p); + self.write(inst, Reg::V(reg + k as u8), v, guard); + } + return Ok(true); + } + Err("an LDS access the geometry plan does not cover") + } + + /// `s_sendmsg` of a geometry program: `GS_EMIT` writes the next record + /// of the array to the outputs and emits the vertex, `GS_CUT` ends the + /// strip; the other messages (`GS_DONE`, allocation) are left out. + fn gs_message(&mut self, _inst: &Inst, site: Site) -> Result<(), Why> { + let x = self.x; + let Some(g) = x.gs.as_ref() else { + return Ok(()); + }; + let Some(&(n, msg)) = g.messages.get(&site) else { + return Ok(()); + }; + let guard = self.guard(site.0, site.1)?; + let open = self.begin_guarded(guard); + let void = self.s.t.void; + let stream = self.s.m.i8(0); + if msg.vertices() == 1 { + let arr = self.s.lds(); + let outputs = self.s.outputs.clone(); + for (id, e) in outputs.iter().enumerate() { + let row = e.row.ok_or("a geometry output without a register")?; + for k in 0..e.cols { + let c = self.cur; + let dword = n * g.record_dwords + 4 * row + u32::from(e.col) + u32::from(k); + let index = self.s.m.i32(dword); + let p = self.s.m.element(c, arr, index); + let bits = self.s.m.load(c, p); + let (name, value) = if e.comp == 9 { + ("storeOutput.f32", self.as_float(bits)) + } else { + ("storeOutput.i32", bits) + }; + let args = [self.s.m.i32(id as u32), self.s.m.i32(0), self.s.m.i8(k), value]; + self.s.op(self.cur, name, Attr::NoUnwind, void, 5, &args); ~~~~ --- **<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Mark geometry output components as written** When the GS writes outputs through this `GS_EMIT` path, the elements parsed from `OSG1` have `usage = 0`, and these `storeOutput` calls never update the corresponding usage bits. Unlike the normal output lowering path, the resulting geometry signature is serialized as if none of those components were used, so it does not describe the values the shader stores and can mislead downstream stage linkage. Mark each component as it is stored. Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
chatgpt-codex-connector[bot commented 2026-11-25 01:12:10 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by chatgpt-codex-connector[bot] on 2026-11-25T00:21:15Z.

Code review location: crates/victory-shader/src/emit/lower.rs; line 5430

@@ -5294,6 +5418,19 @@ impl<'a> Lower<'a> {
             unreachable!()
         };
         let name = inst.name();
+        if self.scalar.get(&site).is_some_and(|a| a.param == RUNTIME_TABLE) {
+            // The console runtime table: what is loaded from it is the base
+            // of the GS output in LDS, which the geometry plan does not use
+            // (the records are in an array of the invocation itself). Read as 0.
+            let Some(Operand::Scalar { code, dwords }) = *data else {
+                return Err("a read of the runtime table");
+            };
+            for k in 0..dwords {
+                let zero = self.s.m.i32(0);
+                self.write(inst, Reg::S(code + k), zero, None);

P2 Badge Preserve non-output runtime-table loads

Every scalar load traced to RUNTIME_TABLE reaches this branch without checking its address offset, and every result dword is replaced with zero. Rewriting the GS output array makes its output-base load irrelevant, but a GS that reads another runtime-table field will now use zero in its calculations or control flow and produce different geometry. Restrict this substitution to the identified output-base load or preserve other table reads.

Useful? React with 👍 / 👎.

<!-- greyfinch-sync:fxceless/victory-fork:review-comment:4688458057 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/381#discussion_r4688458057). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-25T00:21:15Z. **Code review location:** `crates/victory-shader/src/emit/lower.rs`; line 5430 ~~~~diff @@ -5294,6 +5418,19 @@ impl<'a> Lower<'a> { unreachable!() }; let name = inst.name(); + if self.scalar.get(&site).is_some_and(|a| a.param == RUNTIME_TABLE) { + // The console runtime table: what is loaded from it is the base + // of the GS output in LDS, which the geometry plan does not use + // (the records are in an array of the invocation itself). Read as 0. + let Some(Operand::Scalar { code, dwords }) = *data else { + return Err("a read of the runtime table"); + }; + for k in 0..dwords { + let zero = self.s.m.i32(0); + self.write(inst, Reg::S(code + k), zero, None); ~~~~ --- **<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Preserve non-output runtime-table loads** Every scalar load traced to `RUNTIME_TABLE` reaches this branch without checking its address offset, and every result dword is replaced with zero. Rewriting the GS output array makes its output-base load irrelevant, but a GS that reads another runtime-table field will now use zero in its calculations or control flow and produce different geometry. Restrict this substitution to the identified output-base load or preserve other table reads. Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
chatgpt-codex-connector[bot commented 2026-11-25 01:12:10 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by chatgpt-codex-connector[bot] on 2026-11-25T00:21:15Z.

Code review location: crates/victory-shader/src/handoff.rs; line 322

@@ -0,0 +1,574 @@
+//! The ES to GS handoff of a merged geometry stage ([`crate::merged`]), as
+//! the code of the two halves shows it.
+//!
+//! The ES half fetches a vertex, writes it to LDS as a fixed-size record
+//! (`ds_write_b32` .. `ds_write_b128` at one base address and constant
+//! offsets), waits at `s_barrier` and leaves through `s_setpc_b64` into the
+//! GS half. The GS half reads the records of the vertices of its primitive
+//! (`ds_read_b32` .. `ds_read_b128`) at the offset the hardware gives it for
+//! each vertex.
+//!
+//! A host vertex shader has no LDS and a host geometry shader no way to read
+//! another stage's memory, so the handoff is modeled, not run: what the ES
+//! half writes at record dword k is output k of the vertex, and what the GS
+//! half reads at vertex v, record dword k is input k of vertex v. This module
+//! finds those writes and reads. Emission is [`crate::emit`]'s.
+//!
+//! What is assumed (the ISA's convention for a merged stage, not checked
+//! against a title program):
+//!
+//! * The GS half gets the ES-ring offsets of its vertices packed two to a
+//!   VGPR: vertex 0 in the low half of v0, vertex 1 in its high half, vertex
+//!   2 in the low half of v1 ([`VERTEX_OFFSETS`]). A read whose address is
+//!   such a half (scaled, plus constants) is a read of that vertex's record;
+//!   a read at any other address is the GS half's own output memory.
+//! * The ES half's writes all use one base address (its vertex's slot) and
+//!   constant offsets, the same units as the GS half's.
+
+use std::collections::{BTreeSet, HashMap};
+
+use crate::ShaderError::{self, Unsupported};
+use crate::gfx10::{Fields, Operand};
+use crate::ir::{Exit, Inst, Program, Reg, Value};
+
+/// Where the GS half finds the ES-ring offset of input vertex `n`: the VGPR
+/// and whether it is the high half.
+pub const VERTEX_OFFSETS: [(u8, bool); 4] = [(0, false), (0, true), (1, false), (1, true)];
+
+/// Triangles in.
+pub const MAX_VERTICES: usize = 3;
+
+type Site = (usize, usize);
+
+/// What a value is, as `base * mul + add` in wrapping 32-bit arithmetic.
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
+pub enum Base {
+    /// No base: `add` is the whole value.
+    Constant,
+    /// A VGPR as it arrived.
+    Input(u8),
+    /// The low or high 16 bits of an arrived VGPR.
+    Half { reg: u8, high: bool },
+    /// Anything else, named by the value that holds it.
+    Opaque(Value),
+}
+
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
+pub struct Lin {
+    pub base: Base,
+    pub mul: u32,
+    pub add: u32,
+}
+
+impl Lin {
+    fn constant(add: u32) -> Lin {
+        Lin { base: Base::Constant, mul: 0, add }
+    }
+
+    fn of(base: Base) -> Lin {
+        Lin { base, mul: 1, add: 0 }
+    }
+
+    fn is_constant(&self) -> bool {
+        self.base == Base::Constant
+    }
+}
+
+struct Eval<'a> {
+    p: &'a Program,
+    defs: HashMap<Value, Site>,
+    inputs: HashMap<Value, u8>,
+}
+
+impl<'a> Eval<'a> {
+    fn new(p: &'a Program) -> Self {
+        let mut defs = HashMap::new();
+        for (b, block) in p.blocks.iter().enumerate() {
+            for (i, inst) in block.insts.iter().enumerate() {
+                for &(_, v) in &inst.writes {
+                    defs.insert(v, (b, i));
+                }
+            }
+        }
+        let inputs = p
+            .inputs
+            .iter()
+            .filter_map(|&(reg, v)| match reg {
+                Reg::V(r) => Some((v, r)),
+                _ => None,
+            })
+            .collect();
+        Eval { p, defs, inputs }
+    }
+
+    fn value(&self, v: Value, depth: u32) -> Lin {
+        if let Some(&r) = self.inputs.get(&v) {
+            return Lin::of(Base::Input(r));
+        }
+        match self.defs.get(&v) {
+            Some(&(b, i)) if depth < 32 => self.inst(&self.p.blocks[b].insts[i], v, depth),
+            _ => Lin::of(Base::Opaque(v)),
+        }
+    }
+
+    fn operand(&self, inst: &Inst, op: &Operand, depth: u32) -> Option<Lin> {
+        match *op {
+            Operand::Const(c @ 128..=192) => Some(Lin::constant(u32::from(c) - 128)),
+            Operand::Const(c @ 193..=208) => Some(Lin::constant(0u32.wrapping_sub(u32::from(c) - 192))),
+            Operand::Literal(l) => Some(Lin::constant(l)),
+            Operand::Vector { reg, .. } => Some(self.value(inst.read(Reg::V(reg))?, depth + 1)),
+            Operand::Scalar { code, .. } => Some(self.value(inst.read(Reg::S(code))?, depth + 1)),
+            _ => None,
+        }
+    }
+
+    fn inst(&self, inst: &Inst, v: Value, depth: u32) -> Lin {
+        let opaque = Lin::of(Base::Opaque(v));
+        let Fields::Valu(f) = &inst.fields else {
+            return opaque;
+        };
+        let args: Option<Vec<Lin>> = f.src.iter().map(|s| self.operand(inst, s, depth)).collect();
+        let Some(a) = args else { return opaque };
+        let c = |l: &Lin| l.is_constant().then_some(l.add);
+        let shifted = |x: Lin, s: u32| Lin {
+            base: x.base,
+            mul: x.mul.wrapping_shl(s),
+            add: x.add.wrapping_shl(s),
+        };
+        let plain = |x: &Lin| x.mul == 1 && x.add == 0;
+        match (inst.name(), a.as_slice()) {
+            ("v_mov_b32", [x]) => *x,
+            ("v_and_b32", [x, y]) | ("v_and_b32", [y, x]) if c(y) == Some(0xFFFF) => match x.base {
+                Base::Input(reg) if plain(x) => Lin::of(Base::Half { reg, high: false }),
+                Base::Half { .. } if plain(x) => *x,
+                _ => opaque,
+            },
+            ("v_lshrrev_b32", [s, x]) if c(s) == Some(16) => match x.base {
+                Base::Input(reg) if plain(x) => Lin::of(Base::Half { reg, high: true }),
+                _ => opaque,
+            },
+            ("v_bfe_u32", [x, off, width]) if c(width) == Some(16) && c(off).is_some_and(|o| o % 16 == 0) => {
+                match x.base {
+                    Base::Input(reg) if plain(x) => Lin::of(Base::Half { reg, high: c(off) == Some(16) }),
+                    _ => opaque,
+                }
+            }
+            ("v_lshlrev_b32", [s, x]) if c(s).is_some_and(|s| s < 32) => {
+                if x.is_constant() {
+                    Lin::constant(x.add.wrapping_shl(c(s).unwrap()))
+                } else {
+                    shifted(*x, c(s).unwrap())
+                }
+            }
+            ("v_add_nc_u32" | "v_add_u32" | "v_add_co_u32", [x, y]) => match (c(x), c(y)) {
+                (Some(p), Some(q)) => Lin::constant(p.wrapping_add(q)),
+                (Some(k), None) => Lin { add: y.add.wrapping_add(k), ..*y },
+                (None, Some(k)) => Lin { add: x.add.wrapping_add(k), ..*x },
+                _ => opaque,
+            },
+            ("v_mul_u32_u24", [x, y]) => match (c(x), c(y)) {
+                (Some(p), Some(q)) => Lin::constant(p.wrapping_mul(q)),
+                (None, Some(k)) | (Some(k), None) => {
+                    let x = if c(x).is_some() { y } else { x };
+                    Lin { base: x.base, mul: x.mul.wrapping_mul(k), add: x.add.wrapping_mul(k) }
+                }
+                _ => opaque,
+            },
+            _ => opaque,
+        }
+    }
+}
+
+/// How many dwords an LDS read or write moves, from its name.
+fn width(name: &str) -> Option<u32> {
+    match name {
+        "ds_read_b32" | "ds_write_b32" => Some(1),
+        "ds_read_b64" | "ds_write_b64" => Some(2),
+        "ds_read_b96" | "ds_write_b96" => Some(3),
+        "ds_read_b128" | "ds_write_b128" => Some(4),
+        _ => None,
+    }
+}
+
+/// Instructions that name LDS in the encoding but touch none.
+fn no_memory(name: &str) -> bool {
+    name.starts_with("ds_swizzle") || name.contains("permute") || name == "ds_nop"
+}
+
+fn unsupported(what: &'static str) -> ShaderError {
+    Unsupported { offset: 0, what }
+}
+
+/// A record write of the ES half: VGPRs `reg..reg + count` go to record
+/// dwords `dword..dword + count`.
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
+pub struct Store {
+    pub site: Site,
+    pub dword: u32,
+    pub count: u32,
+    pub reg: u8,
+}
+
+/// The ES half's record.
+#[derive(Debug, Clone, PartialEq, Eq)]
+pub struct EsRecord {
+    pub stores: Vec<Store>,
+    /// Dwords of the record: past the highest one written.
+    pub dwords: u32,
+    /// An `s_barrier` comes before the handover.
+    pub barrier: bool,
+}
+
+impl EsRecord {
+    /// Whether some store writes record dword `dword`.
+    pub fn writes(&self, dword: u32) -> bool {
+        self.stores.iter().any(|s| (s.dword..s.dword + s.count).contains(&dword))
+    }
+}
+
+/// The records an ES program writes.
+///
+/// Fails when it does not end by handing over to the GS half
+/// (`s_setpc_b64`), touches LDS in any way but whole-dword record writes,
+/// writes at more than one base, or writes nothing.
+pub fn es_record(p: &Program) -> Result<EsRecord, ShaderError> {
+    if !p.blocks.iter().any(|b| b.exit == Exit::Indirect) {
+        return Err(unsupported("an ES half that does not hand over to the GS half"));
+    }
+    let eval = Eval::new(p);
+    let mut stores = Vec::new();
+    let mut at: Option<(Base, u32)> = None;
+    let mut barrier = false;
+    for (b, block) in p.blocks.iter().enumerate() {
+        for (i, inst) in block.insts.iter().enumerate() {
+            barrier |= inst.name() == "s_barrier";
+            let Fields::Ds { addr, data, offset0, offset1, gds, .. } = &inst.fields else {
+                continue;
+            };
+            let name = inst.name();
+            if no_memory(name) {
+                continue;
+            }
+            let Some(count) = width(name).filter(|_| name.starts_with("ds_write") && !gds) else {
+                return Err(unsupported("an LDS access of the ES half other than a record write"));
+            };
+            let Some(Operand::Vector { reg: a, .. }) = *addr else {
+                return Err(unsupported("an LDS write without an address"));
+            };
+            let Some(Operand::Vector { reg: d, .. }) = data.first().copied() else {
+                return Err(unsupported("an LDS write without data"));
+            };
+            let lin = eval.value(inst.read(Reg::V(a)).ok_or(unsupported("an unread LDS address"))?, 0);
+            if lin.is_constant() {
+                return Err(unsupported("a record write at a constant address"));
+            }
+            match at {
+                None => at = Some((lin.base, lin.mul)),
+                Some(first) if first == (lin.base, lin.mul) => {}
+                Some(_) => return Err(unsupported("ES record writes at more than one base")),
+            }
+            let byte = lin.add.wrapping_add(u32::from(*offset0) | u32::from(*offset1) << 8);
+            if byte % 4 != 0 {
+                return Err(unsupported("a record write off a dword"));
+            }
+            stores.push(Store { site: (b, i), dword: byte / 4, count, reg: d });
+        }
+    }
+    let dwords = stores.iter().map(|s| s.dword + s.count).max().ok_or(unsupported("an ES half that writes no record"))?;
+    Ok(EsRecord { stores, dwords, barrier })
+}
+
+/// A read of one input vertex's record by the GS half: record dwords
+/// `dword..dword + count` of vertex `vertex` go to VGPRs `reg..reg + count`.
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
+pub struct VertexRead {
+    pub site: Site,
+    pub vertex: u8,
+    pub dword: u32,
+    pub count: u32,
+    pub reg: u8,
+}
+
+/// The reads of input vertices in a GS program, in code order. Reads at
+/// other addresses are the program's own output memory and are left out.
+pub fn vertex_reads(p: &Program) -> Result<Vec<VertexRead>, ShaderError> {
+    let eval = Eval::new(p);
+    let mut out = Vec::new();
+    for (b, block) in p.blocks.iter().enumerate() {
+        for (i, inst) in block.insts.iter().enumerate() {
+            let Fields::Ds { dst, addr, offset0, offset1, gds, .. } = &inst.fields else {
+                continue;
+            };
+            let name = inst.name();
+            if no_memory(name) || *gds || !name.starts_with("ds_read") {
+                continue;
+            }
+            let Some(Operand::Vector { reg: a, .. }) = *addr else { continue };
+            let Some(v) = inst.read(Reg::V(a)) else { continue };
+            let lin = eval.value(v, 0);
+            let Base::Half { reg, high } = lin.base else { continue };
+            let Some(vertex) = VERTEX_OFFSETS.iter().position(|&o| o == (reg, high)) else {
+                return Err(unsupported("a read at the offset half of no input vertex"));
+            };
+            if vertex >= MAX_VERTICES {
+                return Err(unsupported("a geometry input of more than three vertices"));
+            }
+            let Some(count) = width(name) else {
+                return Err(unsupported("an LDS read of a vertex record that is not whole dwords"));
+            };
+            let Some(Operand::Vector { reg: d, .. }) = *dst else {
+                return Err(unsupported("an LDS read without a destination"));
+            };
+            let byte = lin.add.wrapping_add(u32::from(*offset0) | u32::from(*offset1) << 8);

P2 Badge Account for the input-offset multiplier

Eval preserves the multiplier for an input-vertex offset, but this mapping computes the record dword using only the additive part and the DS instruction offset. A read using a scale other than the expected byte scale is therefore accepted as the same vertex/dword, then replaced by loadInput for a different component. Validate the multiplier before constructing the VertexRead, or account for it when resolving the record address.

Useful? React with 👍 / 👎.

<!-- greyfinch-sync:fxceless/victory-fork:review-comment:4688458065 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/381#discussion_r4688458065). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-25T00:21:15Z. **Code review location:** `crates/victory-shader/src/handoff.rs`; line 322 ~~~~diff @@ -0,0 +1,574 @@ +//! The ES to GS handoff of a merged geometry stage ([`crate::merged`]), as +//! the code of the two halves shows it. +//! +//! The ES half fetches a vertex, writes it to LDS as a fixed-size record +//! (`ds_write_b32` .. `ds_write_b128` at one base address and constant +//! offsets), waits at `s_barrier` and leaves through `s_setpc_b64` into the +//! GS half. The GS half reads the records of the vertices of its primitive +//! (`ds_read_b32` .. `ds_read_b128`) at the offset the hardware gives it for +//! each vertex. +//! +//! A host vertex shader has no LDS and a host geometry shader no way to read +//! another stage's memory, so the handoff is modeled, not run: what the ES +//! half writes at record dword k is output k of the vertex, and what the GS +//! half reads at vertex v, record dword k is input k of vertex v. This module +//! finds those writes and reads. Emission is [`crate::emit`]'s. +//! +//! What is assumed (the ISA's convention for a merged stage, not checked +//! against a title program): +//! +//! * The GS half gets the ES-ring offsets of its vertices packed two to a +//! VGPR: vertex 0 in the low half of v0, vertex 1 in its high half, vertex +//! 2 in the low half of v1 ([`VERTEX_OFFSETS`]). A read whose address is +//! such a half (scaled, plus constants) is a read of that vertex's record; +//! a read at any other address is the GS half's own output memory. +//! * The ES half's writes all use one base address (its vertex's slot) and +//! constant offsets, the same units as the GS half's. + +use std::collections::{BTreeSet, HashMap}; + +use crate::ShaderError::{self, Unsupported}; +use crate::gfx10::{Fields, Operand}; +use crate::ir::{Exit, Inst, Program, Reg, Value}; + +/// Where the GS half finds the ES-ring offset of input vertex `n`: the VGPR +/// and whether it is the high half. +pub const VERTEX_OFFSETS: [(u8, bool); 4] = [(0, false), (0, true), (1, false), (1, true)]; + +/// Triangles in. +pub const MAX_VERTICES: usize = 3; + +type Site = (usize, usize); + +/// What a value is, as `base * mul + add` in wrapping 32-bit arithmetic. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum Base { + /// No base: `add` is the whole value. + Constant, + /// A VGPR as it arrived. + Input(u8), + /// The low or high 16 bits of an arrived VGPR. + Half { reg: u8, high: bool }, + /// Anything else, named by the value that holds it. + Opaque(Value), +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub struct Lin { + pub base: Base, + pub mul: u32, + pub add: u32, +} + +impl Lin { + fn constant(add: u32) -> Lin { + Lin { base: Base::Constant, mul: 0, add } + } + + fn of(base: Base) -> Lin { + Lin { base, mul: 1, add: 0 } + } + + fn is_constant(&self) -> bool { + self.base == Base::Constant + } +} + +struct Eval<'a> { + p: &'a Program, + defs: HashMap<Value, Site>, + inputs: HashMap<Value, u8>, +} + +impl<'a> Eval<'a> { + fn new(p: &'a Program) -> Self { + let mut defs = HashMap::new(); + for (b, block) in p.blocks.iter().enumerate() { + for (i, inst) in block.insts.iter().enumerate() { + for &(_, v) in &inst.writes { + defs.insert(v, (b, i)); + } + } + } + let inputs = p + .inputs + .iter() + .filter_map(|&(reg, v)| match reg { + Reg::V(r) => Some((v, r)), + _ => None, + }) + .collect(); + Eval { p, defs, inputs } + } + + fn value(&self, v: Value, depth: u32) -> Lin { + if let Some(&r) = self.inputs.get(&v) { + return Lin::of(Base::Input(r)); + } + match self.defs.get(&v) { + Some(&(b, i)) if depth < 32 => self.inst(&self.p.blocks[b].insts[i], v, depth), + _ => Lin::of(Base::Opaque(v)), + } + } + + fn operand(&self, inst: &Inst, op: &Operand, depth: u32) -> Option<Lin> { + match *op { + Operand::Const(c @ 128..=192) => Some(Lin::constant(u32::from(c) - 128)), + Operand::Const(c @ 193..=208) => Some(Lin::constant(0u32.wrapping_sub(u32::from(c) - 192))), + Operand::Literal(l) => Some(Lin::constant(l)), + Operand::Vector { reg, .. } => Some(self.value(inst.read(Reg::V(reg))?, depth + 1)), + Operand::Scalar { code, .. } => Some(self.value(inst.read(Reg::S(code))?, depth + 1)), + _ => None, + } + } + + fn inst(&self, inst: &Inst, v: Value, depth: u32) -> Lin { + let opaque = Lin::of(Base::Opaque(v)); + let Fields::Valu(f) = &inst.fields else { + return opaque; + }; + let args: Option<Vec<Lin>> = f.src.iter().map(|s| self.operand(inst, s, depth)).collect(); + let Some(a) = args else { return opaque }; + let c = |l: &Lin| l.is_constant().then_some(l.add); + let shifted = |x: Lin, s: u32| Lin { + base: x.base, + mul: x.mul.wrapping_shl(s), + add: x.add.wrapping_shl(s), + }; + let plain = |x: &Lin| x.mul == 1 && x.add == 0; + match (inst.name(), a.as_slice()) { + ("v_mov_b32", [x]) => *x, + ("v_and_b32", [x, y]) | ("v_and_b32", [y, x]) if c(y) == Some(0xFFFF) => match x.base { + Base::Input(reg) if plain(x) => Lin::of(Base::Half { reg, high: false }), + Base::Half { .. } if plain(x) => *x, + _ => opaque, + }, + ("v_lshrrev_b32", [s, x]) if c(s) == Some(16) => match x.base { + Base::Input(reg) if plain(x) => Lin::of(Base::Half { reg, high: true }), + _ => opaque, + }, + ("v_bfe_u32", [x, off, width]) if c(width) == Some(16) && c(off).is_some_and(|o| o % 16 == 0) => { + match x.base { + Base::Input(reg) if plain(x) => Lin::of(Base::Half { reg, high: c(off) == Some(16) }), + _ => opaque, + } + } + ("v_lshlrev_b32", [s, x]) if c(s).is_some_and(|s| s < 32) => { + if x.is_constant() { + Lin::constant(x.add.wrapping_shl(c(s).unwrap())) + } else { + shifted(*x, c(s).unwrap()) + } + } + ("v_add_nc_u32" | "v_add_u32" | "v_add_co_u32", [x, y]) => match (c(x), c(y)) { + (Some(p), Some(q)) => Lin::constant(p.wrapping_add(q)), + (Some(k), None) => Lin { add: y.add.wrapping_add(k), ..*y }, + (None, Some(k)) => Lin { add: x.add.wrapping_add(k), ..*x }, + _ => opaque, + }, + ("v_mul_u32_u24", [x, y]) => match (c(x), c(y)) { + (Some(p), Some(q)) => Lin::constant(p.wrapping_mul(q)), + (None, Some(k)) | (Some(k), None) => { + let x = if c(x).is_some() { y } else { x }; + Lin { base: x.base, mul: x.mul.wrapping_mul(k), add: x.add.wrapping_mul(k) } + } + _ => opaque, + }, + _ => opaque, + } + } +} + +/// How many dwords an LDS read or write moves, from its name. +fn width(name: &str) -> Option<u32> { + match name { + "ds_read_b32" | "ds_write_b32" => Some(1), + "ds_read_b64" | "ds_write_b64" => Some(2), + "ds_read_b96" | "ds_write_b96" => Some(3), + "ds_read_b128" | "ds_write_b128" => Some(4), + _ => None, + } +} + +/// Instructions that name LDS in the encoding but touch none. +fn no_memory(name: &str) -> bool { + name.starts_with("ds_swizzle") || name.contains("permute") || name == "ds_nop" +} + +fn unsupported(what: &'static str) -> ShaderError { + Unsupported { offset: 0, what } +} + +/// A record write of the ES half: VGPRs `reg..reg + count` go to record +/// dwords `dword..dword + count`. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub struct Store { + pub site: Site, + pub dword: u32, + pub count: u32, + pub reg: u8, +} + +/// The ES half's record. +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct EsRecord { + pub stores: Vec<Store>, + /// Dwords of the record: past the highest one written. + pub dwords: u32, + /// An `s_barrier` comes before the handover. + pub barrier: bool, +} + +impl EsRecord { + /// Whether some store writes record dword `dword`. + pub fn writes(&self, dword: u32) -> bool { + self.stores.iter().any(|s| (s.dword..s.dword + s.count).contains(&dword)) + } +} + +/// The records an ES program writes. +/// +/// Fails when it does not end by handing over to the GS half +/// (`s_setpc_b64`), touches LDS in any way but whole-dword record writes, +/// writes at more than one base, or writes nothing. +pub fn es_record(p: &Program) -> Result<EsRecord, ShaderError> { + if !p.blocks.iter().any(|b| b.exit == Exit::Indirect) { + return Err(unsupported("an ES half that does not hand over to the GS half")); + } + let eval = Eval::new(p); + let mut stores = Vec::new(); + let mut at: Option<(Base, u32)> = None; + let mut barrier = false; + for (b, block) in p.blocks.iter().enumerate() { + for (i, inst) in block.insts.iter().enumerate() { + barrier |= inst.name() == "s_barrier"; + let Fields::Ds { addr, data, offset0, offset1, gds, .. } = &inst.fields else { + continue; + }; + let name = inst.name(); + if no_memory(name) { + continue; + } + let Some(count) = width(name).filter(|_| name.starts_with("ds_write") && !gds) else { + return Err(unsupported("an LDS access of the ES half other than a record write")); + }; + let Some(Operand::Vector { reg: a, .. }) = *addr else { + return Err(unsupported("an LDS write without an address")); + }; + let Some(Operand::Vector { reg: d, .. }) = data.first().copied() else { + return Err(unsupported("an LDS write without data")); + }; + let lin = eval.value(inst.read(Reg::V(a)).ok_or(unsupported("an unread LDS address"))?, 0); + if lin.is_constant() { + return Err(unsupported("a record write at a constant address")); + } + match at { + None => at = Some((lin.base, lin.mul)), + Some(first) if first == (lin.base, lin.mul) => {} + Some(_) => return Err(unsupported("ES record writes at more than one base")), + } + let byte = lin.add.wrapping_add(u32::from(*offset0) | u32::from(*offset1) << 8); + if byte % 4 != 0 { + return Err(unsupported("a record write off a dword")); + } + stores.push(Store { site: (b, i), dword: byte / 4, count, reg: d }); + } + } + let dwords = stores.iter().map(|s| s.dword + s.count).max().ok_or(unsupported("an ES half that writes no record"))?; + Ok(EsRecord { stores, dwords, barrier }) +} + +/// A read of one input vertex's record by the GS half: record dwords +/// `dword..dword + count` of vertex `vertex` go to VGPRs `reg..reg + count`. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub struct VertexRead { + pub site: Site, + pub vertex: u8, + pub dword: u32, + pub count: u32, + pub reg: u8, +} + +/// The reads of input vertices in a GS program, in code order. Reads at +/// other addresses are the program's own output memory and are left out. +pub fn vertex_reads(p: &Program) -> Result<Vec<VertexRead>, ShaderError> { + let eval = Eval::new(p); + let mut out = Vec::new(); + for (b, block) in p.blocks.iter().enumerate() { + for (i, inst) in block.insts.iter().enumerate() { + let Fields::Ds { dst, addr, offset0, offset1, gds, .. } = &inst.fields else { + continue; + }; + let name = inst.name(); + if no_memory(name) || *gds || !name.starts_with("ds_read") { + continue; + } + let Some(Operand::Vector { reg: a, .. }) = *addr else { continue }; + let Some(v) = inst.read(Reg::V(a)) else { continue }; + let lin = eval.value(v, 0); + let Base::Half { reg, high } = lin.base else { continue }; + let Some(vertex) = VERTEX_OFFSETS.iter().position(|&o| o == (reg, high)) else { + return Err(unsupported("a read at the offset half of no input vertex")); + }; + if vertex >= MAX_VERTICES { + return Err(unsupported("a geometry input of more than three vertices")); + } + let Some(count) = width(name) else { + return Err(unsupported("an LDS read of a vertex record that is not whole dwords")); + }; + let Some(Operand::Vector { reg: d, .. }) = *dst else { + return Err(unsupported("an LDS read without a destination")); + }; + let byte = lin.add.wrapping_add(u32::from(*offset0) | u32::from(*offset1) << 8); ~~~~ --- **<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Account for the input-offset multiplier** `Eval` preserves the multiplier for an input-vertex offset, but this mapping computes the record dword using only the additive part and the DS instruction offset. A read using a scale other than the expected byte scale is therefore accepted as the same vertex/dword, then replaced by `loadInput` for a different component. Validate the multiplier before constructing the `VertexRead`, or account for it when resolving the record address. Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
chatgpt-codex-connector[bot commented 2026-11-25 01:12:10 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by chatgpt-codex-connector[bot] on 2026-11-25T00:21:15Z.

Code review location: crates/victory-shader/src/emit/gs.rs; line 169

@@ -0,0 +1,405 @@
+//! A merged ES+GS stage as two host shaders (step 4 of geometry shader
+//! support, `merged`, `handoff`): a vertex shader and a geometry shader.
+//!
+//! The console runs the stage as one wave: the ES half writes each vertex's
+//! record to LDS, the GS half reads the records of its triangle's vertices
+//! from there, writes its output vertices to LDS too and sends `GS_EMIT` /
+//! `GS_CUT`. The host has no LDS in those stages, so the translation splits
+//! the stage where the data crosses:
+//!
+//! * The ES half becomes a vertex shader. Each record dword it writes is
+//!   output `k` of its vertex: row `k / 4`, channel `k % 4` of a signature
+//!   made for the purpose (`TEXCOORD<row>`, 32-bit integers, the dwords
+//!   untouched). The rewrite is of the machine code: a `ds_write_b32` ..
+//!   `b128` becomes the `exp param<row>` of the same size, `s_barrier` a
+//!   `s_nop` and the `s_setpc_b64` handover an `s_endpgm`.
+//! * The GS half becomes a geometry shader (triangles in, triangle strip out,
+//!   stream 0). Its reads of an input vertex's record are `loadInput` of that
+//!   signature at that vertex. Its writes to its own LDS are writes to an
+//!   array private to the invocation, at the offset from the first record
+//!   written (the base, the runtime table's value and the lane, only
+//!   separate invocations that have one array each here). Its k-th
+//!   `GS_EMIT` copies the k-th record of that array to the output signature
+//!   and emits the vertex; `GS_CUT` ends the strip.
+//!
+//! What this assumes, none of it read from the stage data or checked on a
+//! title program (see the pull request):
+//!
+//! * An output record has 4 dwords per signature register: the dword at
+//!   `4 * row + column` is that channel of the output with that register, in
+//!   the geometry container's output signature, and the records follow each
+//!   other without a gap. The written range has to be exactly that many
+//!   records, one per emit, or the program is refused.
+//! * Each emit instruction in the code is one vertex: emits are numbered in
+//!   code order, so alternative arms that emit are refused.
+//! * The topology is a triangle strip and the stage has one instance.
+
+use std::collections::HashMap;
+
+use super::container::SigElement;
+use crate::ShaderError::{self, Unsupported};
+use crate::handoff::{Handoff, Access, VertexRead, own_accesses};
+use crate::ir::Program;
+use crate::merged::{GsMessage, MergedGs, limits, message_of};
+use crate::native::{NativeProgram, StageIo, Usage, VsOutput};
+
+type Site = (usize, usize);
+
+fn unsupported(what: &'static str) -> ShaderError {
+    Unsupported { offset: 0, what }
+}
+
+/// What the lowering of a GS program does with its LDS accesses and
+/// messages.
+#[derive(Debug, Clone, Default)]
+pub(crate) struct GsPlan {
+    /// Reads of an input vertex's record.
+    pub reads: HashMap<Site, VertexRead>,
+    /// Writes to the program's own array: (first dword in it, dwords, first
+    /// VGPR).
+    pub stores: HashMap<Site, (u32, u32, u8)>,
+    /// Reads back from it.
+    pub loads: HashMap<Site, (u32, u32, u8)>,
+    /// `GS_EMIT` and friends: the emit's number and the message.
+    pub messages: HashMap<Site, (u32, GsMessage)>,
+    /// Dwords of an output record.
+    pub record_dwords: u32,
+    /// Dwords of the array (the records of every emit).
+    pub array_dwords: u32,
+    pub max_vertices: u32,
+}
+
+/// The signature of the records between the halves: one `TEXCOORD` register
+/// per four dwords, 32-bit integers.
+pub(crate) fn record_signature(dwords: u32) -> Vec<SigElement> {
+    (0..dwords.div_ceil(4))
+        .map(|row| {
+            let cols = (dwords - 4 * row).min(4) as u8;
+            SigElement {
+                name: "TEXCOORD".into(),
+                index: row,
+                kind: 0,
+                comp: 5,
+                interp: 1,
+                row: Some(row),
+                col: 0,
+                cols,
+                usage: (1 << cols) - 1,
+                half: false,
+            }
+        })
+        .collect()
+}
+
+/// The vertex id input of the ES half as a vertex shader.
+pub(crate) fn vertex_id_input() -> Vec<SigElement> {
+    vec![SigElement {
+        name: "SV_VertexID".into(),
+        index: 0,
+        kind: 1,
+        comp: 5,
+        interp: 0,
+        row: Some(0),
+        col: 0,
+        cols: 1,
+        usage: 1,
+        half: false,
+    }]
+}
+
+/// The ES half as a vertex shader: `code` with the record writes as exports
+/// (see the module notes) and the I/O of a vertex shader whose outputs are the
+/// record's rows.
+pub(crate) fn es_as_vertex_shader(
+    merged: &MergedGs,
+    es: &Program,
+    handoff: &Handoff,
+) -> Result<NativeProgram, ShaderError> {
+    let mut code = merged.es.code.clone();
+    let mut put = |at: usize, words: &[u32]| -> Result<(), ShaderError> {
+        if code.get(at..at + 4 * words.len()).is_none() {
+            return Err(unsupported("an ES instruction outside the code"));
+        }
+        for (k, w) in words.iter().enumerate() {
+            code[at + 4 * k..at + 4 * k + 4].copy_from_slice(&w.to_le_bytes());
+        }
+        Ok(())
+    };
+    for s in &handoff.es.stores {
+        let inst = &es.blocks[s.site.0].insts[s.site.1];
+        let (row, ch) = (s.dword / 4, s.dword % 4);
+        if ch + s.count > 4 {
+            return Err(unsupported("a record write across two registers"));
+        }
+        // exp param<row>, the written VGPRs in their channels
+        let en = ((1u32 << s.count) - 1) << ch;
+        let word0 = 0xF800_0000 | (32 + row) << 4 | en;
+        let mut regs = [0u32; 4];
+        for k in 0..s.count {
+            regs[(ch + k) as usize] = u32::from(s.reg) + k;
+        }
+        let word1 = regs[0] | regs[1] << 8 | regs[2] << 16 | regs[3] << 24;
+        put(inst.machine.offset, &[word0, word1])?;
+    }
+    for b in &es.blocks {
+        for inst in &b.insts {
+            match inst.name() {
+                "s_barrier" => put(inst.machine.offset, &[0xBF80_0000])?,
+                "s_setpc_b64" => put(inst.machine.offset, &[0xBF81_0000])?,
+                _ => {}
+            }
+        }
+    }
+    let outputs = (0..handoff.es.dwords.div_ceil(4))
+        .map(|row| VsOutput {
+            usage: Usage::Generic,
+            row: row as u8,
+            param: row as u8,
+            fp16: false,
+            pack2: false,
+        })
+        .collect();
+    Ok(NativeProgram {
+        layout: merged.layout.clone(),
+        io: StageIo::Vs {
+            inputs: Vec::new(),
+            outputs,
+        },
+        code,
+        ..merged.es.clone()

P2 Badge Return the ES shader with the vertex stage kind

..merged.es.clone() preserves stage = HwStage::Es; emit_program_with copies that into HostShader.stage even though the emitted DXIL is a vertex shader. Consumers that dispatch on this field, as the existing translator host check does, will treat the returned vertex shader as a non-vertex stage. Keep the ES stage for machine-code and root-data mapping, but set the returned host shader's stage to Vs.

Useful? React with 👍 / 👎.

<!-- greyfinch-sync:fxceless/victory-fork:review-comment:4688458073 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/381#discussion_r4688458073). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-25T00:21:15Z. **Code review location:** `crates/victory-shader/src/emit/gs.rs`; line 169 ~~~~diff @@ -0,0 +1,405 @@ +//! A merged ES+GS stage as two host shaders (step 4 of geometry shader +//! support, `merged`, `handoff`): a vertex shader and a geometry shader. +//! +//! The console runs the stage as one wave: the ES half writes each vertex's +//! record to LDS, the GS half reads the records of its triangle's vertices +//! from there, writes its output vertices to LDS too and sends `GS_EMIT` / +//! `GS_CUT`. The host has no LDS in those stages, so the translation splits +//! the stage where the data crosses: +//! +//! * The ES half becomes a vertex shader. Each record dword it writes is +//! output `k` of its vertex: row `k / 4`, channel `k % 4` of a signature +//! made for the purpose (`TEXCOORD<row>`, 32-bit integers, the dwords +//! untouched). The rewrite is of the machine code: a `ds_write_b32` .. +//! `b128` becomes the `exp param<row>` of the same size, `s_barrier` a +//! `s_nop` and the `s_setpc_b64` handover an `s_endpgm`. +//! * The GS half becomes a geometry shader (triangles in, triangle strip out, +//! stream 0). Its reads of an input vertex's record are `loadInput` of that +//! signature at that vertex. Its writes to its own LDS are writes to an +//! array private to the invocation, at the offset from the first record +//! written (the base, the runtime table's value and the lane, only +//! separate invocations that have one array each here). Its k-th +//! `GS_EMIT` copies the k-th record of that array to the output signature +//! and emits the vertex; `GS_CUT` ends the strip. +//! +//! What this assumes, none of it read from the stage data or checked on a +//! title program (see the pull request): +//! +//! * An output record has 4 dwords per signature register: the dword at +//! `4 * row + column` is that channel of the output with that register, in +//! the geometry container's output signature, and the records follow each +//! other without a gap. The written range has to be exactly that many +//! records, one per emit, or the program is refused. +//! * Each emit instruction in the code is one vertex: emits are numbered in +//! code order, so alternative arms that emit are refused. +//! * The topology is a triangle strip and the stage has one instance. + +use std::collections::HashMap; + +use super::container::SigElement; +use crate::ShaderError::{self, Unsupported}; +use crate::handoff::{Handoff, Access, VertexRead, own_accesses}; +use crate::ir::Program; +use crate::merged::{GsMessage, MergedGs, limits, message_of}; +use crate::native::{NativeProgram, StageIo, Usage, VsOutput}; + +type Site = (usize, usize); + +fn unsupported(what: &'static str) -> ShaderError { + Unsupported { offset: 0, what } +} + +/// What the lowering of a GS program does with its LDS accesses and +/// messages. +#[derive(Debug, Clone, Default)] +pub(crate) struct GsPlan { + /// Reads of an input vertex's record. + pub reads: HashMap<Site, VertexRead>, + /// Writes to the program's own array: (first dword in it, dwords, first + /// VGPR). + pub stores: HashMap<Site, (u32, u32, u8)>, + /// Reads back from it. + pub loads: HashMap<Site, (u32, u32, u8)>, + /// `GS_EMIT` and friends: the emit's number and the message. + pub messages: HashMap<Site, (u32, GsMessage)>, + /// Dwords of an output record. + pub record_dwords: u32, + /// Dwords of the array (the records of every emit). + pub array_dwords: u32, + pub max_vertices: u32, +} + +/// The signature of the records between the halves: one `TEXCOORD` register +/// per four dwords, 32-bit integers. +pub(crate) fn record_signature(dwords: u32) -> Vec<SigElement> { + (0..dwords.div_ceil(4)) + .map(|row| { + let cols = (dwords - 4 * row).min(4) as u8; + SigElement { + name: "TEXCOORD".into(), + index: row, + kind: 0, + comp: 5, + interp: 1, + row: Some(row), + col: 0, + cols, + usage: (1 << cols) - 1, + half: false, + } + }) + .collect() +} + +/// The vertex id input of the ES half as a vertex shader. +pub(crate) fn vertex_id_input() -> Vec<SigElement> { + vec![SigElement { + name: "SV_VertexID".into(), + index: 0, + kind: 1, + comp: 5, + interp: 0, + row: Some(0), + col: 0, + cols: 1, + usage: 1, + half: false, + }] +} + +/// The ES half as a vertex shader: `code` with the record writes as exports +/// (see the module notes) and the I/O of a vertex shader whose outputs are the +/// record's rows. +pub(crate) fn es_as_vertex_shader( + merged: &MergedGs, + es: &Program, + handoff: &Handoff, +) -> Result<NativeProgram, ShaderError> { + let mut code = merged.es.code.clone(); + let mut put = |at: usize, words: &[u32]| -> Result<(), ShaderError> { + if code.get(at..at + 4 * words.len()).is_none() { + return Err(unsupported("an ES instruction outside the code")); + } + for (k, w) in words.iter().enumerate() { + code[at + 4 * k..at + 4 * k + 4].copy_from_slice(&w.to_le_bytes()); + } + Ok(()) + }; + for s in &handoff.es.stores { + let inst = &es.blocks[s.site.0].insts[s.site.1]; + let (row, ch) = (s.dword / 4, s.dword % 4); + if ch + s.count > 4 { + return Err(unsupported("a record write across two registers")); + } + // exp param<row>, the written VGPRs in their channels + let en = ((1u32 << s.count) - 1) << ch; + let word0 = 0xF800_0000 | (32 + row) << 4 | en; + let mut regs = [0u32; 4]; + for k in 0..s.count { + regs[(ch + k) as usize] = u32::from(s.reg) + k; + } + let word1 = regs[0] | regs[1] << 8 | regs[2] << 16 | regs[3] << 24; + put(inst.machine.offset, &[word0, word1])?; + } + for b in &es.blocks { + for inst in &b.insts { + match inst.name() { + "s_barrier" => put(inst.machine.offset, &[0xBF80_0000])?, + "s_setpc_b64" => put(inst.machine.offset, &[0xBF81_0000])?, + _ => {} + } + } + } + let outputs = (0..handoff.es.dwords.div_ceil(4)) + .map(|row| VsOutput { + usage: Usage::Generic, + row: row as u8, + param: row as u8, + fp16: false, + pack2: false, + }) + .collect(); + Ok(NativeProgram { + layout: merged.layout.clone(), + io: StageIo::Vs { + inputs: Vec::new(), + outputs, + }, + code, + ..merged.es.clone() ~~~~ --- **<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Return the ES shader with the vertex stage kind** `..merged.es.clone()` preserves `stage = HwStage::Es`; `emit_program_with` copies that into `HostShader.stage` even though the emitted DXIL is a vertex shader. Consumers that dispatch on this field, as the existing translator host check does, will treat the returned `vertex` shader as a non-vertex stage. Keep the ES stage for machine-code and root-data mapping, but set the returned host shader's stage to `Vs`. Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
Revens2 commented 2026-11-25 08:08:57 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by Revens2 on 2026-11-25T07:10:12Z.


Rebased on main (a26859f), stacked on #373; head now dc33623. Main's new valu test builds Parts without the gs field this PR adds, so gs: None is added in that test (folded into the last commit). cargo build --workspace --locked ok; cargo test -p victory-shader -p victory-gpu --locked: 137 + 256 passed, 0 failed. Ready for another review pass.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7155564004 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/381#issuecomment-7155564004). Originally posted by [Revens2](https://github.com/Revens2) on 2026-11-25T07:10:12Z. --- Rebased on main (a26859f), stacked on #373; head now dc33623. Main's new valu test builds `Parts` without the `gs` field this PR adds, so `gs: None` is added in that test (folded into the last commit). `cargo build --workspace --locked` ok; `cargo test -p victory-shader -p victory-gpu --locked`: 137 + 256 passed, 0 failed. Ready for another review pass.
Revens2 commented 2026-11-25 10:11:12 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by Revens2 on 2026-11-25T09:35:23Z.


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

<!-- greyfinch-sync:fxceless/victory-fork:comment:7158534653 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/381#issuecomment-7158534653). Originally posted by [Revens2](https://github.com/Revens2) on 2026-11-25T09:35:23Z. --- @codex review (head rebased on origin/main; earlier findings were addressed before the rebase)
chatgpt-codex-connector[bot commented 2026-11-25 10:11:13 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by chatgpt-codex-connector[bot] on 2026-11-25T09:35:39Z.


Codex Review: Something went wrong. Try again later by commenting “@codex review”.

Setup repeatedly failed. Update the setup script or commit, then try again later.
ℹ️ 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".

<!-- greyfinch-sync:fxceless/victory-fork:comment:7158540662 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/381#issuecomment-7158540662). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-25T09:35:39Z. --- Codex Review: Something went wrong. Try again later by commenting “@codex review”. ``` Setup repeatedly failed. Update the setup script or commit, then try again later. ``` <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>
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/381:upstream-pr/381'
git switch 'upstream-pr/381'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/381'
git switch 'upstream-pr/381'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/381'
git switch 'upstream-pr/381'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/381'
git switch 'main'
git merge --squash 'upstream-pr/381'
git switch 'main'
git merge --ff-only 'upstream-pr/381'
git switch 'main'
git merge 'upstream-pr/381'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
fxceless/victory-fork!381
No description provided.