fix(agc): render CB_COLOR_CONTROL mode disable as a draw without color #1414

Merged
TheAggie merged 1 commit from upstream-pr/1414 into main 2026-10-08 13:16:43 +00:00
TheAggie commented 2026-10-08 03:08:30 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by TheAggie on 2026-10-08T03:08:30Z.


What

CB_COLOR_CONTROL.MODE 0 (disable) turns off color writes. It was accepted only when no color target was written. With a written target the draw was skipped (only normal color rendering with copy ROP is supported (CB_COLOR_CONTROL 0x00000000, mode disable)), even though the hardware writes no color in that mode.

  • DecodeState: when the mode is disable, no export counts as written, so the draw has no color attachment and renders like the existing attachment-free path (depth only, or the screen scissor extent).
  • colorControlSupported: mode disable is accepted with any ROP3 and other bits, which do not apply while color writes are off. The draw rejection check accepts the same.
  • agc_driver_graphics (DisabledColorTests): a written color target with CB_COLOR_CONTROL 0x0 and 0xcc0000 decodes without a color attachment and keeps the scissor extent. It fails without the change.

Related to #1346, which drops COLOR_INVALID targets from the write mask. That PR handles disabled formats, this one the disabled mode; both touch the same check.

Tested

Windows 11 Pro (26200), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release, NVIDIA GeForce RTX 5070 Ti.

  • All agc_* and shader_* tests pass. They were run from the generated CTestTestfile.cmake commands, because antivirus blocks ctest.exe on this machine.
  • PS5 OpenGL Showcase (PPSA99005, blackbearreloaded/ps5-opengl) issues a depth pre-pass with this state for its instanced scene. Its draws were skipped. With this change and the other pending fixes on a local branch (#1412 and others), the scene renders. This change alone does not make it render.

Not tested on AMD, Intel or Linux.

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:4781225632 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1414). Originally posted by [TheAggie](https://github.com/TheAggie) on 2026-10-08T03:08:30Z. --- ### What `CB_COLOR_CONTROL.MODE` 0 (disable) turns off color writes. It was accepted only when no color target was written. With a written target the draw was skipped (`only normal color rendering with copy ROP is supported (CB_COLOR_CONTROL 0x00000000, mode disable)`), even though the hardware writes no color in that mode. - `DecodeState`: when the mode is disable, no export counts as written, so the draw has no color attachment and renders like the existing attachment-free path (depth only, or the screen scissor extent). - `colorControlSupported`: mode disable is accepted with any `ROP3` and other bits, which do not apply while color writes are off. The draw rejection check accepts the same. - `agc_driver_graphics` (`DisabledColorTests`): a written color target with `CB_COLOR_CONTROL` 0x0 and 0xcc0000 decodes without a color attachment and keeps the scissor extent. It fails without the change. Related to #1346, which drops `COLOR_INVALID` targets from the write mask. That PR handles disabled formats, this one the disabled mode; both touch the same check. ### Tested Windows 11 Pro (26200), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release, NVIDIA GeForce RTX 5070 Ti. - All `agc_*` and `shader_*` tests pass. They were run from the generated `CTestTestfile.cmake` commands, because antivirus blocks `ctest.exe` on this machine. - PS5 OpenGL Showcase (PPSA99005, [blackbearreloaded/ps5-opengl](https://github.com/blackbearreloaded/ps5-opengl)) issues a depth pre-pass with this state for its instanced scene. Its draws were skipped. With this change and the other pending fixes on a local branch (#1412 and others), the scene renders. This change alone does not make it render. Not tested on AMD, Intel or Linux. ### 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)
TheAggie commented 2026-10-08 03:24:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by TheAggie on 2026-10-08T03:24:31Z.


Showcase before/after on the combined local branch: without this change the instanced scene's draws are skipped; with it (together with #1415) the scene renders.
1414-1415-after-showcase-scene
1414-1415-before-showcase-no-scene

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6051526590 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1414#issuecomment-6051526590). Originally posted by [TheAggie](https://github.com/TheAggie) on 2026-10-08T03:24:31Z. --- Showcase before/after on the combined local branch: without this change the instanced scene's draws are skipped; with it (together with #1415) the scene renders. <img width="960" height="540" alt="1414-1415-after-showcase-scene" src="https://github.com/user-attachments/assets/f99ce0e5-b65f-4023-b953-a336305e7ffd" /> <img width="960" height="540" alt="1414-1415-before-showcase-no-scene" src="https://github.com/user-attachments/assets/9cbc2987-3d41-454f-9a92-414aa3dbeda5" />
adriadam10 commented 2026-10-08 13:16:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-08T13:16:36Z.


Checked build + full ctest on current main + this PR (457/457, agc_driver_graphics passes), and the new DisabledColorTests case fails without the State.cpp change. Mode 0 = CB_DISABLE matches Mesa (V_028808_CB_DISABLE). The branch conflicted with main in State.cpp/tests/Graphics.cpp (#1419 colorControl &= ~1u, COLOR_INVALID test block); rebased keeping both. Merging once CI is green on the rebased head.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6060718755 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1414#issuecomment-6060718755). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-08T13:16:36Z. --- Checked build + full ctest on current main + this PR (457/457, `agc_driver_graphics` passes), and the new `DisabledColorTests` case fails without the `State.cpp` change. Mode 0 = `CB_DISABLE` matches Mesa (`V_028808_CB_DISABLE`). The branch conflicted with main in `State.cpp`/`tests/Graphics.cpp` (#1419 `colorControl &= ~1u`, COLOR_INVALID test block); rebased keeping both. Merging once CI is green on the rebased head.
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!1414
No description provided.