fix(agc): accept a draw without a pixel program while CB_COLOR_CONTROL disables color #8078

Merged
savvaniss merged 1 commit from upstream-pr/8078 into main 2026-10-21 00:53:35 +00:00
savvaniss commented 2026-10-19 20:13:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by savvaniss on 2026-10-19T20:13:23Z.


What

A draw without a pixel program was refused with "a draw without a pixel program writes color" whenever CB_TARGET_MASK and CB_SHADER_MASK overlap on a target with a format. That happened even with CB_COLOR_CONTROL in mode 0 (CB_DISABLE). DecodeState already drops every color export in that mode (if (((read(cx, 0x202) >> 4u) & 7u) == 0u) exportCount = 0;), so such a draw writes no color. NullPixelProgramRejection now applies the same rule. An unwritten CB_COLOR_CONTROL still leaves the decision to the masks.

A depth or stencil decompress pass draws this way. It disables color through CB_COLOR_CONTROL and leaves the masks of the previous draw. Here is the draw that hit this, from a PS4 title through #6977's PS4 path:

SPI_SHADER_PGM_LO_PS 0  DB_SHADER_CONTROL 0  DB_RENDER_CONTROL 0x00000060
CB_COLOR_CONTROL 0x00cc0000 (restored to 0x00cc0010 after the draw)
CB_TARGET_MASK 0xf  CB_SHADER_MASK 0xf  DB_DEPTH_CONTROL 0

Its read and write bases are the same, so it is an in-place expand. DecodeState already treats that as a draw without a depth target. Out-of-place expands are #6146's. That PR reads mode 0 the same way in its recognizer (((value(0x202) >> 4u) & 7u) != 0 && ... ColorWriteMask(cx) != 0), and it does not change NullPixelProgramRejection, so the two do not overlap.

agc_driver_graphics checks the following on its draw without a pixel program and with the masks set:

  • with mode 0 the draw is accepted;
  • DecodeState finds no color target;
  • with CB_COLOR_CONTROL unwritten it is still refused.

Tested

Windows 11 Pro 26300, WinLibs GCC 15.2.0 r7, Release, main e80325a4c. Intel UHD Graphics 770, driver 32.0.101.7088. AMD Radeon RX 9070 XT, driver 32.0.31041.1004.

  • agc_driver_graphics: with only the test change, it fails on main with a draw without a pixel program was rejected while CB_COLOR_CONTROL disables color. It passes with the fix.
  • Validation: Khronos validation layer 1.4.363 (Vulkan SDK), VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, ctest -R <tests> -V, on main and on this branch, on both GPUs. The 15 tests are the graphics decode tests and the execution tests that draw without a pixel program or depth-only: agc_driver_graphics, the alpha-to-coverage tests, agc_driver_depth_fast_clear, agc_driver_depth_fast_clear_submit, agc_driver_depth_htile_write, agc_driver_native_depth_bda_clear, agc_driver_native_multisample_depth, the agc_driver_prepared_graphics tests and agc_driver_sample_mask_depth_stencil.
UHD 770 RX 9070 XT
main 15 of 15 pass, no VUID- 15 of 15 pass, no VUID-
this PR 15 of 15 pass, no VUID- 15 of 15 pass, no VUID-

Neither log has was not found but was requested by env var VK_INSTANCE_LAYERS. The only messages in all four logs are the same three Undefined-Value-ShaderOutputNotConsumed-DynamicRendering warnings.

  • A real title: with this change, Risk from CUSA03312 (my own dump) draws past the pass above, on a local stack with #6977.
  • Checks: tools/check_conventions.py --base origin/main passes. tools/pr_overlap.py lists only pull requests that conflict with main. Of those that touch State.cpp, only #6146 handles this draw shape, as above.
  • Risk (CUSA03312), 20 Oct: with this change in the stack of #7198 (on an RX 9070 XT), Risk gets past its depth-decompress draws to its menus and plays a local match against the AI.

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 under Silent stubs in their library's technical debt file
  • 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
  • Fixes: none
  • Unblocks: CUSA03312 #7198 (Risk, through #6977's PS4 path)
  • GPUs tested: AMD Radeon RX 9070 XT, driver 32.0.31041.1004, Windows 11 Pro 26300; Intel UHD Graphics 770, driver 32.0.101.7088, Windows 11 Pro 26300
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4926795049 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8078). Originally posted by [savvaniss](https://github.com/savvaniss) on 2026-10-19T20:13:23Z. --- ### What A draw without a pixel program was refused with "a draw without a pixel program writes color" whenever `CB_TARGET_MASK` and `CB_SHADER_MASK` overlap on a target with a format. That happened even with `CB_COLOR_CONTROL` in mode 0 (`CB_DISABLE`). `DecodeState` already drops every color export in that mode (`if (((read(cx, 0x202) >> 4u) & 7u) == 0u) exportCount = 0;`), so such a draw writes no color. `NullPixelProgramRejection` now applies the same rule. An unwritten `CB_COLOR_CONTROL` still leaves the decision to the masks. A depth or stencil decompress pass draws this way. It disables color through `CB_COLOR_CONTROL` and leaves the masks of the previous draw. Here is the draw that hit this, from a PS4 title through #6977's PS4 path: ``` SPI_SHADER_PGM_LO_PS 0 DB_SHADER_CONTROL 0 DB_RENDER_CONTROL 0x00000060 CB_COLOR_CONTROL 0x00cc0000 (restored to 0x00cc0010 after the draw) CB_TARGET_MASK 0xf CB_SHADER_MASK 0xf DB_DEPTH_CONTROL 0 ``` Its read and write bases are the same, so it is an in-place expand. `DecodeState` already treats that as a draw without a depth target. Out-of-place expands are #6146's. That PR reads mode 0 the same way in its recognizer (`((value(0x202) >> 4u) & 7u) != 0 && ... ColorWriteMask(cx) != 0`), and it does not change `NullPixelProgramRejection`, so the two do not overlap. `agc_driver_graphics` checks the following on its draw without a pixel program and with the masks set: - with mode 0 the draw is accepted; - `DecodeState` finds no color target; - with `CB_COLOR_CONTROL` unwritten it is still refused. ### Tested Windows 11 Pro 26300, WinLibs GCC 15.2.0 r7, Release, `main` `e80325a4c`. Intel UHD Graphics 770, driver 32.0.101.7088. AMD Radeon RX 9070 XT, driver 32.0.31041.1004. - **`agc_driver_graphics`:** with only the test change, it fails on `main` with `a draw without a pixel program was rejected while CB_COLOR_CONTROL disables color`. It passes with the fix. - **Validation:** Khronos validation layer 1.4.363 (Vulkan SDK), `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1`, `ctest -R <tests> -V`, on `main` and on this branch, on both GPUs. The 15 tests are the graphics decode tests and the execution tests that draw without a pixel program or depth-only: `agc_driver_graphics`, the alpha-to-coverage tests, `agc_driver_depth_fast_clear`, `agc_driver_depth_fast_clear_submit`, `agc_driver_depth_htile_write`, `agc_driver_native_depth_bda_clear`, `agc_driver_native_multisample_depth`, the `agc_driver_prepared_graphics` tests and `agc_driver_sample_mask_depth_stencil`. | | UHD 770 | RX 9070 XT | |---|---|---| | `main` | 15 of 15 pass, no `VUID-` | 15 of 15 pass, no `VUID-` | | this PR | 15 of 15 pass, no `VUID-` | 15 of 15 pass, no `VUID-` | Neither log has `was not found but was requested by env var VK_INSTANCE_LAYERS`. The only messages in all four logs are the same three `Undefined-Value-ShaderOutputNotConsumed-DynamicRendering` warnings. - **A real title:** with this change, Risk from CUSA03312 (my own dump) draws past the pass above, on a local stack with #6977. - **Checks:** `tools/check_conventions.py --base origin/main` passes. `tools/pr_overlap.py` lists only pull requests that conflict with `main`. Of those that touch `State.cpp`, only #6146 handles this draw shape, as above. - **Risk (CUSA03312), 20 Oct:** with this change in the stack of #7198 (on an RX 9070 XT), Risk gets past its depth-decompress draws to its menus and plays a local match against the AI. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [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 under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [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] Fixes: none - [x] Unblocks: CUSA03312 #7198 (Risk, through #6977's PS4 path) - [x] GPUs tested: AMD Radeon RX 9070 XT, driver 32.0.31041.1004, Windows 11 Pro 26300; Intel UHD Graphics 770, driver 32.0.101.7088, Windows 11 Pro 26300 - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-actions[bot] commented 2026-10-19 20:24:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-19T20:24:32Z.


Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 1191 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 1395 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 4040 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 5441 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 5499 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 5925 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6146 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6188 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6194 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6235 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6280 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6481 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6548 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6636 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6639 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6683 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6801 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6804 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6808 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6970 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6977 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 7085 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 7256 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 7410 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 8564 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 8658 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6276539073 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8078#issuecomment-6276539073). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-19T20:24:32Z. --- <!-- pr-overlap --> Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap. | Pull request | Shared files not compared | |---|---| | [PR 1191](https://www.github.com/boykopovar/AnyPS5/pull/1191) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp` | | [PR 1395](https://www.github.com/boykopovar/AnyPS5/pull/1395) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 4040](https://www.github.com/boykopovar/AnyPS5/pull/4040) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 5441](https://www.github.com/boykopovar/AnyPS5/pull/5441) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 5499](https://www.github.com/boykopovar/AnyPS5/pull/5499) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 5925](https://www.github.com/boykopovar/AnyPS5/pull/5925) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6146](https://www.github.com/boykopovar/AnyPS5/pull/6146) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6188](https://www.github.com/boykopovar/AnyPS5/pull/6188) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6194](https://www.github.com/boykopovar/AnyPS5/pull/6194) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6235](https://www.github.com/boykopovar/AnyPS5/pull/6235) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6280](https://www.github.com/boykopovar/AnyPS5/pull/6280) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6481](https://www.github.com/boykopovar/AnyPS5/pull/6481) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6548](https://www.github.com/boykopovar/AnyPS5/pull/6548) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6636](https://www.github.com/boykopovar/AnyPS5/pull/6636) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6639](https://www.github.com/boykopovar/AnyPS5/pull/6639) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6683](https://www.github.com/boykopovar/AnyPS5/pull/6683) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6801](https://www.github.com/boykopovar/AnyPS5/pull/6801) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6804](https://www.github.com/boykopovar/AnyPS5/pull/6804) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6808](https://www.github.com/boykopovar/AnyPS5/pull/6808) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6970](https://www.github.com/boykopovar/AnyPS5/pull/6970) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6977](https://www.github.com/boykopovar/AnyPS5/pull/6977) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp` | | [PR 7085](https://www.github.com/boykopovar/AnyPS5/pull/7085) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 7256](https://www.github.com/boykopovar/AnyPS5/pull/7256) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 7410](https://www.github.com/boykopovar/AnyPS5/pull/7410) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 8564](https://www.github.com/boykopovar/AnyPS5/pull/8564) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 8658](https://www.github.com/boykopovar/AnyPS5/pull/8658) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` |
wachi35676 commented 2026-10-19 23:11:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by wachi35676 on 2026-10-19T23:11:42Z.


NVIDIA and AMD iGPU run, plus Linux, of 1231265e5.

Windows 11 Home 26300, WinLibs GCC 15.2.0, Release, BUILD_TESTING=ON, main 9127ea36d with this head merged. GPUs: RTX 5070 Ti (NVIDIA 617.42) and the AMD Radeon iGPU (RDNA2, 1002:13c0, AMD proprietary driver 2026.04.17, ANYPS5_GPU=AMD). ANYPS5_REQUIRE_VULKAN=1, ctest -j4, failures rerun serially (there were none).

  • The 16 tests matching agc_driver_graphics, the alpha-to-coverage, depth fast clear/HTILE write, prepared graphics and sample mask tests pass on both GPUs, as on main.
  • Negative control: with State.cpp back to main, agc_driver_graphics fails with a draw without a pixel program was rejected while CB_COLOR_CONTROL disables color.
  • Mode 0 is CB_DISABLE in Mesa mesa-25.2.0 src/amd/registers/gfx10.json (CBMode: CB_DISABLE 0, CB_NORMAL 1), so the check matches the existing DecodeState rule.
  • Linux: WSL Ubuntu 24.04, GCC 13.3, llvmpipe (Mesa 25.2.8), main 9127ea36d with #8078, #8046, #8069, #8070, #7668, #8015 and #8026 merged together: 61 of the 62 related tests pass; the other, agc_driver_depth_compare_copy, fails with the guest block is not write-watched after WSL reports asynchronous userfaultfd write protection failed, an environment limit.

AI-assisted: yes (Claude Code); results above were run on this machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6279389779 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8078#issuecomment-6279389779). Originally posted by [wachi35676](https://github.com/wachi35676) on 2026-10-19T23:11:42Z. --- NVIDIA and AMD iGPU run, plus Linux, of `1231265e5`. Windows 11 Home 26300, WinLibs GCC 15.2.0, Release, `BUILD_TESTING=ON`, `main` `9127ea36d` with this head merged. GPUs: RTX 5070 Ti (NVIDIA 617.42) and the AMD Radeon iGPU (RDNA2, `1002:13c0`, AMD proprietary driver 2026.04.17, `ANYPS5_GPU=AMD`). `ANYPS5_REQUIRE_VULKAN=1`, `ctest -j4`, failures rerun serially (there were none). - The 16 tests matching `agc_driver_graphics`, the alpha-to-coverage, depth fast clear/HTILE write, prepared graphics and sample mask tests pass on both GPUs, as on `main`. - Negative control: with `State.cpp` back to `main`, `agc_driver_graphics` fails with `a draw without a pixel program was rejected while CB_COLOR_CONTROL disables color`. - Mode 0 is `CB_DISABLE` in Mesa `mesa-25.2.0` `src/amd/registers/gfx10.json` (`CBMode`: `CB_DISABLE` 0, `CB_NORMAL` 1), so the check matches the existing `DecodeState` rule. - Linux: WSL Ubuntu 24.04, GCC 13.3, llvmpipe (Mesa 25.2.8), `main` `9127ea36d` with #8078, #8046, #8069, #8070, #7668, #8015 and #8026 merged together: 61 of the 62 related tests pass; the other, `agc_driver_depth_compare_copy`, fails with `the guest block is not write-watched` after WSL reports `asynchronous userfaultfd write protection failed`, an environment limit. AI-assisted: yes (Claude Code); results above were run on this machine.
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!8078
No description provided.