fix(agc): size CMASK by whole 1024x512 metablocks #1447

Merged
oneandonlydean merged 1 commit from upstream-pr/1447 into main 2026-10-08 07:12:42 +00:00
oneandonlydean commented 2026-10-08 06:53:40 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-08T06:53:40Z.


What

Sizes a color target's CMASK in whole 4 KiB metablocks of 1024x512 pixels, instead of one packed nibble per 8x8 tile. This is commit 1c848903a from #1237 on its own, by its author; #1072 landed without it.

Why

#1072 checks and expands cmaskBytes (State.cpp) bytes of CMASK, one nibble per 8x8 tile from the start of the target. The nibbles are swizzled inside 4 KiB metablocks of 1024x512 pixels, so the CMASK of a 1920x1080 target spans 0x6000 bytes (the size titles clear), not 16200. The lower-right tiles lie past the packed size, so the all-cleared check doesn't look at them and the expanded store leaves them fast-cleared.

Tested

  • cmaskTests in tests/Graphics.cpp checks CmaskBytes for 1920x1080 (0x6000), 960x544, 800x450, 1024x512 and 3840x2160, and runs the fast-clear passes over a whole 4 KiB CMASK.
  • The same commit, as part of #1237 on top of #1072, passed game runs with no visual or FPS regression.
  • CI on this PR.

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 (follow-up to #1072; the same commit is in #1237)
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4783037171 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1447). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-08T06:53:40Z. --- ### What Sizes a color target's CMASK in whole 4 KiB metablocks of 1024x512 pixels, instead of one packed nibble per 8x8 tile. This is commit 1c848903a from #1237 on its own, by its author; #1072 landed without it. ### Why #1072 checks and expands `cmaskBytes` (`State.cpp`) bytes of CMASK, one nibble per 8x8 tile from the start of the target. The nibbles are swizzled inside 4 KiB metablocks of 1024x512 pixels, so the CMASK of a 1920x1080 target spans 0x6000 bytes (the size titles clear), not 16200. The lower-right tiles lie past the packed size, so the all-cleared check doesn't look at them and the expanded store leaves them fast-cleared. ### Tested - `cmaskTests` in `tests/Graphics.cpp` checks `CmaskBytes` for 1920x1080 (0x6000), 960x544, 800x450, 1024x512 and 3840x2160, and runs the fast-clear passes over a whole 4 KiB CMASK. - The same commit, as part of #1237 on top of #1072, passed game runs with no visual or FPS regression. - CI on this PR. ### 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 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 (follow-up to #1072; the same commit is in #1237) - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-08 06:57:57 +00:00 (Migrated from github.com)

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


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
#1346 core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp L104
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp L633
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6054352909 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1447#issuecomment-6054352909). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-08T06:57:57Z. --- <!-- 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 | |---|---|---|---| | #1346 | `core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp` [L104](https://github.com/boykopovar/AnyPS5/blob/979ae68996704f6570e8a36cddc89501f1444a19/core/libs/prx/libSceAgcDriver/Graphics/include/State.hpp#L104)<br>`core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp` [L633](https://github.com/boykopovar/AnyPS5/blob/979ae68996704f6570e8a36cddc89501f1444a19/core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp#L633) | | |
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!1447
No description provided.