Skip to content

fix(agc): SPI_PS_INPUT_ENA/ADDR start at their reset value - #1178

Merged
adriadam10 merged 2 commits into
boykopovar:mainfrom
MichonGoddijn231849:fix/spi-ps-input-reset-values
Oct 8, 2026
Merged

adriadam10 merged 2 commits into
boykopovar:mainfrom
MichonGoddijn231849:fix/spi-ps-input-reset-values

Conversation

@MichonGoddijn231849

Copy link
Copy Markdown
Contributor

What

A context that never wrote SPI_PS_INPUT_ENA or SPI_PS_INPUT_ADDR after CLEAR_STATE reads them as zero, like the hardware, instead of refusing the draw for a missing register. GTA V does this for a depth-only draw whose pixel shader takes no inputs.

Tested

Windows 11 Pro, AMD Ryzen 5 7600, NVIDIA GeForce RTX 5080 (driver 32.0.16.1074), 32 GB, MinGW-w64 GCC 15.2.0.

  • GTA V PPSA04264 (01.005) runs with this change on the combined gta-v/testing branch (Performance mode, the prologue).
  • On this branch: builds, and ctest passes. Not run here: the relinker's Python tests (my local Python does not find their helper modules) and guest_gameupdate.

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. Written with Claude (Anthropic) under my direction; I reviewed and tested it.

🤖 Generated with Claude Code

@github-actions github-actions Bot added the agc libSceAgc* label Oct 7, 2026
@orbz22

orbz22 commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Tested with Astro's Playroom (PPSA01325) on Windows 11 (RTX 3060 Laptop, WinLibs GCC 15.2.0 r7), on a local branch that also carries #283, #285, #425, #570, #759, #903 and #1072.

Without this change, 5 draws per frame are refused with missing register at DWORD 0x1b3: 2230 refusals over 445 presents, all with color target 0 and mask 0. With it, I counted 0 refusals over 506 presents:

  • 3 of the 5 draws now run. Successful draws go from 24.0 to 27.2 per present.
  • The other 2 move on to the next check and fail there with depth/stencil clear, copy, resummarize or decompress draws (DB_RENDER_CONTROL) is unsupported (register 0x0 = 0x00000002). 0x2 is the stencil clear bit, which is the case feat(agc): add experimental depth clear and copy recognition #1395 handles. This change does not cover it.

No other draw failures appeared, and the frame dumps through the intro look the same as before.

MichonGoddijn231849 and others added 2 commits October 8, 2026 10:16
A context that never wrote SPI_PS_INPUT_ENA or SPI_PS_INPUT_ADDR after CLEAR_STATE reads them as
zero, like the hardware, instead of refusing the draw for a missing register (a depth-only draw
whose pixel shader takes no inputs).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@adriadam10

Copy link
Copy Markdown
Collaborator

Checked: build + full ctest green on current main + this PR; the change matches the CLEAR_STATE reset list (0x1b3/0x1b4 = 0), and the existing tests that erase 0x1b3 explicitly still require the rejection for a real pixel program.
The PR had no test, so I added one commit pinning it: Submit.cpp checks that CLEAR_STATE leaves SPI_PS_INPUT_ENA/ADDR present and 0 (fails without the change, passes with it). Merging once CI is green on the new head.

@adriadam10
adriadam10 force-pushed the fix/spi-ps-input-reset-values branch from 7552ef8 to ef451ab Compare October 8, 2026 08:48
@adriadam10
adriadam10 merged commit 55f4714 into boykopovar:main Oct 8, 2026
4 checks passed
fisherjoey added a commit to fisherjoey/AnyPS5 that referenced this pull request Oct 9, 2026
…PRs its draws use

Since boykopovar#1178 the SPI_PS_INPUT_ENA/ADDR emplace calls did nothing, so the registered variant had no pixel inputs, and null pixel draws took the last pixel shader's user SGPR count and the bound targets' export mapping. Registration now overwrites those registers, the draw gives the null program no user SGPRs and an empty export mapping, and the at-draw preparation is left for wave32 only. Root cause found by @Raghav314.
@MichonGoddijn231849
MichonGoddijn231849 deleted the fix/spi-ps-input-reset-values branch October 9, 2026 20:05
fisherjoey added a commit to fisherjoey/AnyPS5 that referenced this pull request Oct 10, 2026
…PRs its draws use

Since boykopovar#1178 the SPI_PS_INPUT_ENA/ADDR emplace calls did nothing, so the registered variant had no pixel inputs, and null pixel draws took the last pixel shader's user SGPR count and the bound targets' export mapping. Registration now overwrites those registers, the draw gives the null program no user SGPRs and an empty export mapping, and the at-draw preparation is left for wave32 only. Root cause found by @Raghav314.
adriadam10 pushed a commit to fisherjoey/AnyPS5 that referenced this pull request Oct 10, 2026
…PRs its draws use

Since boykopovar#1178 the SPI_PS_INPUT_ENA/ADDR emplace calls did nothing, so the registered variant had no pixel inputs, and null pixel draws took the last pixel shader's user SGPR count and the bound targets' export mapping. Registration now overwrites those registers, the draw gives the null program no user SGPRs and an empty export mapping, and the at-draw preparation is left for wave32 only. Root cause found by @Raghav314.
SCD28 pushed a commit to SCD28/AnyPS5 that referenced this pull request Oct 10, 2026
…PRs its draws use

Since boykopovar#1178 the SPI_PS_INPUT_ENA/ADDR emplace calls did nothing, so the registered variant had no pixel inputs, and null pixel draws took the last pixel shader's user SGPR count and the bound targets' export mapping. Registration now overwrites those registers, the draw gives the null program no user SGPRs and an empty export mapping, and the at-draw preparation is left for wave32 only. Root cause found by @Raghav314.
SleglJan pushed a commit to SleglJan/AnyPS5 that referenced this pull request Oct 10, 2026
…PRs its draws use

Since boykopovar#1178 the SPI_PS_INPUT_ENA/ADDR emplace calls did nothing, so the registered variant had no pixel inputs, and null pixel draws took the last pixel shader's user SGPR count and the bound targets' export mapping. Registration now overwrites those registers, the draw gives the null program no user SGPRs and an empty export mapping, and the at-draw preparation is left for wave32 only. Root cause found by @Raghav314.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc*

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants