Shaders: view-address table for descriptors picked by a computed index #749

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

@⁠Revens2 on GitHub · 2026-11-25 06:14 UTC · original
Revens2:fix/issue-279 → main · +216 −3 · 6 files · 2 commits · open

Refs #279 (the pixel programs whose descriptor is "read only as data").

What is in it

  • A program that loads a buffer descriptor at an index it computes, and only uses the descriptor's address as data, was refused with "a descriptor read only as data". The host now keeps one table of the title addresses of the heap's buffer views by heap slot (SLOT_VIEWS, a root SRV like SLOT_STRIDES, 2^21 slots x 16 bytes, so +32 MiB of upload buffer per view heap). It is written where a slot is written; the lowering reads the address, length and stride from it. A computed term in a used descriptor's address takes the same table.
  • Adapted from uiliannn/VItoriaBr (GPL-3.0, this fork's licence), commits b62bbc0 and 77ad907. Found by running translate --validate on the same title pack with both trees: VItoriaBr had no "read only as data" failures, main had 40. The lower.rs, descriptor/host.rs, pipeline/host.rs, emit/mod.rs and emit/shader.rs parts apply unchanged; the draw.rs part is rewritten for the current main (it conflicted).

Tested

  • victory translate <pack> --validate, VICTORY_HOST_WAVE=32, main 8dd30ab against this branch:
main this PR
"a descriptor read only as data" 40 0
vertex and pixel programs validated 14065 14100
compute programs validated 2722 2726
mesh programs validated 8657 8657
  • Other failure classes are unchanged (195 geometry, 71 mesh >32 KB, 40 "chosen by control flow", the signature/interpolation ones, 10 hardware SGPR inputs).
  • cargo build --workspace --locked and cargo test --workspace --locked -- --test-threads=4 on this branch: 526 passed, 0 failed, 10 ignored.

Not tested

  • In game: a run on an RTX 5070 is queued behind another agent's; the result goes in a comment. The 35 programs now translate, nothing says yet that they draw correctly (no picture check).
  • Memory: +32 MiB per view heap was not measured against the 0x8007000E runs.
  • AMD, 64-lane hosts (the translation above is 32-lane only).

AI use

  • Claude Code (Claude Sonnet 5.5) found the gap, adapted the patch and ran the build, the tests and the translation comparison. The original change is uiliannn's (commits b62bbc0 and 77ad907 of their repository).

Regression run

  • none yet (see Not tested).

🤖 Generated with Claude Code

**@⁠Revens2** on GitHub · 2026-11-25 06:14 UTC · [original](https://github.com/fxceless/victory-fork/pull/749) `Revens2:fix/issue-279` → `main` · +216 −3 · 6 files · 2 commits · open Refs #279 (the pixel programs whose descriptor is "read only as data"). **What is in it** - A program that loads a buffer descriptor at an index it computes, and only uses the descriptor's address as data, was refused with "a descriptor read only as data". The host now keeps one table of the title addresses of the heap's buffer views by heap slot (`SLOT_VIEWS`, a root SRV like `SLOT_STRIDES`, 2^21 slots x 16 bytes, so +32 MiB of upload buffer per view heap). It is written where a slot is written; the lowering reads the address, length and stride from it. A computed term in a used descriptor's address takes the same table. - Adapted from uiliannn/VItoriaBr (GPL-3.0, this fork's licence), commits b62bbc0 and 77ad907. Found by running `translate --validate` on the same title pack with both trees: VItoriaBr had no "read only as data" failures, main had 40. The `lower.rs`, `descriptor/host.rs`, `pipeline/host.rs`, `emit/mod.rs` and `emit/shader.rs` parts apply unchanged; the `draw.rs` part is rewritten for the current main (it conflicted). **Tested** - `victory translate <pack> --validate`, `VICTORY_HOST_WAVE=32`, main 8dd30ab against this branch: | | main | this PR | |---|---|---| | "a descriptor read only as data" | 40 | 0 | | vertex and pixel programs validated | 14065 | 14100 | | compute programs validated | 2722 | 2726 | | mesh programs validated | 8657 | 8657 | - Other failure classes are unchanged (195 geometry, 71 mesh >32 KB, 40 "chosen by control flow", the signature/interpolation ones, 10 hardware SGPR inputs). - `cargo build --workspace --locked` and `cargo test --workspace --locked -- --test-threads=4` on this branch: 526 passed, 0 failed, 10 ignored. **Not tested** - In game: a run on an RTX 5070 is queued behind another agent's; the result goes in a comment. The 35 programs now translate, nothing says yet that they draw correctly (no picture check). - Memory: +32 MiB per view heap was not measured against the 0x8007000E runs. - AMD, 64-lane hosts (the translation above is 32-lane only). **AI use** - Claude Code (Claude Sonnet 5.5) found the gap, adapted the patch and ran the build, the tests and the translation comparison. The original change is uiliannn's (commits b62bbc0 and 77ad907 of their repository). **Regression run** - none yet (see Not tested). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
A program that loads a buffer descriptor at an index it computes, and only
uses the descriptor's address as data, found no root view to ask and was
refused ("a descriptor read only as data"). The host now keeps one table of
the title addresses of the heap's buffer views by heap slot (SLOT_VIEWS, a
root SRV like SLOT_STRIDES, 2^21 slots x 16 bytes), filled where a slot is
written, and the lowering reads the address, length and stride from it.
A computed term in a used descriptor's address takes the same table.

Adapted from uiliannn/VItoriaBr commits b62bbc0 and 77ad907 (GPL-3.0, the
fork's own licence); the draw.rs part is rewritten for the current main,
the rest applies unchanged.

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

@⁠ArturoWolff on GitHub · 2026-11-25 06:40 UTC · original

Linux offline comparison for the 64-lane question, with a 32-lane control. I built the translator separately at main 8dd30ab, #738 ea40c9a, and this PR 9b6b344. Same hash-checked inputs, direct emit::translate, no shared shader cache; set_host_max_wave(32) and then (64). These are compiler settings, not a test on AMD hardware.

  • All three PuddleDetect pixel shaders named in #279 (2fd01fca16993001, 6b6db9f1a526daeb, 7d0f14ce44746d7e) were refused on main and #738 at both settings. On #749 all three translated and passed dxv at both settings. This overlaps the earlier #203 replay; it is not three additional shaders on top of #203. Unlike #203 at 32, #749 still refused the shallow-water timestep ceb5eb68cd99cb07 at 0x38.
  • As a separate control at 32 only, all 725 named shader inputs from our previously captured black frame 2256 emitted byte-identical DXIL on all three revisions (full byte comparison per input). This does not rule out earlier draws affecting that frame, or changes in the host binding code.

The useful next check for the new pixel shaders is a readback with distinguishable buffer addresses at nonzero descriptor indices and a nonzero table offset. dxv acceptance cannot resolve the stride/offset review findings. No retail launch, GPU execution, or change in visible pixels measured here.

AI-assisted: Hermes Agent ran the local comparisons and validator, checked the byte equality, and wrote this comment on ArturoWolff’s behalf.

**@⁠ArturoWolff** on GitHub · 2026-11-25 06:40 UTC · [original](https://github.com/fxceless/victory-fork/pull/749#issuecomment-7155032051) Linux offline comparison for the 64-lane question, with a 32-lane control. I built the translator separately at main `8dd30ab`, #738 `ea40c9a`, and this PR `9b6b344`. Same hash-checked inputs, direct `emit::translate`, no shared shader cache; `set_host_max_wave(32)` and then `(64)`. These are compiler settings, **not** a test on AMD hardware. - All three `PuddleDetect` pixel shaders named in #279 (`2fd01fca16993001`, `6b6db9f1a526daeb`, `7d0f14ce44746d7e`) were refused on main and #738 at both settings. On #749 all three translated and passed `dxv` at **both** settings. This overlaps the [earlier #203 replay](https://git.gtahub.st/github/fxceless--victory-fork/pulls/203); it is not three additional shaders on top of #203. Unlike #203 at 32, #749 still refused the shallow-water timestep `ceb5eb68cd99cb07` at `0x38`. - As a separate control at **32 only**, all 725 named shader inputs from our previously captured black frame 2256 emitted byte-identical DXIL on all three revisions (full byte comparison per input). This does not rule out earlier draws affecting that frame, or changes in the host binding code. The useful next check for the new pixel shaders is a readback with distinguishable buffer addresses at nonzero descriptor indices and a nonzero table offset. `dxv` acceptance cannot resolve the stride/offset review findings. No retail launch, GPU execution, or change in visible pixels measured here. AI-assisted: Hermes Agent ran the local comparisons and validator, checked the byte equality, and wrote this comment on ArturoWolff’s behalf.
Author
Owner

@⁠Revens2 on GitHub · 2026-11-25 06:40 UTC · original

In-game check (RTX 5070 12 GB, driver 32.0.16.2124, Series X profile, VICTORY_RELAY=2, same key script, 420 s, release build; another agent's game was running alongside in the first run):

tree run result
main 8dd30ab 1 ran 420 s, 3 fps (338-340 ms/frame, ~4,950 draws/frame), 0 device removed
this PR 1 title access violation (0xC0000005) at t=181 s during loading, 0 device removed
this PR 2 ran 420 s, 4 fps (247 ms/frame, ~5,000 draws/frame), 0 device removed
this PR 3 ran 420 s, 3 fps (321 ms/frame, ~4,800 draws/frame), 0 device removed

The 7 refused compute pipelines ("Paramètre incorrect") appear on main too. One crash in three on the branch against one run on main is too few to say whether the PR changes crash odds (0xC0000005 during loading is already reported in #416/#453); the fps difference is within run-to-run spread. Not checked: any picture difference for the 35 programs that now translate.

**@⁠Revens2** on GitHub · 2026-11-25 06:40 UTC · [original](https://github.com/fxceless/victory-fork/pull/749#issuecomment-7155038734) In-game check (RTX 5070 12 GB, driver 32.0.16.2124, Series X profile, `VICTORY_RELAY=2`, same key script, 420 s, release build; another agent's game was running alongside in the first run): | tree | run | result | |---|---|---| | main 8dd30ab | 1 | ran 420 s, 3 fps (338-340 ms/frame, ~4,950 draws/frame), 0 device removed | | this PR | 1 | title access violation (0xC0000005) at t=181 s during loading, 0 device removed | | this PR | 2 | ran 420 s, 4 fps (247 ms/frame, ~5,000 draws/frame), 0 device removed | | this PR | 3 | ran 420 s, 3 fps (321 ms/frame, ~4,800 draws/frame), 0 device removed | The 7 refused compute pipelines ("Paramètre incorrect") appear on main too. One crash in three on the branch against one run on main is too few to say whether the PR changes crash odds (0xC0000005 during loading is already reported in #416/#453); the fps difference is within run-to-run spread. Not checked: any picture difference for the 35 programs that now translate.
Author
Owner

@⁠Revens2 on GitHub · 2026-11-25 06:53 UTC · original

Thanks for the review. Both findings are fixed in 41a3892, and the branch is rebased on main a26859f.

  • P1 (stride): the host writes four dwords (16 bytes) per slot. The shader now indexes the SLOT_VIEWS table by a shift of 4. The shift comes from a shared constant, SLOT_VIEWS_RECORD_BYTES = 16, which the host allocation also uses. The SLOT_VIEWS doc comment said "two dwords per slot" and is corrected.
  • P2 (offset): view_address_indexed no longer adds the table byte offset to the loaded address. That offset is already part of the slot index, so the address read from the table is returned unchanged.

Tests: cargo build --workspace --locked is clean. cargo test --workspace --locked -- --test-threads=4 gives 535 passed, 0 failed, 10 ignored. Two new unit tests, one per finding: the record stride is 16 and the shift matches it, and view_address_indexed does not offset the loaded address.

The P2 test is a source check on the function body (no address_plus call). It is not a readback. As @⁠ArturoWolff noted, a readback with nonzero descriptor indices and a nonzero table offset is the check that settles this. No in-game run yet, so that stays "not tested".

**@⁠Revens2** on GitHub · 2026-11-25 06:53 UTC · [original](https://github.com/fxceless/victory-fork/pull/749#issuecomment-7155263866) Thanks for the review. Both findings are fixed in 41a3892, and the branch is rebased on main a26859f. - P1 (stride): the host writes four dwords (16 bytes) per slot. The shader now indexes the `SLOT_VIEWS` table by a shift of 4. The shift comes from a shared constant, `SLOT_VIEWS_RECORD_BYTES = 16`, which the host allocation also uses. The `SLOT_VIEWS` doc comment said "two dwords per slot" and is corrected. - P2 (offset): `view_address_indexed` no longer adds the table byte offset to the loaded address. That offset is already part of the slot index, so the address read from the table is returned unchanged. Tests: `cargo build --workspace --locked` is clean. `cargo test --workspace --locked -- --test-threads=4` gives 535 passed, 0 failed, 10 ignored. Two new unit tests, one per finding: the record stride is 16 and the shift matches it, and `view_address_indexed` does not offset the loaded address. The P2 test is a source check on the function body (no `address_plus` call). It is not a readback. As @⁠ArturoWolff noted, a readback with nonzero descriptor indices and a nonzero table offset is the check that settles this. No in-game run yet, so that stays "not tested".
Author
Owner

@⁠ArturoWolff on GitHub · 2026-11-25 07:32 UTC · original

I checked the nonzero-index/nonzero-offset case against 41a3892 and its direct parent a1855ac. The emitted shader selects the intended record and returns its address unchanged on 41a3892. This is a CPU interpretation of the DXIL, not a device readback. Both versions pass dxv, so validation alone would miss the difference.

The same synthetic one-thread compute shader used a table base of 32 bytes, dynamic index 4, and immediate table offset 32 bytes (expected slot 6). Eight 16-byte host records had distinct addresses and stride tags. The shader returned the address and tag; it did not dereference the address.

Revision Table read Selected record (tag) Record address → shader output
a1855ac byte 48 3 (16) 0x280 → 0x2a0
41a3892 byte 96 6 (28) 0x400 → 0x400

The tag identifies the record independently of the returned address: the parent both selected the wrong record and added 32 after loading it. Neither error occurred on your fix. Unlike my earlier puddle-shader translation comparison, this checks the values produced by the emitted operations. The isolated lavapipe attempt timed out during initialization, before dispatch; actual host binding, device output, and in-game pixels remain unverified.

AI disclosure: Hermes Agent built the synthetic fixture, validated the DXIL, reran the CPU/IR comparison, and wrote this follow-up on ArturoWolff’s behalf.

**@⁠ArturoWolff** on GitHub · 2026-11-25 07:32 UTC · [original](https://github.com/fxceless/victory-fork/pull/749#issuecomment-7155978569) I checked the nonzero-index/nonzero-offset case against `41a3892` and its direct parent `a1855ac`. **The emitted shader selects the intended record and returns its address unchanged on `41a3892`. This is a CPU interpretation of the DXIL, not a device readback.** Both versions pass `dxv`, so validation alone would miss the difference. The same synthetic one-thread compute shader used a table base of 32 bytes, dynamic index 4, and immediate table offset 32 bytes (expected slot 6). Eight 16-byte host records had distinct addresses and stride tags. The shader returned the address and tag; it did not dereference the address. | Revision | Table read | Selected record (tag) | Record address → shader output | |---|---:|---:|---| | `a1855ac` | byte 48 | 3 (16) | `0x280` → `0x2a0` | | `41a3892` | byte 96 | 6 (28) | `0x400` → `0x400` | The tag identifies the record independently of the returned address: the parent both selected the wrong record and added 32 after loading it. Neither error occurred on your fix. Unlike my earlier puddle-shader translation comparison, this checks the values produced by the emitted operations. The isolated lavapipe attempt timed out during initialization, before dispatch; actual host binding, device output, and in-game pixels remain unverified. AI disclosure: Hermes Agent built the synthetic fixture, validated the DXIL, reran the CPU/IR comparison, and wrote this follow-up on ArturoWolff’s behalf.
Author
Owner

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

@⁠ArturoWolff thanks for checking the emitted DXIL on 41a3892 and for pinning the bad parent (a1855ac). The in-game and device-readback side is still unverified on our end; we will report a run on this head when the queue reaches it.

@⁠codex review

**@⁠Revens2** on GitHub · 2026-11-25 09:35 UTC · [original](https://github.com/fxceless/victory-fork/pull/749#issuecomment-7158532110) @⁠ArturoWolff thanks for checking the emitted DXIL on 41a3892 and for pinning the bad parent (a1855ac). The in-game and device-readback side is still unverified on our end; we will report a run on this head when the queue reaches it. @⁠codex review
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-25 06:15 UTC · original · edited 2026-11-25 09:42 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:42:33.607334Z 41a3892 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-25 06:15 UTC · [original](https://github.com/fxceless/victory-fork/pull/749#issuecomment-7154598453) · edited 2026-11-25 09:42 UTC <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"41a3892c9e3993fa51009f60e3b43d50fa2d09ce","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:42:33.607334Z">2026-11-25T09:42:33.607334Z</relative-time> | `41a3892` | 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-25 06:21 UTC · original
On crates/victory-shader/src/emit/lower.rs line 2720 (outdated):

@@ -2691,6 +2691,60 @@ impl<'a> Lower<'a> {
         Some((lo, hi))
     }
 
+    /// [`view_address`] for a table entry chosen at run time (a computed
+    /// index into a descriptor table or the resource heap): the host's table
+    /// of the buffer views' title addresses by heap slot
+    /// ([`shader::SLOT_VIEWS`]).
+    fn view_address_indexed(&mut self, site: Site, first: u8) -> Result<Option<(V, V, V, V)>, Why> {
+        let a = *self
+            .scalar
+            .get(&site)
+            .ok_or("an untracked descriptor load")?;
+        let root = self
+            .x
+            .native
+            .layout
+            .get(a.param)
+            .map(|p| p.root)
+            .ok_or("a descriptor outside the tables")?;
+        if !matches!(root, RootType::Table | RootType::ResourceHeap) || a.dynamic.is_none() {
+            return Ok(None);
+        }
+        let c = self.cur;
+        let slot = self.heap_index(site, first, false)?;
+        let last = self.s.m.i32(super::shader::SLOT_VIEWS_COUNT - 1);
+        let i32t = self.s.t.i32;
+        let slot = self.s.op(c, "binary.i32", Attr::ReadNone, i32t, 40, &[slot, last]);
+        self.s.m.tag(slot, Tag::Clamp);
+        let three = self.s.m.i32(3);
+        let byte = self.s.m.bin(c, Bin::Shl, slot, three);

P1 Badge Index view records with their 16-byte stride

For a computed descriptor index above 0, this uses an 8-byte stride even though the host allocates and writes four dwords (16 bytes) per slot. The four-component load therefore reads overlapping records instead of the selected slot, so shader code can use a bogus address when walking the buffer. Shift by 4, or otherwise match the host writer's 16-byte entry size.

Useful? React with 👍 / 👎.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-25 06:21 UTC · [original](https://github.com/fxceless/victory-fork/pull/749#discussion_r4691150390) On `crates/victory-shader/src/emit/lower.rs` line 2720 (outdated): ```diff @@ -2691,6 +2691,60 @@ impl<'a> Lower<'a> { Some((lo, hi)) } + /// [`view_address`] for a table entry chosen at run time (a computed + /// index into a descriptor table or the resource heap): the host's table + /// of the buffer views' title addresses by heap slot + /// ([`shader::SLOT_VIEWS`]). + fn view_address_indexed(&mut self, site: Site, first: u8) -> Result<Option<(V, V, V, V)>, Why> { + let a = *self + .scalar + .get(&site) + .ok_or("an untracked descriptor load")?; + let root = self + .x + .native + .layout + .get(a.param) + .map(|p| p.root) + .ok_or("a descriptor outside the tables")?; + if !matches!(root, RootType::Table | RootType::ResourceHeap) || a.dynamic.is_none() { + return Ok(None); + } + let c = self.cur; + let slot = self.heap_index(site, first, false)?; + let last = self.s.m.i32(super::shader::SLOT_VIEWS_COUNT - 1); + let i32t = self.s.t.i32; + let slot = self.s.op(c, "binary.i32", Attr::ReadNone, i32t, 40, &[slot, last]); + self.s.m.tag(slot, Tag::Clamp); + let three = self.s.m.i32(3); + let byte = self.s.m.bin(c, Bin::Shl, slot, three); ``` **<sub><sub>![P1 Badge](https://img.shields.io/badge/P1-orange?style=flat)</sub></sub> Index view records with their 16-byte stride** For a computed descriptor index above 0, this uses an 8-byte stride even though the host allocates and writes four dwords (16 bytes) per slot. The four-component load therefore reads overlapping records instead of the selected slot, so shader code can use a bogus address when walking the buffer. Shift by 4, or otherwise match the host writer's 16-byte entry size. Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-25 06:21 UTC · original
On crates/victory-shader/src/emit/lower.rs line 2744 (outdated):

@@ -2691,6 +2691,60 @@ impl<'a> Lower<'a> {
         Some((lo, hi))
     }
 
+    /// [`view_address`] for a table entry chosen at run time (a computed
+    /// index into a descriptor table or the resource heap): the host's table
+    /// of the buffer views' title addresses by heap slot
+    /// ([`shader::SLOT_VIEWS`]).
+    fn view_address_indexed(&mut self, site: Site, first: u8) -> Result<Option<(V, V, V, V)>, Why> {
+        let a = *self
+            .scalar
+            .get(&site)
+            .ok_or("an untracked descriptor load")?;
+        let root = self
+            .x
+            .native
+            .layout
+            .get(a.param)
+            .map(|p| p.root)
+            .ok_or("a descriptor outside the tables")?;
+        if !matches!(root, RootType::Table | RootType::ResourceHeap) || a.dynamic.is_none() {
+            return Ok(None);
+        }
+        let c = self.cur;
+        let slot = self.heap_index(site, first, false)?;
+        let last = self.s.m.i32(super::shader::SLOT_VIEWS_COUNT - 1);
+        let i32t = self.s.t.i32;
+        let slot = self.s.op(c, "binary.i32", Attr::ReadNone, i32t, 40, &[slot, last]);
+        self.s.m.tag(slot, Tag::Clamp);
+        let three = self.s.m.i32(3);
+        let byte = self.s.m.bin(c, Bin::Shl, slot, three);
+        let h = self.s.root_srv_handle(super::shader::SLOT_VIEWS);
+        let iu = self.s.m.undef(self.s.t.i32);
+        let mask = self.s.m.i8(0xF);
+        let align = self.s.m.i32(4);
+        let r = self.s.op(
+            c,
+            "rawBufferLoad.f32",
+            Attr::ReadOnly,
+            self.s.t.res_ret,
+            139,
+            &[h, byte, iu, mask, align],
+        );
+        let lo = self.s.m.extract(c, r, 0);
+        let hi = self.s.m.extract(c, r, 1);
+        let len = self.s.m.extract(c, r, 2);
+        let stride = self.s.m.extract(c, r, 3);
+        let (lo, hi, len, stride) = (
+            self.as_int(lo),
+            self.as_int(hi),
+            self.as_int(len),
+            self.as_int(stride),
+        );
+        let off = a.offset as i32;
+        let (lo, hi) = self.address_plus(lo, hi, off);

P2 Badge Do not add the table byte offset to the loaded view address

When the s_load address has a nonzero root-relative descriptor-table offset, heap_index has already used that address to select the absolute heap slot read from SLOT_VIEWS; a.offset is part of the descriptor-table address, not an offset into the selected buffer. Adding it here shifts the returned title pointer (for example, an entry at byte offset 32 yields its buffer address plus 32), so address-based walkers can read unrelated bytes. Leave the fetched address unchanged.

Useful? React with 👍 / 👎.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-25 06:21 UTC · [original](https://github.com/fxceless/victory-fork/pull/749#discussion_r4691150399) On `crates/victory-shader/src/emit/lower.rs` line 2744 (outdated): ```diff @@ -2691,6 +2691,60 @@ impl<'a> Lower<'a> { Some((lo, hi)) } + /// [`view_address`] for a table entry chosen at run time (a computed + /// index into a descriptor table or the resource heap): the host's table + /// of the buffer views' title addresses by heap slot + /// ([`shader::SLOT_VIEWS`]). + fn view_address_indexed(&mut self, site: Site, first: u8) -> Result<Option<(V, V, V, V)>, Why> { + let a = *self + .scalar + .get(&site) + .ok_or("an untracked descriptor load")?; + let root = self + .x + .native + .layout + .get(a.param) + .map(|p| p.root) + .ok_or("a descriptor outside the tables")?; + if !matches!(root, RootType::Table | RootType::ResourceHeap) || a.dynamic.is_none() { + return Ok(None); + } + let c = self.cur; + let slot = self.heap_index(site, first, false)?; + let last = self.s.m.i32(super::shader::SLOT_VIEWS_COUNT - 1); + let i32t = self.s.t.i32; + let slot = self.s.op(c, "binary.i32", Attr::ReadNone, i32t, 40, &[slot, last]); + self.s.m.tag(slot, Tag::Clamp); + let three = self.s.m.i32(3); + let byte = self.s.m.bin(c, Bin::Shl, slot, three); + let h = self.s.root_srv_handle(super::shader::SLOT_VIEWS); + let iu = self.s.m.undef(self.s.t.i32); + let mask = self.s.m.i8(0xF); + let align = self.s.m.i32(4); + let r = self.s.op( + c, + "rawBufferLoad.f32", + Attr::ReadOnly, + self.s.t.res_ret, + 139, + &[h, byte, iu, mask, align], + ); + let lo = self.s.m.extract(c, r, 0); + let hi = self.s.m.extract(c, r, 1); + let len = self.s.m.extract(c, r, 2); + let stride = self.s.m.extract(c, r, 3); + let (lo, hi, len, stride) = ( + self.as_int(lo), + self.as_int(hi), + self.as_int(len), + self.as_int(stride), + ); + let off = a.offset as i32; + let (lo, hi) = self.address_plus(lo, hi, off); ``` **<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Do not add the table byte offset to the loaded view address** When the `s_load` address has a nonzero root-relative descriptor-table offset, `heap_index` has already used that address to select the absolute heap slot read from `SLOT_VIEWS`; `a.offset` is part of the descriptor-table address, not an offset into the selected buffer. Adding it here shifts the returned title pointer (for example, an entry at byte offset 32 yields its buffer address plus 32), so address-based walkers can read unrelated bytes. Leave the fetched address unchanged. Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
@ -1074,0 +1084,4 @@
l.SetGraphicsRootShaderResourceView(param, gpu);
}
},
None => once!("a shader reads view addresses of a heap that is not set"),
Author
Owner

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

P2 Badge Drop draws when the view-address table is unavailable

If the 32 MiB views upload allocation fails, HostHeap::new leaves views unset and heap_views returns None. This arm only warns and continues, so the draw or dispatch still runs without a valid SLOT_VIEWS root SRV; the shader's raw loads then read zero or undefined addresses. Refuse the submission when this required table cannot be bound.

Useful? React with 👍 / 👎.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-25 09:42 UTC · [original](https://github.com/fxceless/victory-fork/pull/749#discussion_r4693012592) **<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Drop draws when the view-address table is unavailable** If the 32 MiB `views` upload allocation fails, `HostHeap::new` leaves `views` unset and `heap_views` returns `None`. This arm only warns and continues, so the draw or dispatch still runs without a valid `SLOT_VIEWS` root SRV; the shader's raw loads then read zero or undefined addresses. Refuse the submission when this required table cannot be bound. Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/draw.rs
  • crates/victory-shader/src/emit/mod.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

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

Merge

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