Skip to content

feat(libSceAgcDriver): skip CMASK decode on single-sample views with viewMip > 0 - #4965

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
pushkarreddyy:feat/agc-cmask-skip-higher-mip
Oct 14, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
pushkarreddyy:feat/agc-cmask-skip-higher-mip

Conversation

@pushkarreddyy

Copy link
Copy Markdown
Contributor

What

On AMD GFX10/GFX11 hardware, CMASK metadata only covers base mip level 0 (or MSAA samples). When a title sets up a mipmapped color target, CB_COLOR_INFO may retain FAST_CLEAR (bit 13) while binding sub-resources (viewMip > 0), which drivers such as Mesa radeonsi explicitly mask off (if (cb_psurf->level > 0) cb_surf.cb_color_info &= C_028C70_FAST_CLEAR; in si_state.c). In AnyPS5, binding viewMip > 0 with FAST_CLEAR set caused DecodeColorBuffer to fail with Require(color.samples > 1 || (maxMip == 0 && !volume && slice == 0), "CMASK fast clears of a mipmapped, 3D or array color target are unsupported").

This change skips single-sample CMASK fast-clear decoding when viewMip > 0, leaving cmaskAddress = 0 and cmaskFastClear = false instead of rejecting the draw.

Tested

Added unit test in core/libs/prx/libSceAgcDriver/tests/Graphics.cpp verifying that a color buffer with FAST_CLEAR set and viewMip == 1 skips CMASK decoding with cmaskFastClear == false and cmaskAddress == 0, while viewMip == 0 on a mipmapped target continues to reject unsupported fast clear. Verified documentation in docs/dev/debt/libSceAgcDriver.md.

Checklist

@xXPBSXx

xXPBSXx commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

Windows test (MinGW GCC 15.2, Release, Windows 10, RTX 4080 SUPER). Built on main 534451426 together with six other open GPU PRs (their own commits applied, no merge conflicts), so only the tests that belong to this PR say something about it:

Not tested: no game run. The batch was built once, not per PR; nothing failed, so no bisect was needed.

AI-assisted (Claude Code).

@pushkarreddyy
pushkarreddyy force-pushed the feat/agc-cmask-skip-higher-mip branch 2 times, most recently from 55a70d0 to a2143e8 Compare October 13, 2026 12:22
@pushkarreddyy

Copy link
Copy Markdown
Contributor Author

Rebased cleanly onto latest origin/main resolving the libSceAgcDriver.md merge conflict with newly merged #4041. Conventions checks pass locally with 0 findings and 0 errors, and Windows unit tests verified 10/10 clean by @xXPBSXx.

This unblocks Teardown (PPSA08182 / Issue #3701). Register state confirmed on hardware: single-sample view with �iewMip = 1 where CMASK metadata only exists on base mip 0 (FAST_CLEAR skipped).

@adriadam10 @oneandonlydean @MarcZX100 Clean, mergeable, and ready for review/merge when convenient.

@xXPBSXx

xXPBSXx commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

Evidence for the error this fixes: in three of my saved runs of PPSA15246 (2026-10-11, before this change) the title stops with AGC graphics: CMASK fast clears of a mipmapped, 3D or array color target are unsupported, the message quoted in the description. The same title also logs runtime image descriptor is invalid in nine other saved runs, which may be a separate problem. I have not run PPSA15246 with this PR applied, so whether this change alone lets it continue is not tested.

AI-assisted (Claude Code).

@pushkarreddyy

Copy link
Copy Markdown
Contributor Author

@xXPBSXx Thanks for confirming the saved run evidence on PPSA15246! That matches the exact CMASK fast clear assertion this PR resolves.

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 14, 2026
@oneandonlydean
oneandonlydean force-pushed the feat/agc-cmask-skip-higher-mip branch from a2143e8 to acbc573 Compare October 14, 2026 01:19
@oneandonlydean

Copy link
Copy Markdown
Collaborator

Rebased onto main to resolve the conflict in docs/dev/debt/libSceAgcDriver.md after #4603 and #4517; no other change.

@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

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
#4790 docs/dev/debt/libSceAgcDriver.md L76-77

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 14, 2026
@oneandonlydean
oneandonlydean merged commit 52d134c into boykopovar:main Oct 14, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* docs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants