shader: take an address in an undeclared SGPR pair as title memory #69

Manually merged
github merged 3 commits from github-bot/gh-69 into main 2026-11-26 17:09:34 +00:00 AGit
Owner

@⁠AnastasisKon on GitHub · 2026-11-26 13:05 UTC · original
AnastasisKon:vibe/sgpr-address-title-memory-63fece → main · +106 −35 · 6 files · 3 commits · merged 2026-11-26 17:08 UTC

Part of #4: the vertex shaders' "an address in an SGPR that is no root parameter" refusal. A load or store whose address base is a live-in SGPR pair no root parameter fills now tracks as a title-memory address (MEMORY), like an address loaded from memory, and lowers through the memory-space page table (guessed: the console's user data carries raw addresses; marked in docs/native-host.md).

The layout-rebasing inference compared track results for the old and new layouts by matching that refusal string; it now matches the old side's MEMORY address instead.

Tests: resource::track now reports the site as MEMORY; the refusal tests assert what still refuses downstream (reading the undeclared SGPR itself is "a hardware SGPR input", a descriptor built around the address is still refused). 220 victory-shader tests pass.

What this changes

How it was tested

  • cargo test --target x86_64-apple-darwin -p victory-hle -p victory-loader -p victory
  • cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings
  • Ran the game (say how far it got), or not needed

Checklist

  • No game files, game code, disassembly listings or SDK files are included
  • Guesses about undocumented console behaviour are marked in the code and in docs/native-host.md
  • New diagnostics are behind a VICTORY_* variable and documented
**@⁠AnastasisKon** on GitHub · 2026-11-26 13:05 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/69) `AnastasisKon:vibe/sgpr-address-title-memory-63fece` → `main` · +106 −35 · 6 files · 3 commits · merged 2026-11-26 17:08 UTC Part of #4: the vertex shaders' "an address in an SGPR that is no root parameter" refusal. A load or store whose address base is a live-in SGPR pair no root parameter fills now tracks as a title-memory address (MEMORY), like an address loaded from memory, and lowers through the memory-space page table (guessed: the console's user data carries raw addresses; marked in docs/native-host.md). The layout-rebasing inference compared track results for the old and new layouts by matching that refusal string; it now matches the old side's MEMORY address instead. Tests: resource::track now reports the site as MEMORY; the refusal tests assert what still refuses downstream (reading the undeclared SGPR itself is "a hardware SGPR input", a descriptor built around the address is still refused). 220 victory-shader tests pass. ## What this changes <!-- One change per pull request. Link the issue or ROADMAP item. --> ## How it was tested - [ ] `cargo test --target x86_64-apple-darwin -p victory-hle -p victory-loader -p victory` - [ ] `cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings` - [ ] Ran the game (say how far it got), or not needed ## Checklist - [ ] No game files, game code, disassembly listings or SDK files are included - [ ] Guesses about undocumented console behaviour are marked in the code and in docs/native-host.md - [ ] New diagnostics are behind a `VICTORY_*` variable and documented
Part of #4: the vertex shaders' "an address in an SGPR that is no root
parameter" refusal. A load or store whose address base is a live-in SGPR
pair no root parameter fills now tracks as a title-memory address
(MEMORY), like an address loaded from memory, and lowers through the
memory-space page table (guessed: the console's user data carries raw
addresses; marked in docs/native-host.md).

The layout-rebasing inference compared track results for the old and
new layouts by matching that refusal string; it now matches the old
side's MEMORY address instead.

Tests: resource::track now reports the site as MEMORY; the refusal
tests assert what still refuses downstream (reading the undeclared SGPR
itself is "a hardware SGPR input", a descriptor built around the
address is still refused). 220 victory-shader tests pass.

Co-authored-by: AnastasisKon <[email protected]>
Review feedback on #69: turning the track-time refusal into a MEMORY
address was not enough, because lower still had to read the base SGPR
pair and failed with "a hardware SGPR input". The guessed layout now
declares each such pair (reported by resource::track as
Resources::memory_inputs) as a two-dword root-constants parameter at
that user-data index, so lowering reads it from the user-data block and
the load lowers through the memory-space page table.

shortcut/guess, marked in docs/native-host.md: the new parameter's root
slot is the first free one; the register image does not yet say which
root parameter holds the pair, so a draw whose title never set that slot
fails loudly at the host ("root parameter was never set"). Shaders
translated with a real layout still refuse the undeclared read.

Co-authored-by: AnastasisKon <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 14:45:07 +00:00
Author
Owner

@⁠LakshanSivakumar on GitHub · 2026-11-26 13:26 UTC · original · requested changes

Thanks for looking into this. Two blocking issues before this can land:

  1. Shaders hitting this still refuse in lower.rs: Turning "an address in an SGPR that is no root parameter" into Address { param: MEMORY, .. } in resource::track does not allow those shaders to lower, because lower.rs still has to read the base SGPR pair itself and fails at Val::Missing("a hardware SGPR input") (as seen in the updated gfx_refusal_tests.rs assertions, and graphics.rs::tests stopping at resource::track instead of lower). It also replaces a specific diagnostic ("an address in an SGPR that is no root parameter") with a less actionable one ("a hardware SGPR input" or "a buffer descriptor built around a computed address"). Either graphics.rs needs to infer the missing root parameter/user-data layout when one exists, or io/lower needs a sound way to supply the SGPR input.
  2. Please fill in the How it was tested and Checklist boxes in the PR description once updated.
**@⁠LakshanSivakumar** on GitHub · 2026-11-26 13:26 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/69#pullrequestreview-6074931047) · **requested changes** Thanks for looking into this. Two blocking issues before this can land: 1. **Shaders hitting this still refuse in `lower.rs`:** Turning `"an address in an SGPR that is no root parameter"` into `Address { param: MEMORY, .. }` in `resource::track` does not allow those shaders to lower, because `lower.rs` still has to read the base SGPR pair itself and fails at `Val::Missing("a hardware SGPR input")` (as seen in the updated `gfx_refusal_tests.rs` assertions, and `graphics.rs::tests` stopping at `resource::track` instead of `lower`). It also replaces a specific diagnostic (`"an address in an SGPR that is no root parameter"`) with a less actionable one (`"a hardware SGPR input"` or `"a buffer descriptor built around a computed address"`). Either `graphics.rs` needs to infer the missing root parameter/user-data layout when one exists, or `io`/`lower` needs a sound way to supply the SGPR input. 2. Please fill in the `How it was tested` and `Checklist` boxes in the PR description once updated.
Author
Owner

@⁠LakshanSivakumar on GitHub · 2026-11-26 14:54 UTC · original · requested changes

Inference now lets these shaders lower, thanks. Please fill in the testing and checklist boxes in the description; after that (and a rebase of the docs line over #93) this can go in.

**@⁠LakshanSivakumar** on GitHub · 2026-11-26 14:54 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/69#pullrequestreview-6076252299) · **requested changes** Inference now lets these shaders lower, thanks. Please fill in the testing and checklist boxes in the description; after that (and a rebase of the docs line over #93) this can go in.
github-bot force-pushed github-bot/gh-69 from b662e444ed to 5a99727688 2026-11-26 15:17:04 +00:00 Compare
Author
Owner

@⁠LakshanSivakumar on GitHub · 2026-11-26 16:03 UTC · original · requested changes

The shader change is fine. Still open: the description's testing and checklist boxes are unfilled (the template is still there). Fill those in, and rebase the docs line over #93. Then this can go in.

**@⁠LakshanSivakumar** on GitHub · 2026-11-26 16:03 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/69#pullrequestreview-6077225415) · **requested changes** The shader change is fine. Still open: the description's testing and checklist boxes are unfilled (the template is still there). Fill those in, and rebase the docs line over #93. Then this can go in.
github manually merged commit e88e49d95f into main 2026-11-26 17:09:34 +00:00
Author
Owner

@⁠LakshanSivakumar on GitHub · 2026-11-26 17:08 UTC · original

Merged in 8c47ddd. The only conflict was docs/ROADMAP.md, which I resolved on our side. Thanks!

**@⁠LakshanSivakumar** on GitHub · 2026-11-26 17:08 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/69#issuecomment-7198564162) Merged in 8c47ddd. The only conflict was `docs/ROADMAP.md`, which I resolved on our side. Thanks!
This discussion has been locked. Commenting is limited to contributors.
No description provided.