fix(agc): claim multisampled memory in a CB metadata pass over a single-sample target #24994
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/24994"
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 birdmarty on 2026-11-21T14:24:14Z.
What
Claim overlapping multisampled color target memory when a CB metadata pass (
EliminateFastClearorDccDecompress) runs over a single-sample color target, matching what binding that single-sample target as a color attachment already does.Previously,
RunColorMetadataPasslooked up the single-sample target's resident image throughmetadataPassResident(which callsCachedStorageSurface) without claiming the target's address range first. If a host-only multisampled color target still guarded those bytes from an earlier use of the same memory, the guard treatedmetadataPassResident's lookup as a guest storage-image read of live host-only samples and threwa storage image access of ... overlaps multisampled color target ... (4 samples), whose samples are only on the host: guest access to it is not implemented. Because the draw path already callsClaimMultisampleTargetMemorywhen binding a color target over that memory, the CB metadata pass—which writes the same target's bytes—should claim them the same way before touching the target so the multisampled guard retires cleanly.Changes
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp: callClaimMultisampleTargetMemory(color.MemoryAddress(), color.bytes)for each single-sample target in thepass.targetsloop ofRunColorMetadataPass(after the multisampled-target branch that #24993 added).core/libs/prx/libSceAgcDriver/tests/Recorder.cpp: addmetadataPassOverMultisampleMemoryTests(run in both--multisample-onlyand the fullagc_driver_recordersuite), creating a host-only 4x multisampled color target viaFmaskDecompress, verifyingMultisampleColorTargetOverlaps, then running anEliminateFastClearpass over a single-sampleSW_64KB_R_Xtarget at the same address and verifying that it succeeds and clears the multisampled guard.docs/dev/debt/changes/fix-agc-metadata-pass-claims-msaa-memory.md: updateMultisampled color targetsto list a CB fast-clear eliminate or DCC decompress over an overlapping single-sample color target as a memory-reuse claim.Tested
Windows 11 Pro (build 26300), Intel Core i9-9900K, MinGW-w64 GCC 15.3.0, Release build with tests, AMD Radeon RX 6800 (vendor
0x1002, device0x73bf, AMD proprietary driver 26.10.1 / Windows driver 32.0.21045.16010, Vulkan 1.4.315), based onorigin/main729981cb5a(rebased after #24993 merged).Focused AGC tests on
main729981cb5aand on this branch (06a886cfe2), same machine and GPU, withANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation(Vulkan SDK 1.4.363.0) andVK_LOADER_DEBUG=layer. The set has 29 tests in 11 programs (agc_driver_graphics,agc_driver_recorder,agc_driver_cmask_fast_clear,agc_driver_pipelined_metadata_pass*,agc_driver_cached_image_multisample_guard,agc_driver_multisample_{retirement,srgb_twin,fill_host_only},agc_driver_multisampled_pass_order,agc_driver_msaa_dcc_*,agc_driver_color_memo_{msaa,metadata,untracked-cmask}_*):main(729981cb5a): 28 passed, 1 failed (agc_driver_recorder, pre-existing Windows address-reuse failure:AGC graphics: 64 KiB R_X 512x512, 3 mips, no DCC, an access to the first unit: an earlier case's image is still in the live registry over the reused memory, so this image would store whole).Insert instance layer "VK_LAYER_KHRONOS_validation"logged 31 times, 0 missing-layer errors, 0VUID-lines.06a886cfe2): the same 28 passed, 1 failed (agc_driver_recorder, identical pre-existing failure).Insert instance layer "VK_LAYER_KHRONOS_validation"logged 31 times, 0 missing-layer errors, 0VUID-lines.agc_driver_recorder_tests --multisample-onlyunder the same validation layer env: passed (CB metadata pass over a multisampled target's memory tests passed,VK_LAYER_KHRONOS_validationinserted 1 time, 0VUID-lines).origin/main729981cb5aDraw.cppbuilt with this branch's test):agc_driver_recorder_tests --multisample-onlypasses #24993's twoMSAA clear and resolvetests, then fails withAGC graphics: a storage image access of 0x13c0c540000+0x10000 overlaps multisampled color target 0x13c0c540000+0x40000 (4 samples), whose samples are only on the host: guest access to it is not implemented.py -3 tools/check_conventions.py --base origin/main: passed.py -3 tools/debt_fold.py --check: this PR's fragment passes; the check reports twolibkernel_sysfragments (docs-libkernel-pro-measured-1360.md,fix-kernel-sys-title-workaround-bit-limit.md) that fail the same way onmain729981cb5aand are not touched here.py -3 tools/pr_overlap.py --branch fix/agc-metadata-pass-claims-msaa-memoryon06a886cfe2(2,339 open PRs): 0 overlaps among mergeable PRs; 59 other PRs that conflict withmaincould not be compared automatically, and none of their diffs changesRunColorMetadataPass,metadataPassResidentorClaimMultisampleTargetMemory(before the rebase #6808, #6989/#6995/#7002, #13963, #13147, #24572 and #24735 were also read by hand); none implements this change.Title test: Forza Horizon 5 (
PPSA22327v01.685.672, local stack onmain089d2df72e+ #23688 +fix/agc-msaa-fast-clear-eliminate(#24993) + this fix; the stack resolved the shared loop exactly as this rebase does, multisampled targets through #24993's branch and single-sample targets claimed first):metadataPassResident): aborted witha storage image access of 0x3eefb00000+0x480000 overlaps multisampled color target 0x3eefb00000+0x7f80000 (4 samples), whose samples are only on the host: guest access to it is not implemented.0x3eefb00000+0x480000claimed the 4x memory): retired the guard cleanly and ran ~70 s to the next unrelated stop. The refusal did not come back in any of the 120 runs with this change since.Not tested: other GPUs, Linux/macOS host builds, console hardware, or a standalone re-run of the title on
06a886cfe2(itsRunColorMetadataPassloop is identical to the tested stack's).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)mainand this change, 0 VUIDsImported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T05:25:14Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the inspected implementation and test support merging.
What I ran
Reviewed head
06a886cfe233cba7d9112f2261a74574b7b15565. No commands or tests were run in this review. The author reports focused Windows/Vulkan tests, including a passing--multisample-onlyrun; those results were not independently verified.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
The full
Recorder.cppfile was excluded as too large, but all 91 added lines and both changed call sites were read. Tests, builds, hardware behavior, and the author-reported test output were not independently verified. No other changed files were excluded.To get this to a good state
Nothing is required.