fix(agc): run draws whose pixel stage cannot run without its program #1139

Merged
alfalfa-star merged 1 commit from upstream-pr/1139 into main 2026-10-08 08:20:10 +00:00
alfalfa-star commented 2026-10-07 13:36:19 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by alfalfa-star on 2026-10-07T13:36:19Z.


What

A draw whose pixel stage the hardware would not run no longer fails with missing register at DWORD 0x1b3. Before, a draw went without a pixel program only when SPI_SHADER_PGM_LO/HI_PS were zero. A depth-only pass can instead leave a stale pixel program address from earlier state and never set the pixel registers it doesn't need (SPI_PS_INPUT_ENA/ADDR, SPI_SHADER_COL_FORMAT).

The pixel shader has no effect and is not launched when all of these hold:

  • no color is written (CB_TARGET_MASK & CB_SHADER_MASK == 0);
  • there is no depth, stencil or mask export (SPI_SHADER_Z_FORMAT 0, and the export enables of DB_SHADER_CONTROL clear);
  • KILL_ENABLE, EXEC_ON_HIER_FAIL, EXEC_ON_NOOP and EXEC_IF_OVERLAPPED are all clear. radeonsi sets EXEC_ON_NOOP exactly when a pixel shader writes memory.

Changes:

  • PixelProgramUnset becomes PixelProgramSkipped. It is true for a zero program address, as before, and also for such an inert pixel stage. A register the rule needs that is absent means "not skipped", which keeps today's behavior.
  • DrawRejection and the draw decode both use it, so a skipped stage takes the driver's null pixel program, as a zero address already did, and the precheck and the decode agree.

Tested

Linux 7.2.9 (Arch), Mesa 26.2.4 RADV, RX 9070 XT.

  • PPSA14632 (LEGO Horizon Adventures) issues an HTILE expand this way once per run. The pass is marked "Decompress Htile" and sets DB_RENDER_CONTROL DEPTH/STENCIL_COMPRESS_DISABLE, CB disabled, depth test and writes off, DB_SHADER_CONTROL 0, and a stale PS address. With this change it draws, and a 180 s run had no skipped draws (on top of #1134).
  • agc_driver_graphics: a stale address with nothing written and nothing exported is skipped and passes the precheck. EXEC_ON_NOOP, KILL_ENABLE, a Z export, a Z format or a color write each keep the program, and the first two still need SPI_PS_INPUT_ENA. The existing zero-address and missing-register cases are unchanged.
  • ctest: 396 of 396 pass.

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

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4773447883 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1139). Originally posted by [alfalfa-star](https://github.com/alfalfa-star) on 2026-10-07T13:36:19Z. --- ### What A draw whose pixel stage the hardware would not run no longer fails with `missing register at DWORD 0x1b3`. Before, a draw went without a pixel program only when SPI_SHADER_PGM_LO/HI_PS were zero. A depth-only pass can instead leave a stale pixel program address from earlier state and never set the pixel registers it doesn't need (SPI_PS_INPUT_ENA/ADDR, SPI_SHADER_COL_FORMAT). The pixel shader has no effect and is not launched when all of these hold: - no color is written (`CB_TARGET_MASK & CB_SHADER_MASK == 0`); - there is no depth, stencil or mask export (SPI_SHADER_Z_FORMAT 0, and the export enables of DB_SHADER_CONTROL clear); - KILL_ENABLE, EXEC_ON_HIER_FAIL, EXEC_ON_NOOP and EXEC_IF_OVERLAPPED are all clear. radeonsi sets EXEC_ON_NOOP exactly when a pixel shader writes memory. Changes: - `PixelProgramUnset` becomes `PixelProgramSkipped`. It is true for a zero program address, as before, and also for such an inert pixel stage. A register the rule needs that is absent means "not skipped", which keeps today's behavior. - `DrawRejection` and the draw decode both use it, so a skipped stage takes the driver's null pixel program, as a zero address already did, and the precheck and the decode agree. ### Tested Linux 7.2.9 (Arch), Mesa 26.2.4 RADV, RX 9070 XT. - PPSA14632 (LEGO Horizon Adventures) issues an HTILE expand this way once per run. The pass is marked "Decompress Htile" and sets DB_RENDER_CONTROL DEPTH/STENCIL_COMPRESS_DISABLE, CB disabled, depth test and writes off, DB_SHADER_CONTROL 0, and a stale PS address. With this change it draws, and a 180 s run had no skipped draws (on top of #1134). - `agc_driver_graphics`: a stale address with nothing written and nothing exported is skipped and passes the precheck. EXEC_ON_NOOP, KILL_ENABLE, a Z export, a Z format or a color write each keep the program, and the first two still need SPI_PS_INPUT_ENA. The existing zero-address and missing-register cases are unchanged. - `ctest`: 396 of 396 pass. ### 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 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-actions[bot] commented 2026-10-07 21:29:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-07T21:29:08Z.


Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#1348 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp L222
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6047218239 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1139#issuecomment-6047218239). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-07T21:29:08Z. --- <!-- pr-overlap --> Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in **Depends on**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | #1348 | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` [L222](https://github.com/boykopovar/AnyPS5/blob/6b57386237a652f11ecdd2c420f43376adb972e6/core/libs/prx/libSceAgcDriver/tests/Graphics.cpp#L222) | | |
adriadam10 commented 2026-10-08 08:20:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-08T08:20:07Z.


Checked build + ctest (424/424, agc_driver_graphics passes), CI green on the head. The new test cases pin skipped vs. kept for EXEC_ON_NOOP, KILL_ENABLE, Z export, Z format and color write, and unsupported DB_SHADER_CONTROL bits are still rejected (State.cpp:792). Merging.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6055776078 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1139#issuecomment-6055776078). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-08T08:20:07Z. --- Checked build + ctest (424/424, `agc_driver_graphics` passes), CI green on the head. The new test cases pin skipped vs. kept for EXEC_ON_NOOP, KILL_ENABLE, Z export, Z format and color write, and unsupported DB_SHADER_CONTROL bits are still rejected (State.cpp:792). Merging.
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!1139
No description provided.