Shaders: trace a geometry program's signature memory #3222

Open
github-bot wants to merge 1 commit from github-bot/gh-3222 into main AGit
Owner

@⁠kotekompotek on GitHub · 2026-11-26 13:37 UTC · original
kotekompotek:shader/geometry-signature-memory → main · +46 −9 · 1 files · 1 commits · open

Grand Theft Auto VI's GS_VoxelizeGeneric programs (all 195 of them - the single biggest refusal bucket in victory translate --list shaders.rpf) keep the pointer to their root signature memory in user data 0-1 - their first user SGPRs, s[8:9] - and load through it like a compute program does through s[0:1]:

s_mov_b32 s0, s8                ; pointer low
s_and_b32 s1, s9, 0xff          ; high masked to 40 bits
s_load_dword s0, s[0:1], 0xb8   ; the load at 0x44

spill_loads was gated on HwStage::Cs, so the base address wasn't recognized as USER_DATA memory and the program was refused with "an address in an SGPR that is no root parameter".

Now spill_loads and param_word's spilled path admit HwStage::Gs, reading the pointer from stage.user_sgpr(0..1) instead of hardcoding s[0:1]. A geometry program's signature memory is there whenever user data 0-1 holds no parameter (it doesn't need the >16-dwords overflow condition compute has).

Verified on six real GS_VoxelizeGeneric programs extracted from shaders.rpf (v1.0.2.1) - all six now trace to USER_DATA addresses instead of failing. Regression test synthesizes the prologue + load.

**@⁠kotekompotek** on GitHub · 2026-11-26 13:37 UTC · [original](https://github.com/Marvisak/VIctory/pull/3222) `kotekompotek:shader/geometry-signature-memory` → `main` · +46 −9 · 1 files · 1 commits · open Grand Theft Auto VI's `GS_VoxelizeGeneric` programs (all 195 of them - the single biggest refusal bucket in `victory translate --list shaders.rpf`) keep the pointer to their root signature memory in user data 0-1 - their first user SGPRs, s[8:9] - and load through it like a compute program does through s[0:1]: ``` s_mov_b32 s0, s8 ; pointer low s_and_b32 s1, s9, 0xff ; high masked to 40 bits s_load_dword s0, s[0:1], 0xb8 ; the load at 0x44 ``` `spill_loads` was gated on `HwStage::Cs`, so the base address wasn't recognized as `USER_DATA` memory and the program was refused with "an address in an SGPR that is no root parameter". Now `spill_loads` and `param_word`'s spilled path admit `HwStage::Gs`, reading the pointer from `stage.user_sgpr(0..1)` instead of hardcoding s[0:1]. A geometry program's signature memory is there whenever user data 0-1 holds no parameter (it doesn't need the >16-dwords overflow condition compute has). Verified on six real `GS_VoxelizeGeneric` programs extracted from `shaders.rpf` (v1.0.2.1) - all six now trace to `USER_DATA` addresses instead of failing. Regression test synthesizes the prologue + load.
Grand Theft Auto VI's GS_VoxelizeGeneric programs (all 195 of them)
keep the pointer to their root signature memory in user data 0-1 —
their first user SGPRs (s[8:9]) — and load through it like a compute
program's s[0:1]. spill_loads only ran for compute, so the very first
s_load at 0x44 failed with "an SGPR that is no root parameter" and
every one of them was refused.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 13:41:50 +00:00
Author
Owner

@⁠Venom2054 on GitHub · 2026-11-26 13:45 UTC · original

I repeated the resource-tracking test on all 195 distinct GS_VoxelizeGeneric geometry shader containers in my local index, using the same inputs on the parent 63bcca43 and PR head 879f2126.

  • On the parent, resource::track refused all 195 at instruction 0x44 because it could not identify the address in the scalar register pair.
  • On the PR head, resource::track succeeded for all 195. In each case it identified one load from USER_DATA at that instruction.
  • At the full emit::translate entry point, both revisions still refused all 195 at stage selection, before producing DXIL. A separate compute control emitted 2,160 bytes of DXIL and passed the Windows SDK validator on both revisions.

This confirms the signature-memory fix across the whole family. It leaves geometry-stage translation and in-game rendering as separate checks. Codex assisted with the offline comparison.

**@⁠Venom2054** on GitHub · 2026-11-26 13:45 UTC · [original](https://github.com/Marvisak/VIctory/pull/3222#issuecomment-7193797473) I repeated the resource-tracking test on all 195 distinct `GS_VoxelizeGeneric` geometry shader containers in my local index, using the same inputs on the parent `63bcca43` and PR head `879f2126`. - On the parent, `resource::track` refused all 195 at instruction `0x44` because it could not identify the address in the scalar register pair. - On the PR head, `resource::track` succeeded for all 195. In each case it identified one load from `USER_DATA` at that instruction. - At the full `emit::translate` entry point, both revisions still refused all 195 at stage selection, before producing DXIL. A separate compute control emitted 2,160 bytes of DXIL and passed the Windows SDK validator on both revisions. This confirms the signature-memory fix across the whole family. It leaves geometry-stage translation and in-game rendering as separate checks. Codex assisted with the offline comparison.
Author
Owner

@⁠Dukestar69 on GitHub · 2026-11-26 13:50 UTC · original · approved these changes

Verified against origin/main (63bcca4):

  • cargo test -p victory-shader --lib resource::tests:: -- --test-threads=1: 36/36 passed (including a_geometry_programs_signature_memory_loads_through_its_pointer).
  • cargo clippy -p victory-shader --all-targets -- -D warnings: clean.
  • cargo xtask policy: 191 files ok.

Cleanly traces a geometry program's signature memory loads through its pointer.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

**@⁠Dukestar69** on GitHub · 2026-11-26 13:50 UTC · [original](https://github.com/Marvisak/VIctory/pull/3222#pullrequestreview-6075265744) · **approved these changes** Verified against `origin/main` (`63bcca4`): - `cargo test -p victory-shader --lib resource::tests:: -- --test-threads=1`: 36/36 passed (including `a_geometry_programs_signature_memory_loads_through_its_pointer`). - `cargo clippy -p victory-shader --all-targets -- -D warnings`: clean. - `cargo xtask policy`: 191 files ok. Cleanly traces a geometry program's signature memory loads through its pointer. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Author
Owner

@⁠kotekompotek on GitHub · 2026-11-26 18:15 UTC · original

Full-pack verification, victory translate --list on the shipped shaders.rpf (v1.0.2.1, 26 503 containers, 26 084 programs):

main this change
resources tracked 25 889 / 26 084 26 084 / 26 084
SGPR-no-root-parameter refusals 195 (all GS_VoxelizeGeneric) 0

The 195 programs do not just track now — they emit: mesh programs stay 8 765 / 8 765 emitted. Every remaining refusal in the pack is a different, already-accounted bucket (13 lane-mask join — FIND-6; 5 v_cvt_f32_f64 — #1262; 4 lane mask read as data — FIND-6; 1 descriptor read only as data — #329; 1 barycentrics; 1 v_permlanex16_b32).

**@⁠kotekompotek** on GitHub · 2026-11-26 18:15 UTC · [original](https://github.com/Marvisak/VIctory/pull/3222#issuecomment-7200249600) Full-pack verification, `victory translate --list` on the shipped shaders.rpf (v1.0.2.1, 26 503 containers, 26 084 programs): | | main | this change | |---|---|---| | resources tracked | 25 889 / 26 084 | **26 084 / 26 084** | | SGPR-no-root-parameter refusals | 195 (all GS_VoxelizeGeneric) | **0** | The 195 programs do not just track now — they emit: mesh programs stay 8 765 / 8 765 emitted. Every remaining refusal in the pack is a different, already-accounted bucket (13 lane-mask join — FIND-6; 5 v_cvt_f32_f64 — #1262; 4 lane mask read as data — FIND-6; 1 descriptor read only as data — #329; 1 barycentrics; 1 v_permlanex16_b32).
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

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

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-3222'
git switch 'github-bot/gh-3222'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-3222'
git switch 'github-bot/gh-3222'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-3222'
git switch 'main'
git merge --squash 'github-bot/gh-3222'
git switch 'main'
git merge --ff-only 'github-bot/gh-3222'
git switch 'main'
git merge 'github-bot/gh-3222'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!3222
No description provided.