fix(agc): read zero for pixel inputs whose parameter the vertex shader never exports #3336

Closed
Tamalero wants to merge 1 commit from upstream-pr/3336 into main
Tamalero commented 2026-10-11 08:06:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Tamalero on 2026-10-11T08:06:16Z.


What

Fixes #2975.

Cause: a pixel shader may read a parameter that the draw's vertex shader never exports. Rect-list draws already handle this (their generated stages pass zero, as from an unwritten parameter cache entry), but an ordinary vertex to pixel draw fails ValidateShaders with graphics interfaces disagree at location N (stage 0 output missing …).

Fix: for a plain vertex to pixel draw, the pixel stage is compiled with DefaultUnexportedPixelInputs. Every SPI_PS_INPUT_CNTL entry whose slot the compiled vertex shader does not export becomes a default-value input (OFFSET bit 5 set, DEFAULT_VAL 0), which the recompiler already lowers to the constant (0, 0, 0, 0) rather than an interface input, as @Silverash-i8 suggested in #2975. Inputs that are already defaults, and 16-bit inputs, are left unchanged. Tessellation, geometry and rect-list paths are untouched.

Tested

CachyOS (Linux 7.2), RTX 4090, NVIDIA 615.78, GCC Release.

  • New unexportedPixelInputTests in agc_driver_graphics (exported, unexported, default and 16-bit inputs).
  • ctest -R '^agc': 358/359; the failure is agc_driver_dcc_keys_first_write, which fails on main on NVIDIA (#2188).
  • tools/check_conventions.py passes.
  • Marvel's Guardians of the Galaxy (PPSA01748) hits the same stop as Wolverine in #2975 and gets past it.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes (Claude Code)

Tested and written by Claude (AI assistant) on a contributor's machine.

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4817610235 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3336). Originally posted by [Tamalero](https://github.com/Tamalero) on 2026-10-11T08:06:16Z. --- ### What Fixes #2975. **Cause:** a pixel shader may read a parameter that the draw's vertex shader never exports. Rect-list draws already handle this (their generated stages pass zero, as from an unwritten parameter cache entry), but an ordinary vertex to pixel draw fails `ValidateShaders` with `graphics interfaces disagree at location N (stage 0 output missing …)`. **Fix:** for a plain vertex to pixel draw, the pixel stage is compiled with `DefaultUnexportedPixelInputs`. Every `SPI_PS_INPUT_CNTL` entry whose slot the compiled vertex shader does not export becomes a default-value input (`OFFSET` bit 5 set, `DEFAULT_VAL` 0), which the recompiler already lowers to the constant (0, 0, 0, 0) rather than an interface input, as @Silverash-i8 suggested in #2975. Inputs that are already defaults, and 16-bit inputs, are left unchanged. Tessellation, geometry and rect-list paths are untouched. ### Tested CachyOS (Linux 7.2), RTX 4090, NVIDIA 615.78, GCC Release. - New `unexportedPixelInputTests` in `agc_driver_graphics` (exported, unexported, default and 16-bit inputs). - `ctest -R '^agc'`: 358/359; the failure is `agc_driver_dcc_keys_first_write`, which fails on `main` on NVIDIA (#2188). - `tools/check_conventions.py` passes. - Marvel's Guardians of the Galaxy (PPSA01748) hits the same stop as Wolverine in #2975 and gets past it. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes (Claude Code) *Tested and written by Claude (AI assistant) on a contributor's machine.* 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-actions[bot] commented 2026-10-11 08:07:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-11T08:07:49Z.


Thank you for your interest in the project! We are sorry, but we cannot accept more PRs while we work through the existing backlog. This PR has been automatically closed and labeled "intake paused". This is not a judgment of the quality of your changes.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6106977287 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3336#issuecomment-6106977287). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-11T08:07:49Z. --- Thank you for your interest in the project! We are sorry, but we cannot accept more PRs while we work through the existing backlog. This PR has been automatically closed and labeled "intake paused". This is not a judgment of the quality of your changes.
Silverash-i8 commented 2026-10-11 08:12:48 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Silverash-i8 on 2026-10-11T08:12:48Z.


Windows run for whoever carries this: 0a24c5c2 merged onto current main (which now has #3324), Windows 11, WinLibs GCC 15.2.0 r7, Release, RTX 5060 Laptop. All agc_* tests pass, 358/358, including agc_driver_graphics with the new unexportedPixelInputTests. With #3324 in, agc_driver_dcc_keys_first_write passes too, so there's no failure left in that set on Windows.

Thanks for implementing the default-value route from #2975, and good to see it gets Guardians of the Galaxy past the same stop.

AI-assisted (Claude Code); I ran this on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6107014738 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3336#issuecomment-6107014738). Originally posted by [Silverash-i8](https://github.com/Silverash-i8) on 2026-10-11T08:12:48Z. --- Windows run for whoever carries this: `0a24c5c2` merged onto current `main` (which now has #3324), Windows 11, WinLibs GCC 15.2.0 r7, Release, RTX 5060 Laptop. All `agc_*` tests pass, 358/358, including `agc_driver_graphics` with the new `unexportedPixelInputTests`. With #3324 in, `agc_driver_dcc_keys_first_write` passes too, so there's no failure left in that set on Windows. Thanks for implementing the default-value route from #2975, and good to see it gets Guardians of the Galaxy past the same stop. AI-assisted (Claude Code); I ran this on my machine.
tv7 commented 2026-10-11 14:32:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by tv7 on 2026-10-11T14:32:17Z.


@Tamalero Wolverine data for this change, and a note on intake: pr-intake.yml now allows up to 20 open PRs to anyone with at least one merged PR, so this can be reopened (or resubmitted) as is. If you'd rather not, I can carry it with you as the author.

Setup. Marvel's Wolverine (PPSA03671), Windows 11, RTX 3070, GCC 15.2.0 UCRT, Release. Main a11c8f7f7 + #757 + #3588 + #3633 + this PR at 0a24c5c2 (merges cleanly on that main).

  • Without this PR: the first presentation stops with graphics interfaces disagree at location 0 (stage 0 output missing, stage 1 input vertex:f32x4; previous outputs:; parameter exports:; fragment parameters: 0<-0). This is the draw from #2975 (VS 0x11d00bd000 exports only the position, FS 0x11d015f100 reads param 0, SPI_PS_INPUT_CNTL_0 = 0).
  • With it: no error in a 10-minute run.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6110087972 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3336#issuecomment-6110087972). Originally posted by [tv7](https://github.com/tv7) on 2026-10-11T14:32:17Z. --- @Tamalero Wolverine data for this change, and a note on intake: `pr-intake.yml` now allows up to 20 open PRs to anyone with at least one merged PR, so this can be reopened (or resubmitted) as is. If you'd rather not, I can carry it with you as the author. **Setup.** Marvel's Wolverine (PPSA03671), Windows 11, RTX 3070, GCC 15.2.0 UCRT, Release. Main `a11c8f7f7` + #757 + #3588 + #3633 + this PR at `0a24c5c2` (merges cleanly on that main). - **Without this PR:** the first presentation stops with `graphics interfaces disagree at location 0 (stage 0 output missing, stage 1 input vertex:f32x4; previous outputs:; parameter exports:; fragment parameters: 0<-0)`. This is the draw from #2975 (VS `0x11d00bd000` exports only the position, FS `0x11d015f100` reads param 0, `SPI_PS_INPUT_CNTL_0` = 0). - **With it:** no error in a 10-minute run. AI-assisted: yes (Claude Code)

Pull request closed

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
boykopovar/AnyPS5!3336
No description provided.