feat(agc): blend against an opaque destination for CB_COLOR_ATTRIB FORCE_DST_ALPHA_1 #1914
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1914"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by TheAggie on 2026-10-08T23:33:51Z.
What
CB_COLOR_ATTRIBhad to be zero, so any draw whose color target setFORCE_DST_ALPHA_1(bit 17) was rejected. RADV on the PS5 (mihawk-99/PS5_Mesa) sets it for color formats without alpha, so blending reads the destination alpha as 1, as for an RGBX surface. In ccleste (PPSA59322) six draws per frame were skipped this way.The bit is now accepted, and the target's blend factors are rewritten to what they become when the destination alpha is 1:
DST_ALPHAbecomesONE,ONE_MINUS_DST_ALPHAbecomesZERO, andSRC_ALPHA_SATURATE(min(As, 1 - Ad)) becomesZERO.DST_ALPHAandDST_COLORbecomeONE, andONE_MINUS_DST_ALPHAandONE_MINUS_DST_COLORbecomeZERO, since the destination color's alpha component is the destination alpha.Other factors are unchanged. Every other
CB_COLOR_ATTRIBbit is still rejected.Test (
agc_driver_graphics,OpaqueDestinationAlphaTests): without the bit, the destination-alpha and destination-color factors decode unchanged. With it they becomeONEorZEROas above,SRC_ALPHA_SATURATEbecomesZEROin the color equation and stays in the alpha equation, and anotherCB_COLOR_ATTRIBbit (18) is still rejected.Related: #419 (multisampled targets) also relaxes the
CB_COLOR_ATTRIBcheck, for the sample and fragment fields. The two edit the same line, so whichever merges second needs a small rebase; they don't conflict in behaviour.Tested
Windows 11 Pro (26200), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release, NVIDIA GeForce RTX 5070 Ti.
mainwith this PR and my RADV raster-defaults PR merged together. It was run from the generatedCTestTestfile.cmakecommands because antivirus blocksctest.exeon this machine.tools/check_conventions.py --base origin/mainpasses on this branch alone.Not tested on AMD, Intel, Linux or macOS.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by klosixgaming-arch on 2026-10-09T00:47:20Z.
Review: APPROVED
The blend-factor rewrite is correct and I can approve it.
FORCE_DST_ALPHA_1sets the destination alpha to 1, the mappings are right:DST_ALPHA → ONE,ONE_MINUS_DST_ALPHA → ZERO,SRC_ALPHA_SATURATE → ZERO(sincemin(As, 1−1) = 0). For the alpha equation, treating the destination color's alpha component as the destination alpha (DST_ALPHA/DST_COLOR → ONE,ONE_MINUS_* → ZERO) is consistent.DecodeColorBuffer'szero(cx, 0x31d + stride, ~0x20000u, ...)now carves out bit 17 while rejecting every otherCB_COLOR_ATTRIBbit — good, you didn't just zero the whole word.OpaqueDestinationAlphaTests) checks each factor both with and without the bit, and confirms another bit (18) is still rejected. Solid coverage of the exact boundary.Non-blocking notes:
zero(...)line inDecodeColorBuffer. Whichever merges second needs a manual rebase and the two should be compatible (bit 17 vs sample/fragment fields), but please verify there's no behavioural interaction — specifically that #419's sample/fragment relaxation doesn't also touch0x31d's other bits in a way that changes what "other bits still rejected" means once both are in.FORCE_DST_ALPHA_1were ever combined with a per-pixel alpha source, "destination alpha = 1" still holds because it's a destination override — so this is safe, but it's worth one sentence in the debt entry stating that the factor rewrite is unconditional once the bit is set.Written with AI assistance.
Imported from boykopovar/AnyPS5. Originally posted by johnmaia on 2026-10-09T01:01:36Z.
Linux run on AMD, since the description lists it as not tested: Ubuntu 24.04.5 (kernel 6.8), GCC 13.3, Release, AMD Radeon RX 7600 (RADV NAVI33, Mesa 25.2.8). This PR's head
1e20b4ec, merged ontomainf1451396. Full ctest: 494/494 pass, the same asmainon this machine, with the GPU tests running on the RX 7600 (none skipped). That includesagc_driver_graphicswith this PR's new cases.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-10T01:48:24Z.
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.
main)core/libs/prx/libSceAgcDriver/Graphics/src/State.cppL741