feat(agc): merge a draw into more than one unclamped normalized color target #12916
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/12916"
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 Tehshortbus on 2026-10-29T14:16:07Z.
What
A draw that blends into more than one color target with BLEND_CLAMP clear stopped with
a draw merges into one color target at most, so blending unclamped normalized color cannot join another merged color target. PPSA26344 (02.002.000) stops on such a draw while it streams its first world cell (#12796). The title's log names MRT1 (CB_COLOR_INFO 0x0000000c,CB_BLEND1_CONTROL 0x40010504). In #675, MRT0 was reported with the same values before #11684. This follows the shape @oneandonlydean suggested on the issue: a list of merge entries, one interlock region, and a two-target case in the unclamped-blend execution test.ShaderPixelStageInfo::targetMergebecomestargetMerges, one entry per merged target.ExportTargetMergesreturns an entry for every target with a partial write mask. The cache key, the draw lookup hash, the draw register key and the recompiler's variant hash cover every entry.FlushColorTargetMergestores each pending entry inside the draw's one pixel interlock region.independentBlend, two merged targets with different blend equations otherwise gave differentpAttachments(VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605).24 files, +371/−212. The tests are +222/−84: the existing tests that read
targetMergemove to the list, and the rest are the new cases below.Tested
CachyOS Linux (kernel 7.3.0-4-cachyos), GCC 16.2.1, Release, NVIDIA GeForce RTX 4070 SUPER (615.78.08).
Head
c037722384onmain1b75a2de11. The tests below ran on the same change onmainb0465557fd(47bdfe07a2). None of the 26 commits between the twomains touch this PR's files.New cases:
agc_driver_graphics:CB_COLOR_INFO 0x0000000candCB_BLEND0_CONTROL/CB_BLEND1_CONTROL 0x40010504at different addresses decode into two merge entries for MRT0 and MRT1. Each has its own descriptor and SRC_ALPHA, ONE_MINUS_SRC_ALPHA, ADD for color and alpha.CB_BLEND1_CONTROLset to ONE, ONE, each entry keeps its own factors.agc_driver_unclamped_normalized_blend: one draw exports MRT0 and MRT1 and blends both, checked per pixel against the CPU reference, on the stored channels:Every draw in the test, including the 20 existing single-target ones, also checks that its pixel shader has one interlock begin and stores every merged target inside it. The test builds the draw state itself, so it reaches the request, the SPIR-V and the pipeline but not register decode; decode is covered by
agc_driver_graphics.agc_shader_memory:Focused run.
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ctest --test-dir build-tests -V -R '^(request_serializer|agc_shader_memory|agc_driver_graphics|agc_driver_packed_unorm4444_color_target|agc_driver_packed_unorm4444_multisample_partial_write|agc_driver_packed_unorm4444_partial_write|agc_driver_unclamped_normalized_blend)$'mainb0465557fdVUID-lineswas not found but was requested by env var VK_INSTANCE_LAYERSFull suite. 2905 of 2906 pass under the same environment, with no
VUID-line.guest_freebsd_clocksfails because the host zone is not UTC (#12736) and passes withTZ=UTC.Negative controls. Each control breaks one piece of the change; each is caught:
main's refusal of any second merged targetagc_driver_graphicsfails with the title's messageagc_driver_unclamped_normalized_blendfails: not every merged target is stored inside the interlock regionagc_driver_unclamped_normalized_blendfails on MRT1's pixelsagc_driver_unclamped_normalized_blendpasses, but the validation layer reportsVUID-…-00605twiceagc_shader_memoryfailsPPSA26344 (02.002.000). One run each from launch, same files and settings, with
anyps5-entitlements.inilisting the add-on label the title needs:main5454cd2e455454cd2e45(3cbd74244b)c037722384These runs show the draw no longer stops the title. They don't show that the merged targets look right, since
mainnever got past this point to compare against; the execution test checks that.python3 tools/check_conventions.py --base origin/mainandgit diff --checkpass.Not checked:
DrawDecode,DrawLookup,DrawRegisterKey), other than in the PPSA26344 run.A merged target beside a target that blends normally still gives that target's attachment state next to an empty one. Without
independentBlendthis is the samepAttachmentsdifference as onmainbefore this change; the focused and full runs report noVUID-line for it.Overlap.
tools/pr_overlap.py(main609422fefe) reports no overlap for the pull requests it could compare. For the 77 it could not, I merged each with this branch and withmainand compared the conflicts in shared files:TargetMerge. This branch adds conflicts inCacheKey.hpp,DrawLookup.cpp,Recompiler.cpp,ShaderStageInputInfo.hppandShaderInputInfoBuilder.cpp, and its lines fall inside their existing conflicts inRequestSerializer.cpp,SpirvModuleEmitter.cpp,State.cppandShaderMemory.cpp.State.cppand the multisampled 4_4_4_4 tests.DrawRegisterKey.cppandShaderInfoCollector.cpp.State.cpp,CacheKey.hpp,Recompiler.hppandSpirvModuleEmitter.cpp.main(7): #6194, #6223 and #6548 (libSceAgcDriver.md); #8004, #9356 and #9387 (RequestSerializerTests.cpp); #12662 (ShaderMemory.cpp).main.All 13 are older, so this lands after them, recorded in Depends on. I'll rebase onto whichever merges first.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code