feat(agc): expand a CMASK fast clear that matches the DCC clear of its target #13147

Open
Prophet069 wants to merge 1 commit from upstream-pr/13147 into main
Prophet069 commented 2026-10-30 04:15:59 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Prophet069 on 2026-10-30T04:15:59Z.


What

A CMASK fast clear of a color target that also has DCC keys threw CMASK fast clear of a DCC color target, whose clear belongs in its DCC keys. When the target's current DCC keys are one clear whose texel equals the texel CB_COLOR_CLEAR_WORD encodes, both readings give the same texels, so the CMASK is now stored as expanded (0xF) without writing texels. Every other CMASK fast clear of a DCC target still throws, and the message now names the target address, size, element bytes, tile mode, samples, the number of cleared tiles, the DCC keys and the clear words. Whether the console's CB reads CMASK under DCC remains unknown (Mesa uses single-sample CMASK only without DCC on GFX10); the debt entry says so.

Tested

  • With ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1 and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation (VVL vulkan-sdk-1.4.321.0; neither log contains was not found but was requested by env var VK_INSTANCE_LAYERS), ctest --test-dir build -R <the 63 tests of agc_shader_memory_tests, agc_driver_cmask_fast_clear_tests, agc_driver_graphics_tests and agc_driver_sample_multisample_target_tests> -V on main 8c8b998620 and on this branch, same machine and GPU: main 63/63 passed, 0 VUID-; this branch 63/63 passed, 0 VUID-. CmaskFastClear.cpp covers the matching DCC clear (expanded, texels unchanged) and a mismatching one (throws with the details).
  • PPSA02015 (Death Stranding 2), Windows, integration branch: without the change the title stopped after 139-167 s at this throw; the detailed message showed target 0xc2de370000, 1920x1080, 4-byte elements, tile mode 27, 4 samples, 32400 of 32400 tiles cleared, DCC keys 0x00, clear words 0. With the change it reached 14800 dispatches (previously at most 1800) with no CMASK stop and 0 VUID-, until an unrelated device loss after 1051 s.
  • tools/check_conventions.py reports one debt-length warning on the CMASK fast clear entry, which was already over 1000 characters on main.
  • The commit changes only the files listed in the diff; it no longer carries the pre-#12916/#12923 tree of the first push.

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: PPSA02015 #5424
  • GPUs tested: NVIDIA GeForce RTX 3080 Laptop GPU (8 GB), driver 616.64, Windows 10 Pro 19045
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5079377914 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13147). Originally posted by [Prophet069](https://github.com/Prophet069) on 2026-10-30T04:15:59Z. --- ### What A CMASK fast clear of a color target that also has DCC keys threw `CMASK fast clear of a DCC color target, whose clear belongs in its DCC keys`. When the target's current DCC keys are one clear whose texel equals the texel `CB_COLOR_CLEAR_WORD` encodes, both readings give the same texels, so the CMASK is now stored as expanded (0xF) without writing texels. Every other CMASK fast clear of a DCC target still throws, and the message now names the target address, size, element bytes, tile mode, samples, the number of cleared tiles, the DCC keys and the clear words. Whether the console's CB reads CMASK under DCC remains unknown (Mesa uses single-sample CMASK only without DCC on GFX10); the debt entry says so. ### 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. --> - With `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1` and `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation` (VVL vulkan-sdk-1.4.321.0; neither log contains `was not found but was requested by env var VK_INSTANCE_LAYERS`), `ctest --test-dir build -R <the 63 tests of agc_shader_memory_tests, agc_driver_cmask_fast_clear_tests, agc_driver_graphics_tests and agc_driver_sample_multisample_target_tests> -V` on main `8c8b998620` and on this branch, same machine and GPU: main 63/63 passed, 0 `VUID-`; this branch 63/63 passed, 0 `VUID-`. `CmaskFastClear.cpp` covers the matching DCC clear (expanded, texels unchanged) and a mismatching one (throws with the details). - PPSA02015 (Death Stranding 2), Windows, integration branch: without the change the title stopped after 139-167 s at this throw; the detailed message showed target `0xc2de370000`, 1920x1080, 4-byte elements, tile mode 27, 4 samples, 32400 of 32400 tiles cleared, DCC keys 0x00, clear words 0. With the change it reached 14800 dispatches (previously at most 1800) with no CMASK stop and 0 `VUID-`, until an unrelated device loss after 1051 s. - `tools/check_conventions.py` reports one `debt-length` warning on the CMASK fast clear entry, which was already over 1000 characters on main. - The commit changes only the files listed in the diff; it no longer carries the pre-#12916/#12923 tree of the first push. ### 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: PPSA02015 #5424 - [x] GPUs tested: NVIDIA GeForce RTX 3080 Laptop GPU (8 GB), driver 616.64, Windows 10 Pro 19045 - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
XairRrR commented 2026-11-02 20:54:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-02T20:54:51Z.

Review: APPROVED


Reviewed — approved

The PR accepts a CMASK fast clear of a DCC target only when the DCC keys are one clear of the same texel as CB_COLOR_CLEAR_WORD, and it throws a detailed message in every other case. The build is clean, the focused tests pass, the new test fails with main's Draw.cpp, and the validation comparison shows no new VUIDs.

What I ran

Head a29ca0375bd4d50d1cfab0a03e2229d17cc07814, main 9090972b7e91fd266819cbd77a8b058e177b5682, merged tree 69cd5cee0ad9afcf41fd4bd047ebcef0075b4e1f (Debian 13 VM, GCC 14.2.0, lavapipe Mesa 26.1.6).

git diff --check 9090972b7e91fd266819cbd77a8b058e177b5682...a29ca0375bd4d50d1cfab0a03e2229d17cc07814
python3 tools/check_conventions.py --base 9090972b7e91fd266819cbd77a8b058e177b5682
ANYPS5_REQUIRE_VULKAN=1 ctest --test-dir build --output-on-failure -R "^(agc_driver_cmask_fast_clear|agc_recorder_cmask)$"
# negative control
git show 9090972b7e91fd266819cbd77a8b058e177b5682:core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp > core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
ninja -C build -j32 -l32 agc_driver_cmask_fast_clear_tests
ANYPS5_REQUIRE_VULKAN=1 ctest --test-dir build --output-on-failure -R "^agc_driver_cmask_fast_clear$"
git show 69cd5cee0ad9afcf41fd4bd047ebcef0075b4e1f:core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp > core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
ninja -C build -j32 -l32 agc_driver_cmask_fast_clear_tests libs
ANYPS5_REQUIRE_VULKAN=1 ctest --test-dir build --output-on-failure -R "^agc_driver_cmask_fast_clear$"
git status --porcelain

Results

Check Result
git diff --check clean
check_conventions.py 0 errors; 1 debt-length warning on the CMASK fast clears entry (1962 characters). The entry was already over the limit on main, as the description says.
Configure, build, libs (script) passed
Selected tests (script, 2031 run) 0 new failures, 0 timeouts. The 7 known failures (agc_driver_division, the denormal tests, unwrap_self, vector_constant_factor_tininess) also fail on main.
Validation layer (script, 757 tests, layer loaded in 756, missing in none) 0 tests with new VUID-
agc_driver_cmask_fast_clear, agc_recorder_cmask passed (0.16 s, 0.12 s)
Negative control failed as expected
Worktree after restore git status --porcelain empty

Negative control

I restored core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp from main and rebuilt. agc_driver_cmask_fast_clear then failed on the first new case:

output with main's Draw.cpp
[gpu] storage image 0x55da74470000 destroyed with GPU results pending
a DCC target with a fast-cleared CMASK tile: was not refused
0% tests passed, 1 tests failed out of 1

After I restored the merged file and rebuilt, the test passed again.

This failure also answers the first point in oneandonlydean's comment (that excluding DCC targets from the GPU path could make titles stop that get through today). On main, the test's eliminate took the resident/recorder GPU path for the DCC target, and nothing was thrown in that call. That path never accepted a cleared tile of a DCC target, though. It called DispatchCmaskClear with write = color.dccAddress == 0 (Draw.cpp:590). With write false, CmaskClear.comp:33-37 sets errors.codes |= 1 for each cleared tile, and the next materializeCmaskClear throws through requireCmaskCodes (Draw.cpp:510). The message is "a CMASK fast clear of a DCC color target, whose clear belongs in its DCC keys, was recorded", which is the stop mrfelek reported for PPSA02015 on main.

So on main, the GPU branch only delayed the throw. Moving DCC targets to the CPU path (Draw.cpp:607) loses no case that worked before. The one difference is cost: a DCC target whose CMASK is already expanded now goes through readCmask, which may wait for a pending write to the CMASK. That happens once per target, because cmaskProved skips later calls.

Findings

Blocking

None.

Non-blocking

  1. Dead GPU error path. DispatchCmaskClear is now always called with write == true, because its only caller needs color.dccAddress == 0 (Draw.cpp:590, Draw.cpp:607). As a result, the errors branch of CmaskClear.comp:37, TextureDetiler::CmaskErrors and requireCmaskCodes (Draw.cpp:510, with its DCC message) can no longer be reached. Suggestion: remove the write parameter, the error buffer and requireCmaskCodes in a follow-up. Otherwise a reader may think a DCC target can still take the GPU path.
  2. The DCC key range covers only one key per 256 bytes (Draw.cpp:623), the second point in oneandonlydean's comment. I confirm that CurrentDccKeys(addr, bytes) reads DccKeyBytes(bytes), while colorKeyCount returns the larger console extent for pipe-aligned 4-byte R64KBX targets. However, the same metadata pass then picks the target's texels from the same short read (Draw.cpp:3976, also materializeRegisterClear at Draw.cpp:457). The new acceptance therefore agrees with what the pass already does, and the gap is not new. Reading CurrentDccKeys(color.dccAddress, color.bytes, colorKeyCount(color, color.bytes)) here would still be cheap and stricter, and it would be needed before the rest of the pass is extended to the full extent.
  3. The debt entry now partly contradicts itself. docs/dev/debt/libSceAgcDriver.md:239 still says "a cleared tile of a DCC target … throw", while the new sentence at the end of the same entry says a matching one is expanded. Suggestion: cut the earlier clause to "a cleared tile of a DCC target whose keys are not a matching clear". The CONTRIBUTING rules also ask entries to be cut rather than grown, and this entry is already flagged at 1962 characters.
  4. The description does not mention the GPU-path exclusion. oneandonlydean asked for it to be explained. The evidence above can serve as that explanation: the GPU path for DCC targets only recorded an error that threw later.

Not verified

  • Console behaviour (whether the CB reads CMASK under DCC). The debt entry already records this as unknown.
  • Pipe-aligned targets with keys that match over the short range but differ beyond it. This PR adds no such case, and I did not write one (see non-blocking 2).
  • The PPSA02015 run and runs on non-lavapipe GPUs. I am relying on the author, TechLevelZero (NVIDIA), JJenkx (RX 6700 XT) and RNK123 (RADV) for those.
  • No title was launched.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5743189876 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13147#pullrequestreview-5743189876). Originally posted by [XairRrR](https://github.com/XairRrR) on 2026-11-02T20:54:51Z. **Review:** APPROVED --- # Reviewed — approved The PR accepts a CMASK fast clear of a DCC target only when the DCC keys are one clear of the same texel as `CB_COLOR_CLEAR_WORD`, and it throws a detailed message in every other case. The build is clean, the focused tests pass, the new test fails with `main`'s `Draw.cpp`, and the validation comparison shows no new VUIDs. ## What I ran Head `a29ca0375bd4d50d1cfab0a03e2229d17cc07814`, `main` `9090972b7e91fd266819cbd77a8b058e177b5682`, merged tree `69cd5cee0ad9afcf41fd4bd047ebcef0075b4e1f` (Debian 13 VM, GCC 14.2.0, lavapipe Mesa 26.1.6). ``` git diff --check 9090972b7e91fd266819cbd77a8b058e177b5682...a29ca0375bd4d50d1cfab0a03e2229d17cc07814 python3 tools/check_conventions.py --base 9090972b7e91fd266819cbd77a8b058e177b5682 ANYPS5_REQUIRE_VULKAN=1 ctest --test-dir build --output-on-failure -R "^(agc_driver_cmask_fast_clear|agc_recorder_cmask)$" # negative control git show 9090972b7e91fd266819cbd77a8b058e177b5682:core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp > core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp ninja -C build -j32 -l32 agc_driver_cmask_fast_clear_tests ANYPS5_REQUIRE_VULKAN=1 ctest --test-dir build --output-on-failure -R "^agc_driver_cmask_fast_clear$" git show 69cd5cee0ad9afcf41fd4bd047ebcef0075b4e1f:core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp > core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp ninja -C build -j32 -l32 agc_driver_cmask_fast_clear_tests libs ANYPS5_REQUIRE_VULKAN=1 ctest --test-dir build --output-on-failure -R "^agc_driver_cmask_fast_clear$" git status --porcelain ``` ## Results | Check | Result | |---|---| | `git diff --check` | clean | | `check_conventions.py` | 0 errors; 1 `debt-length` warning on the CMASK fast clears entry (1962 characters). The entry was already over the limit on `main`, as the description says. | | Configure, build, `libs` (script) | passed | | Selected tests (script, 2031 run) | 0 new failures, 0 timeouts. The 7 known failures (`agc_driver_division`, the denormal tests, `unwrap_self`, `vector_constant_factor_tininess`) also fail on `main`. | | Validation layer (script, 757 tests, layer loaded in 756, missing in none) | 0 tests with new `VUID-` | | `agc_driver_cmask_fast_clear`, `agc_recorder_cmask` | passed (0.16 s, 0.12 s) | | Negative control | failed as expected | | Worktree after restore | `git status --porcelain` empty | ## Negative control I restored `core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp` from `main` and rebuilt. `agc_driver_cmask_fast_clear` then failed on the first new case: <details><summary>output with main's Draw.cpp</summary> ``` [gpu] storage image 0x55da74470000 destroyed with GPU results pending a DCC target with a fast-cleared CMASK tile: was not refused 0% tests passed, 1 tests failed out of 1 ``` </details> After I restored the merged file and rebuilt, the test passed again. This failure also answers the first point in oneandonlydean's comment (that excluding DCC targets from the GPU path could make titles stop that get through today). On `main`, the test's eliminate took the resident/recorder GPU path for the DCC target, and nothing was thrown in that call. That path never accepted a cleared tile of a DCC target, though. It called `DispatchCmaskClear` with `write = color.dccAddress == 0` (`Draw.cpp:590`). With `write` false, `CmaskClear.comp:33-37` sets `errors.codes |= 1` for each cleared tile, and the next `materializeCmaskClear` throws through `requireCmaskCodes` (`Draw.cpp:510`). The message is "a CMASK fast clear of a DCC color target, whose clear belongs in its DCC keys, was recorded", which is the stop mrfelek reported for PPSA02015 on `main`. So on `main`, the GPU branch only delayed the throw. Moving DCC targets to the CPU path (`Draw.cpp:607`) loses no case that worked before. The one difference is cost: a DCC target whose CMASK is already expanded now goes through `readCmask`, which may wait for a pending write to the CMASK. That happens once per target, because `cmaskProved` skips later calls. ## Findings ### Blocking None. ### Non-blocking 1. **Dead GPU error path.** `DispatchCmaskClear` is now always called with `write == true`, because its only caller needs `color.dccAddress == 0` (`Draw.cpp:590`, `Draw.cpp:607`). As a result, the `errors` branch of `CmaskClear.comp:37`, `TextureDetiler::CmaskErrors` and `requireCmaskCodes` (`Draw.cpp:510`, with its DCC message) can no longer be reached. Suggestion: remove the `write` parameter, the error buffer and `requireCmaskCodes` in a follow-up. Otherwise a reader may think a DCC target can still take the GPU path. 2. **The DCC key range covers only one key per 256 bytes** (`Draw.cpp:623`), the second point in oneandonlydean's comment. I confirm that `CurrentDccKeys(addr, bytes)` reads `DccKeyBytes(bytes)`, while `colorKeyCount` returns the larger console extent for pipe-aligned 4-byte R64KBX targets. However, the same metadata pass then picks the target's texels from the same short read (`Draw.cpp:3976`, also `materializeRegisterClear` at `Draw.cpp:457`). The new acceptance therefore agrees with what the pass already does, and the gap is not new. Reading `CurrentDccKeys(color.dccAddress, color.bytes, colorKeyCount(color, color.bytes))` here would still be cheap and stricter, and it would be needed before the rest of the pass is extended to the full extent. 3. **The debt entry now partly contradicts itself.** `docs/dev/debt/libSceAgcDriver.md:239` still says "a cleared tile of a DCC target … throw", while the new sentence at the end of the same entry says a matching one is expanded. Suggestion: cut the earlier clause to "a cleared tile of a DCC target whose keys are not a matching clear". The CONTRIBUTING rules also ask entries to be cut rather than grown, and this entry is already flagged at 1962 characters. 4. **The description does not mention the GPU-path exclusion.** oneandonlydean asked for it to be explained. The evidence above can serve as that explanation: the GPU path for DCC targets only recorded an error that threw later. ## Not verified - Console behaviour (whether the CB reads CMASK under DCC). The debt entry already records this as unknown. - Pipe-aligned targets with keys that match over the short range but differ beyond it. This PR adds no such case, and I did not write one (see non-blocking 2). - The PPSA02015 run and runs on non-lavapipe GPUs. I am relying on the author, TechLevelZero (NVIDIA), JJenkx (RX 6700 XT) and RNK123 (RADV) for those. - No title was launched. <!-- anyps5-bots job=1914 head=a29ca0375bd4d50d1cfab0a03e2229d17cc07814 -->
gabichuuuuu commented 2026-11-08 15:31:20 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by gabichuuuuu on 2026-11-08T15:31:20Z.

Review: COMMENTED


Ran a29ca0375b merged on main 302864d48c on Windows 11 x64 (WinLibs GCC 15.2), on an NVIDIA laptop GPU (Turing, driver 621) and an Intel iGPU (driver 101.70xx), with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1 and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation (Khronos validation layer 1.4.368), ctest -R '^agc_driver_cmask_fast_clear' -V:

main main + only this PR's CmaskFastClear.cpp change, 2 runs each
NVIDIA passed failed passed
Intel passed failed passed
  • Without the driver change, the updated test fails on both GPUs with "a DCC target with a fast-cleared CMASK tile: was not refused". With the change, it passes every time.
  • The test file hasn't changed on main since the branch point, so the middle column is the PR's own test on main's code.
  • The layer was inserted in the test. No log has was not found but was requested by env var VK_INSTANCE_LAYERS, and no log on either side has a VUID-, so the expanded clear draws without validation errors on either driver. To be sure validation messages reach these logs, the same layer with best practices on printed 28 BestPractices- warnings into an agc_driver_recorder log on each GPU.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5818461466 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13147#pullrequestreview-5818461466). Originally posted by [gabichuuuuu](https://github.com/gabichuuuuu) on 2026-11-08T15:31:20Z. **Review:** COMMENTED --- Ran `a29ca0375b` merged on `main` 302864d48c on Windows 11 x64 (WinLibs GCC 15.2), on an NVIDIA laptop GPU (Turing, driver 621) and an Intel iGPU (driver 101.70xx), with `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1` and `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation` (Khronos validation layer 1.4.368), `ctest -R '^agc_driver_cmask_fast_clear' -V`: | | `main` | `main` + only this PR's `CmaskFastClear.cpp` | change, 2 runs each | |---|---|---|---| | NVIDIA | passed | failed | passed | | Intel | passed | failed | passed | - Without the driver change, the updated test fails on both GPUs with "a DCC target with a fast-cleared CMASK tile: was not refused". With the change, it passes every time. - The test file hasn't changed on `main` since the branch point, so the middle column is the PR's own test on `main`'s code. - The layer was inserted in the test. No log has `was not found but was requested by env var VK_INSTANCE_LAYERS`, and no log on either side has a `VUID-`, so the expanded clear draws without validation errors on either driver. To be sure validation messages reach these logs, the same layer with best practices on printed 28 `BestPractices-` warnings into an `agc_driver_recorder` log on each GPU. AI-assisted: yes.
milescoviello commented 2026-11-09 20:14:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-11-09T20:14:16Z.

Review: COMMENTED


Read at a29ca0375b against main. The match rule and the new message look right to me. One cost the change adds, in materializeCmaskClear (Draw.cpp):

On main, a DCC color target with a resident image, an import and the device lock takes the GPU path, recordCmaskClear. That path dispatches DispatchCmaskClear with color.dccAddress == 0 as the last argument and notes the write as pending. A CMASK that earlier recorded GPU work wrote is read on the GPU, in order, with no CPU wait.

With this head, color.dccAddress == 0 in the first condition sends every DCC target to the CPU path, including the common case where the CMASK is already expanded. There, readCmask calls recorder->SyncThrough(address, bytes) whenever PendingWriteOverlaps the CMASK. So when a title clears its CMASK with its own compute kernel in the same submission, the first draw into that DCC target now waits for the recorder. If that happens every frame, it's a GPU sync in the middle of every frame.

Two ways to keep the old cost:

  • Keep the GPU path for DCC targets, and fall back to the CPU check only when the kernel reports a cleared tile.
  • Or take the CPU path for a DCC target only when no recorded write is pending over its CMASK.

A Recorder::CountSync reading from the PPSA02015 run, main against this head, would show whether it matters there.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5832064986 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13147#pullrequestreview-5832064986). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-11-09T20:14:16Z. **Review:** COMMENTED --- Read at `a29ca0375b` against `main`. The match rule and the new message look right to me. One cost the change adds, in `materializeCmaskClear` (`Draw.cpp`): **On `main`,** a DCC color target with a resident image, an import and the device lock takes the GPU path, `recordCmaskClear`. That path dispatches `DispatchCmaskClear` with `color.dccAddress == 0` as the last argument and notes the write as pending. A CMASK that earlier recorded GPU work wrote is read on the GPU, in order, with no CPU wait. **With this head,** `color.dccAddress == 0` in the first condition sends every DCC target to the CPU path, including the common case where the CMASK is already expanded. There, `readCmask` calls `recorder->SyncThrough(address, bytes)` whenever `PendingWriteOverlaps` the CMASK. So when a title clears its CMASK with its own compute kernel in the same submission, the first draw into that DCC target now waits for the recorder. If that happens every frame, it's a GPU sync in the middle of every frame. Two ways to keep the old cost: - Keep the GPU path for DCC targets, and fall back to the CPU check only when the kernel reports a cleared tile. - Or take the CPU path for a DCC target only when no recorded write is pending over its CMASK. A `Recorder::CountSync` reading from the PPSA02015 run, `main` against this head, would show whether it matters there. AI-assisted: yes (Claude Code)
MarcZX10 commented 2026-11-20 06:53:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T06:53:51Z.

Review: APPROVED


Reviewed — looks good

Nothing blocks this change; the matching-clear case is limited to DCC clear keys whose texel matches the CMASK clear value, and other cleared CMASK/DCC combinations still throw.

What I ran

Reviewed head a29ca0375bd4d50d1cfab0a03e2229d17cc07814. I did not run commands or tests; repo_read.py was unavailable as a shell command, so I used the provided review reader. The author reports 63/63 tests passed on main and this branch, and a Windows integration run reached 14,800 dispatches before an unrelated device loss.

Read changed files: core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp (lines 365–475, 500–650, 3899–3945); core/libs/prx/libSceAgcDriver/tests/CmaskFastClear.cpp (full file); docs/dev/debt/libSceAgcDriver.md (lines 192–204). No changed files were excluded in the manifest.

Results

Check Result Note
Source review passed Three changed files inspected
Tests in this review not run Author-reported results only
Negative control not run No test mutation performed

Findings

Blocking

None.

Non-blocking

None.

Not verified

The reported test and integration runs were not independently reproduced. Console behavior when CMASK is read under DCC remains unverified, as the updated debt entry states.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5988672138 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13147#pullrequestreview-5988672138). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-20T06:53:51Z. **Review:** APPROVED --- # Reviewed — looks good Nothing blocks this change; the matching-clear case is limited to DCC clear keys whose texel matches the CMASK clear value, and other cleared CMASK/DCC combinations still throw. ## What I ran Reviewed head `a29ca0375bd4d50d1cfab0a03e2229d17cc07814`. I did not run commands or tests; `repo_read.py` was unavailable as a shell command, so I used the provided review reader. The author reports 63/63 tests passed on main and this branch, and a Windows integration run reached 14,800 dispatches before an unrelated device loss. Read changed files: `core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp` (lines 365–475, 500–650, 3899–3945); `core/libs/prx/libSceAgcDriver/tests/CmaskFastClear.cpp` (full file); `docs/dev/debt/libSceAgcDriver.md` (lines 192–204). No changed files were excluded in the manifest. ## Results | Check | Result | Note | |---|---|---| | Source review | passed | Three changed files inspected | | Tests in this review | not run | Author-reported results only | | Negative control | not run | No test mutation performed | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified The reported test and integration runs were not independently reproduced. Console behavior when CMASK is read under DCC remains unverified, as the updated debt entry states. ## To get this to a good state Nothing is required.
Plyxen commented 2026-12-03 06:04:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Plyxen on 2026-12-03T06:04:07Z.

Review: APPROVED


I read the diff at a29ca0375b. Windows 11, GCC 15.2, merged into main at cf556db18c3 together with other open PRs (so not an isolated build), with ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 and VK_LAYER_KHRONOS_validation on an RTX 5080 (621.24) and a Radeon iGPU (26.11.2).

  • agc_driver_cmask_fast_clear: pass on both GPUs. The loader log shows the layer inserted and no "was not found" line, and neither run has a VUID- or SYNC-HAZARD line.
  • Control (same tree and tests, the changed files of those PRs put back to main's): fails on both GPUs: "a DCC target with a fast-cleared CMASK tile: was not refused".

Not checked: a title.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6164483662 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13147#pullrequestreview-6164483662). Originally posted by [Plyxen](https://github.com/Plyxen) on 2026-12-03T06:04:07Z. **Review:** APPROVED --- I read the diff at `a29ca0375b`. Windows 11, GCC 15.2, merged into `main` at `cf556db18c3` together with other open PRs (so not an isolated build), with `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1` and `VK_LAYER_KHRONOS_validation` on an RTX 5080 (621.24) and a Radeon iGPU (26.11.2). - `agc_driver_cmask_fast_clear`: pass on both GPUs. The loader log shows the layer inserted and no "was not found" line, and neither run has a `VUID-` or `SYNC-HAZARD` line. - Control (same tree and tests, the changed files of those PRs put back to `main`'s): fails on both GPUs: "a DCC target with a fast-cleared CMASK tile: was not refused". Not checked: a title. AI-assisted: yes (Claude Code)
ligmaSec commented 2026-12-03 22:54:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T22:54:29Z.

Review: COMMENTED


The DCC clear comparison preserves the existing refusal for a different clear color. The fixture checks that refusal and also covers both a whole CMASK clear and a partial clear when the colors match. Could the refusal check also snapshot and compare both metadata regions across the failed eliminate? That would catch moving the CMASK write ahead of the DCC equality check. The trial merge is clean. Please put the debt update in a fragment in docs/dev/debt/changes/. I have no paired Vulkan result for this head yet.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6180073284 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13147#pullrequestreview-6180073284). Originally posted by [ligmaSec](https://github.com/ligmaSec) on 2026-12-03T22:54:29Z. **Review:** COMMENTED --- The DCC clear comparison preserves the existing refusal for a different clear color. The fixture checks that refusal and also covers both a whole CMASK clear and a partial clear when the colors match. Could the refusal check also snapshot and compare both metadata regions across the failed eliminate? That would catch moving the CMASK write ahead of the DCC equality check. The trial merge is clean. Please put the debt update in a fragment in `docs/dev/debt/changes/`. I have no paired Vulkan result for this head yet. AI-assisted: yes.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/13147:upstream-pr/13147'
git switch 'upstream-pr/13147'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/13147'
git switch 'upstream-pr/13147'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/13147'
git switch 'upstream-pr/13147'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/13147'
git switch 'main'
git merge --squash 'upstream-pr/13147'
git switch 'main'
git merge --ff-only 'upstream-pr/13147'
git switch 'main'
git merge 'upstream-pr/13147'
git push origin 'main'
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!13147
No description provided.