fix(agc): eliminate a fast clear over part of a CMASK color target #10414

Merged
orezraey merged 5 commits from upstream-pr/10414 into main 2026-10-27 12:19:28 +00:00
orezraey commented 2026-10-23 22:44:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by orezraey on 2026-10-23T22:44:29Z.


What

DEATHLOOP (PPSA01670 01.405) stops about two minutes in with AGC graphics: CB metadata pass over part of a color target. It renders at a dynamic resolution inside a 3840x2160 target and then issues a fast-clear eliminate (CB_COLOR_CONTROL mode 2) over only the drawn area: a temporary trace of the refused pass showed a CMASK target without DCC keys, viewport and scissor 3688x2112, CB_COLOR_CONTROL 0x00cc0020.

For that mode RunColorMetadataPass writes the clear colour into the tiles CMASK marks as cleared and leaves the others alone. A cleared tile already stands for the clear colour, so eliminating every cleared tile of the target gives the same texels as eliminating only those inside the drawn area. The decode therefore stops requiring full coverage for a fast-clear eliminate of a target without DCC keys. DCC targets and the other modes (DCC decompress, FMASK decompress, resolve) keep the requirement. What still differs is recorded in a new debt entry: the uncovered tiles end expanded in CMASK where the hardware leaves them cleared, which only shows if a title reads those entries or changes the clear colour before eliminating the rest.

With this change DEATHLOOP goes past that point to its animated logo and its brightness calibration screen.

#9694 rewrites the same requireCovered line (coverage only for targets with CMASK or DCC keys); the two compose, and whichever lands second keeps both conditions. #9694 alone does not unblock this title, as its target has CMASK.

Tested

Windows 11, MinGW (winlibs), NVIDIA GeForce RTX 5070 Ti.

  • agc_driver_graphics checks that a fast-clear eliminate over part of a CMASK target without DCC keys decodes, that another metadata pass over part of that target and any pass over part of a target with DCC keys still throw; it fails without the change and passes three runs in a row with it.
  • agc_driver_graphics, agc_metadata_pass, agc_recorder_cmask and agc_driver_cmask_fast_clear run on main and on this change with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1 and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation: all pass on both, the layer loaded on both, and neither log has a VUID- error.
  • DEATHLOOP runs five minutes without stopping, reaching the brightness calibration screen.
  • At d963d44326 (main merged after #8999, keeping both libSceAgcDriver.md entries): the four tests above pass three runs in a row on Windows with the same validation settings, the layer loaded and no VUID- error. On Linux (WSL2, GCC 16.2) agc_driver_graphics passes three runs in a row; the other three cannot run there, since WSL has no Vulkan driver (vkCreateInstance returns -9).
  • At 6aeb8d6c3e (main merged after #9694, which skips the coverage check for targets without CMASK or DCC keys; this branch now requires coverage when target.dccAddress != 0, or when target.cmaskAddress != 0 and the pass is not EliminateFastClear, and the eliminate case moved to a CMASK target in cmaskTests): the four tests above pass three runs in a row on Windows with the same validation settings, no was not found but was requested line and no VUID- error; the new case fails with #9694's condition alone. On Linux (WSL2) agc_driver_graphics passes three runs in a row; the other three cannot run there (no Vulkan driver).
  • tools/check_conventions.py passes.
  • tools/pr_overlap.py: #8999, #9077, #9694 touched nearby lines; all three are merged and in this branch.

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; #1395 edits the same lines too (merge order only)
  • Fixes: none
  • Unblocks: PPSA01670 #11484 (DEATHLOOP, which stopped on this pass)
  • GPUs tested: NVIDIA GeForce RTX 5070 Ti (Windows 11)
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4990164035 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10414). Originally posted by [orezraey](https://github.com/orezraey) on 2026-10-23T22:44:29Z. --- ### What DEATHLOOP (PPSA01670 01.405) stops about two minutes in with `AGC graphics: CB metadata pass over part of a color target`. It renders at a dynamic resolution inside a 3840x2160 target and then issues a fast-clear eliminate (`CB_COLOR_CONTROL` mode 2) over only the drawn area: a temporary trace of the refused pass showed a CMASK target without DCC keys, viewport and scissor 3688x2112, `CB_COLOR_CONTROL` 0x00cc0020. For that mode `RunColorMetadataPass` writes the clear colour into the tiles CMASK marks as cleared and leaves the others alone. A cleared tile already stands for the clear colour, so eliminating every cleared tile of the target gives the same texels as eliminating only those inside the drawn area. The decode therefore stops requiring full coverage for a fast-clear eliminate of a target without DCC keys. DCC targets and the other modes (DCC decompress, FMASK decompress, resolve) keep the requirement. What still differs is recorded in a new debt entry: the uncovered tiles end expanded in CMASK where the hardware leaves them cleared, which only shows if a title reads those entries or changes the clear colour before eliminating the rest. With this change DEATHLOOP goes past that point to its animated logo and its brightness calibration screen. #9694 rewrites the same `requireCovered` line (coverage only for targets with CMASK or DCC keys); the two compose, and whichever lands second keeps both conditions. #9694 alone does not unblock this title, as its target has CMASK. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> Windows 11, MinGW (winlibs), NVIDIA GeForce RTX 5070 Ti. - `agc_driver_graphics` checks that a fast-clear eliminate over part of a CMASK target without DCC keys decodes, that another metadata pass over part of that target and any pass over part of a target with DCC keys still throw; it fails without the change and passes three runs in a row with it. - `agc_driver_graphics`, `agc_metadata_pass`, `agc_recorder_cmask` and `agc_driver_cmask_fast_clear` run on `main` and on this change with `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1` and `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`: all pass on both, the layer loaded on both, and neither log has a `VUID-` error. - DEATHLOOP runs five minutes without stopping, reaching the brightness calibration screen. - At `d963d44326` (main merged after #8999, keeping both `libSceAgcDriver.md` entries): the four tests above pass three runs in a row on Windows with the same validation settings, the layer loaded and no `VUID-` error. On Linux (WSL2, GCC 16.2) `agc_driver_graphics` passes three runs in a row; the other three cannot run there, since WSL has no Vulkan driver (`vkCreateInstance` returns -9). - At `6aeb8d6c3e` (main merged after #9694, which skips the coverage check for targets without CMASK or DCC keys; this branch now requires coverage when `target.dccAddress != 0`, or when `target.cmaskAddress != 0` and the pass is not `EliminateFastClear`, and the eliminate case moved to a CMASK target in `cmaskTests`): the four tests above pass three runs in a row on Windows with the same validation settings, no `was not found but was requested` line and no `VUID-` error; the new case fails with #9694's condition alone. On Linux (WSL2) `agc_driver_graphics` passes three runs in a row; the other three cannot run there (no Vulkan driver). - `tools/check_conventions.py` passes. - `tools/pr_overlap.py`: #8999, #9077, #9694 touched nearby lines; all three are merged and in this branch. ### 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; #1395 edits the same lines too (merge order only) - [x] Fixes: none - [x] Unblocks: PPSA01670 #11484 (DEATHLOOP, which stopped on this pass) - [x] GPUs tested: NVIDIA GeForce RTX 5070 Ti (Windows 11) - [x] AI-assisted: yes
MarcZX10 commented 2026-10-23 23:08:24 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-23T23:08:24Z.

Review: COMMENTED


I checked the overlap with #9694 against both exact diffs. Both PRs replace the same requireCovered(target) line, and the predicates need an explicit composition when the second change lands. To preserve both intended relaxations, coverage should be required when target.dccAddress != 0 or when target.cmaskAddress != 0 and the pass is not EliminateFastClear. That keeps DCC and other CMASK passes guarded, while allowing the CMASK-only fast-clear case here and the no-CMASK/no-DCC cases in #9694.

Could you and the #9694 author coordinate that combined condition and record the chosen integration order (including Depends on if one must land first)? Otherwise, resolving the same-line overlap by taking either replacement verbatim would drop the other PR's behavior. The branch is also 55 commits behind current main; please refresh before merge.

The exact-head conventions check and git diff --check passed locally. I did not run the Vulkan or title tests; the description reports same-machine validation-layer comparisons and the DEATHLOOP run.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5635365524 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10414#pullrequestreview-5635365524). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-23T23:08:24Z. **Review:** COMMENTED --- I checked the overlap with #9694 against both exact diffs. Both PRs replace the same `requireCovered(target)` line, and the predicates need an explicit composition when the second change lands. To preserve both intended relaxations, coverage should be required when `target.dccAddress != 0` or when `target.cmaskAddress != 0` and the pass is not `EliminateFastClear`. That keeps DCC and other CMASK passes guarded, while allowing the CMASK-only fast-clear case here and the no-CMASK/no-DCC cases in #9694. Could you and the #9694 author coordinate that combined condition and record the chosen integration order (including `Depends on` if one must land first)? Otherwise, resolving the same-line overlap by taking either replacement verbatim would drop the other PR's behavior. The branch is also 55 commits behind current `main`; please refresh before merge. The exact-head conventions check and `git diff --check` passed locally. I did not run the Vulkan or title tests; the description reports same-machine validation-layer comparisons and the DEATHLOOP run.
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!10414
No description provided.