fix(libSceAgcDriver): SPI_PS_INPUT_CNTL registers start at their clear-state value #2128

Merged
MathiasDevelopes merged 1 commit from upstream-pr/2128 into main 2026-10-10 04:44:08 +00:00
MathiasDevelopes commented 2026-10-09 09:40:47 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MathiasDevelopes on 2026-10-09T09:40:47Z.


What

A title that never writes SPI_PS_INPUT_CNTL_0 (context register 0x191) relies on its clear-state value, 0. The driver's initial context did not contain the SPI_PS_INPUT_CNTL registers. As a result, every draw of a pixel shader with interpolants (SPI_PS_IN_CONTROL.NUM_INTERP > 0) was rejected when [DecodePixelStageInfo](https://github.com/boykopovar/AnyPS5/blob/main/core/libs/prx/libSceAgcDriver/Graphics/src/ShaderInputState.cpp) read register 0x191.

Planet Coaster (PPSA01736) writes SPI_PS_INPUT_CNTL_1..31 (0x192..0x1b0, values 1..31) and leaves SPI_PS_INPUT_CNTL_0 at its reset value. Without this change it stops at its first UI and video draws:

[videoout] presentation failed: AGC graphics: missing register at DWORD 0x191

On older main the same draws were skipped instead ([gpu] skipped draw: AGC graphics: missing register at DWORD 0x191), and every presented frame was black.

All 32 SPI_PS_INPUT_CNTL registers (0x191..0x1b0) now start at 0 in [InitialContextRegisters](https://github.com/boykopovar/AnyPS5/blob/main/core/libs/prx/libSceAgcDriver/Execution/include/QueueState.hpp). The initial context and CLEAR_STATE already share that table.

Source for the value: the GFX10 clear state in amdgpu, clearstate_gfx10.h lines 427–458. In gfx10_SECT_CONTEXT_def_2, whose extent starts at 0xa0d8, SPI_PS_INPUT_CNTL_0 is entry 185. That is register 0xa191, the driver's 0x191. It and SPI_PS_INPUT_CNTL_1..31 are all 0x00000000.

Tested

Windows 11, MinGW-w64 15.2.0, RTX 3060.

  • agc_driver_graphics_tests: a fresh queue state whose pixel stage has two interpolants and writes only SPI_PS_INPUT_CNTL_1 decodes CNTL_0 as 0 and CNTL_1 as written. ClearContext (CLEAR_STATE) resets all 32 to 0. Without the change, the test fails with missing register at DWORD 0x191.
  • Full ctest suite: 494/494 passed. tools/check_conventions.py --base origin/main passes.
  • PPSA01736: with the change, the PS5 notice screen and the Frontier intro video render. The title needs other fixes to get that far: #1782, #1775, #1777, #1836, #1673 and some local commits. The log line above was taken from that build with only this change reverted.

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
  • New third-party code is a submodule built from source (none added)
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4798714583 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2128). Originally posted by [MathiasDevelopes](https://github.com/MathiasDevelopes) on 2026-10-09T09:40:47Z. --- ### What A title that never writes `SPI_PS_INPUT_CNTL_0` (context register `0x191`) relies on its clear-state value, 0. The driver's initial context did not contain the `SPI_PS_INPUT_CNTL` registers. As a result, every draw of a pixel shader with interpolants (`SPI_PS_IN_CONTROL.NUM_INTERP` > 0) was rejected when [`[DecodePixelStageInfo](https://github.com/boykopovar/AnyPS5/blob/main/core/libs/prx/libSceAgcDriver/Graphics/src/ShaderInputState.cpp)`](https://github.com/boykopovar/AnyPS5/blob/main/core/libs/prx/libSceAgcDriver/Graphics/src/ShaderInputState.cpp) read register `0x191`. Planet Coaster (PPSA01736) writes `SPI_PS_INPUT_CNTL_1..31` (`0x192..0x1b0`, values 1..31) and leaves `SPI_PS_INPUT_CNTL_0` at its reset value. Without this change it stops at its first UI and video draws: ``` [videoout] presentation failed: AGC graphics: missing register at DWORD 0x191 ``` On older main the same draws were skipped instead (`[gpu] skipped draw: AGC graphics: missing register at DWORD 0x191`), and every presented frame was black. All 32 `SPI_PS_INPUT_CNTL` registers (`0x191..0x1b0`) now start at 0 in [`[InitialContextRegisters](https://github.com/boykopovar/AnyPS5/blob/main/core/libs/prx/libSceAgcDriver/Execution/include/QueueState.hpp)`](https://github.com/boykopovar/AnyPS5/blob/main/core/libs/prx/libSceAgcDriver/Execution/include/QueueState.hpp). The initial context and `CLEAR_STATE` already share that table. Source for the value: the GFX10 clear state in amdgpu, [`clearstate_gfx10.h` lines 427–458](https://github.com/torvalds/linux/blob/af32da41b0327b9c6a37856ba82b6760d6c8d10e/drivers/gpu/drm/amd/amdgpu/clearstate_gfx10.h#L427-L458). In `gfx10_SECT_CONTEXT_def_2`, whose extent [starts at `0xa0d8`](https://github.com/torvalds/linux/blob/af32da41b0327b9c6a37856ba82b6760d6c8d10e/drivers/gpu/drm/amd/amdgpu/clearstate_gfx10.h#L963), `SPI_PS_INPUT_CNTL_0` is entry 185. That is register `0xa191`, the driver's `0x191`. It and `SPI_PS_INPUT_CNTL_1..31` are all `0x00000000`. ### Tested Windows 11, MinGW-w64 15.2.0, RTX 3060. - `agc_driver_graphics_tests`: a fresh queue state whose pixel stage has two interpolants and writes only `SPI_PS_INPUT_CNTL_1` decodes `CNTL_0` as 0 and `CNTL_1` as written. `ClearContext` (`CLEAR_STATE`) resets all 32 to 0. Without the change, the test fails with `missing register at DWORD 0x191`. - Full ctest suite: 494/494 passed. `tools/check_conventions.py --base origin/main` passes. - PPSA01736: with the change, the PS5 notice screen and the Frontier intro video render. The title needs other fixes to get that far: #1782, #1775, #1777, #1836, #1673 and some local commits. The log line above was taken from that build with only this change reverted. ### 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 - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in TechnicalDebt - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source (none added) - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes
copilot-pull-request-reviewer[bot] commented 2026-10-09 09:40:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by copilot-pull-request-reviewer[bot] on 2026-10-09T09:40:52Z.

Review: COMMENTED


Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5468391195 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2128#pullrequestreview-5468391195). Originally posted by [copilot-pull-request-reviewer[bot]](https://github.com/apps/copilot-pull-request-reviewer) on 2026-10-09T09:40:52Z. **Review:** COMMENTED --- Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
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!2128
No description provided.