shader: guessed pixel inputs take a word-only entry VGPR as the fixed-point position #407

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

@⁠teamusec-krause on GitHub · 2026-11-27 16:57 UTC · original
teamusec-krause:vibe/fixed-point-ps-position-b4986d → main · +66 −1 · 3 files · 1 commits · draft

What this changes

Pixel programs whose description gives no input enables (no SPI_PS_INPUT_ENA word in the register image) had their last entry VGPR laid out as the next float system value. Some full-screen programs that address their source by pixel read that VGPR only as 16-bit words (SDWA WORD_0 / WORD_1): it is the fixed-point position (POS_FIXED_PT, bit 15). With float position bits there, every pixel of a row read the same source texel, and the final scene pass into the 3840x2160 swapchain buffer came out as bands of one colour each (rows 0-127 one colour, 128-2047 another, every 16th row from 2048 a third). On screen that was the flat grey world.

  • graphics::word_only_entry_vgprs: entry VGPRs whose every explicit read is a VALU source taken as a 16-bit word.
  • graphics::infer_with: when the enables are guessed and the last entry VGPR is one of those, it gets bit 15 instead of the next float component. A VGPR also read whole keeps the old guess.
  • This is a guess about console behaviour. It is marked in the code and added to native-host.md's "Pixel input enables". It only applies where main's register-image enables are missing.

What a run shows with it. This was measured on a local branch that carries this commit plus other changes I have not sent yet, so the numbers are not from this PR alone. The run was warm-cache, headless, on an M-series Mac. The world appears about 82 s after start, at 1.1–1.3 fps; loading runs at about 20 fps. The picture is a recognisable lit scene at a plausible exposure: an interior with a window onto a sunlit yard, with plants and a figure. No screenshot is attached (game content). ROADMAP gets a short note under "Solved recently".

Still wrong in that picture, and not addressed here:

  • fine horizontal scanline stripes and a crosshatch over the whole image
  • black blocks in the centre
  • low world fps
  • audio dropouts
  • an occasional hang in a shadow pass

Refs #412

How it was tested

  • cargo test -p victory-shader (host): 403 + 5 passed, 0 failed, 3 ignored. That includes the new an_entry_vgpr_read_only_as_words_is_guessed_as_the_fixed_point_position, which checks both cases: read only as words gives bit 15, and also read whole stays a float.
  • cargo test --target x86_64-apple-darwin -p victory-hle -p victory-loader -p victory: all passed, 0 failed.
  • cargo test --target x86_64-apple-darwin -p victory-gpu (with the Metal Shader Converter): 412 passed, 0 failed, 6 ignored.
  • cargo build --release --target x86_64-apple-darwin -p victory: builds.
  • cargo xtask policy: 398 files ok.
  • Workspace cargo clippy ... --target x86_64-pc-windows-gnullvm -- -D warnings: not run here, because the gnullvm target isn't installed on this machine. cargo clippy -p victory-shader --all-targets -- -D warnings is clean on the host and on x86_64-pc-windows-msvc. CI will run the real gate.
  • Ran the game: the world run described above, on the local branch.

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 (none added)
**@⁠teamusec-krause** on GitHub · 2026-11-27 16:57 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/403) `teamusec-krause:vibe/fixed-point-ps-position-b4986d` → `main` · +66 −1 · 3 files · 1 commits · draft ## What this changes Pixel programs whose description gives no input enables (no `SPI_PS_INPUT_ENA` word in the register image) had their last entry VGPR laid out as the next float system value. Some full-screen programs that address their source by pixel read that VGPR only as 16-bit words (SDWA `WORD_0` / `WORD_1`): it is the fixed-point position (`POS_FIXED_PT`, bit 15). With float position bits there, every pixel of a row read the same source texel, and the final scene pass into the 3840x2160 swapchain buffer came out as bands of one colour each (rows 0-127 one colour, 128-2047 another, every 16th row from 2048 a third). On screen that was the flat grey world. - `graphics::word_only_entry_vgprs`: entry VGPRs whose every explicit read is a VALU source taken as a 16-bit word. - `graphics::infer_with`: when the enables are guessed and the last entry VGPR is one of those, it gets bit 15 instead of the next float component. A VGPR also read whole keeps the old guess. - This is a guess about console behaviour. It is marked in the code and added to native-host.md's "Pixel input enables". It only applies where main's register-image enables are missing. **What a run shows with it.** This was measured on a local branch that carries this commit plus other changes I have not sent yet, so the numbers are not from this PR alone. The run was warm-cache, headless, on an M-series Mac. The world appears about 82 s after start, at 1.1–1.3 fps; loading runs at about 20 fps. The picture is a recognisable lit scene at a plausible exposure: an interior with a window onto a sunlit yard, with plants and a figure. No screenshot is attached (game content). ROADMAP gets a short note under "Solved recently". **Still wrong in that picture, and not addressed here:** - fine horizontal scanline stripes and a crosshatch over the whole image - black blocks in the centre - low world fps - audio dropouts - an occasional hang in a shadow pass Refs #412 ## How it was tested - [x] `cargo test -p victory-shader` (host): 403 + 5 passed, 0 failed, 3 ignored. That includes the new `an_entry_vgpr_read_only_as_words_is_guessed_as_the_fixed_point_position`, which checks both cases: read only as words gives bit 15, and also read whole stays a float. - [x] `cargo test --target x86_64-apple-darwin -p victory-hle -p victory-loader -p victory`: all passed, 0 failed. - [x] `cargo test --target x86_64-apple-darwin -p victory-gpu` (with the Metal Shader Converter): 412 passed, 0 failed, 6 ignored. - [x] `cargo build --release --target x86_64-apple-darwin -p victory`: builds. - [x] `cargo xtask policy`: 398 files ok. - [ ] Workspace `cargo clippy ... --target x86_64-pc-windows-gnullvm -- -D warnings`: not run here, because the gnullvm target isn't installed on this machine. `cargo clippy -p victory-shader --all-targets -- -D warnings` is clean on the host and on `x86_64-pc-windows-msvc`. CI will run the real gate. - [x] Ran the game: the world run described above, on the local branch. ## Checklist - [x] No game files, game code, disassembly listings or SDK files are included - [x] Guesses about undocumented console behaviour are marked in the code and in docs/native-host.md - [x] New diagnostics are behind a `VICTORY_*` variable and documented (none added)
Without the register image's input enables, the last entry VGPR was laid out as a
float position component. Programs that unpack x and y words from it then read one
source texel for a whole row (the swapchain buffer showed one colour per row band).
Marked as a guess in the code and in docs/native-host.md; ROADMAP notes the picture
a world run shows with it.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 17:05:40 +00:00
Author
Owner

@⁠AnastasisKon on GitHub · 2026-11-28 17:11 UTC · original · approved these changes

Read the diff: word_only_entry_vgprs classifies entry VGPRs whose every explicit read is an SDWA WORD_0/WORD_1 VALU source, and infer_with then marks the last such entry VGPR as the fixed-point position (bit 15) instead of a float system value — the guess is marked in the code and ROADMAP as the repo requires. Synthetic test an_entry_vgpr_read_only_as_words_is_guessed_as_the_fixed_point_position passes on the head 49adfe97 (27/27 graphics tests), and the whole-dorkspace windows clippy with -D warnings is clean. Approving.

**@⁠AnastasisKon** on GitHub · 2026-11-28 17:11 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/403#pullrequestreview-6099212130) · **approved these changes** Read the diff: `word_only_entry_vgprs` classifies entry VGPRs whose every explicit read is an SDWA WORD_0/WORD_1 VALU source, and `infer_with` then marks the last such entry VGPR as the fixed-point position (bit 15) instead of a float system value — the guess is marked in the code and ROADMAP as the repo requires. Synthetic test `an_entry_vgpr_read_only_as_words_is_guessed_as_the_fixed_point_position` passes on the head 49adfe97 (27/27 graphics tests), and the whole-dorkspace windows clippy with `-D warnings` is clean. Approving.
This pull request has changes conflicting with the target branch.
  • docs/native-host.md
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/407/head:github-bot/gh-403'
git switch 'github-bot/gh-403'

Merge

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