Repository navigation
fix(agc): apply the pending CMASK clear in a fast-clear eliminate of a multisampled target - #24993
Conversation
…a multisampled target A CB fast-clear eliminate (CB_COLOR_CONTROL mode 2) over a multisampled color target threw, because its texels are on the host and only a CB resolve and an FMASK decompress were modeled. An eliminate writes the fast-clear colour into the tiles its CMASK marks as cleared, so it now applies the pending CMASK fast clear to the host image, as the FMASK decompress already does. It requires a CMASK address; a DCC decompress of a multisampled target still throws. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
NVIDIA run of the Tested selection: no regression. Setup: RTX 3070 8 GB, NVIDIA 610.57.04, Ryzen 5 5600X, Debian 13 (kernel 6.12.115), GCC 13.3.0 Release, validation layer 1.4.335. Base is the merge-base e60b2f7, head is e2a5008.
The three skips are the device's: AI-assisted: yes |
|
Windows data for an NVIDIA GPU and an AMD APU, with and without the Khronos validation layer. With this PR all 11 tests pass on both GPUs in every run. With only this PR's tests, both changed programs fail with the refusals from your description. Setup
Tests:
Not run: a title. AI-assisted: yes (runs scripted with an AI assistant, on the machine above). |
What
Apply a pending CMASK fast clear to the host image when a CB fast-clear eliminate (
CB_COLOR_CONTROLmode 2) targets a multisampled color target, instead of refusing the pass.Previously,
DecodeColorMetadataPassaccepted only a CB resolve (mode 3) or an FMASK decompress (mode 5) over a multisampled color target and threwCB metadata pass over a multisampled color target, whose texels are on the host, is unsupportedfor mode 2. On the console, a fast-clear eliminate writes the fast-clear colour into tiles whose CMASK marks them as fast-cleared; in AnyPS5, an FMASK decompress already handles this for multisampled targets by callingMaterializeMultisampleTargetClear. A fast-clear eliminate now takes the same path when the target has a CMASK address. A fast-clear eliminate without a CMASK address and a CB DCC decompress (mode 6) over a multisampled target still throw.Changes
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp: allowColorMetadataPass::Mode::EliminateFastClearover multisampled targets whentarget.cmaskAddress != 0; throw"fast-clear eliminate of a multisampled target without a CMASK address"when absent, and keep refusingDccDecompressover multisampled targets.core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp: inRunColorMetadataPass, route multisampled targets (color.samples != 1u) toMaterializeMultisampleTargetClear(context, color)andcontinue, matchingFmaskDecompress.core/libs/prx/libSceAgcDriver/tests/Graphics.cpp: update the no-CMASK eliminate rejection test, add a decode test for a 4x multisampledSW_64KB_R_Xtarget with CMASK and DCC (CB_COLOR_CONTROL=0x00cc0020), and check that DCC decompress (0x00cc0060) over the same target still throws.core/libs/prx/libSceAgcDriver/tests/Recorder.cpp: generalizefmaskDecompressMsaaTestsintomsaaClearPassTestsand run it for bothFmaskDecompressandEliminateFastClear, verifying that a seeded CMASK fast clear materializes to the host 4x image, resolves to the clear colour, and does not re-clear on a second eliminate.docs/dev/debt/changes/fix-agc-msaa-fast-clear-eliminate.md: updateMultisampled targets in CB passesto document fast-clear eliminate alongside FMASK decompress, including that guest CMASK is left untouched (console rewrite to expanded is not modeled) and DCC decompress still throws.Note: this PR and #24994 both edit the same loop in
RunColorMetadataPass(Draw.cpp). Whichever merges second will need a rebase soClaimMultisampleTargetMemoryruns only for single-sample targets (after theif (color.samples != 1u)branch).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/maine60b2f7.Focused AGC tests on
maine60b2f7 and on this branch (e2a5008), 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(e60b2f7): 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.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 (fast-clear eliminate MSAA clear and resolve tests passed,VK_LAYER_KHRONOS_validationinserted, 0VUID-lines).origin/maine60b2f7State.cppandDraw.cppbuilt with this branch's tests):agc_driver_graphics_testsfails withAGC graphics: unexpected failure: AGC graphics: CB metadata pass over a multisampled color target, whose texels are on the host, is unsupported (only a CB resolve is modeled), andagc_driver_recorder_tests --multisample-onlyfails withAGC graphics: fast-clear eliminate did not materialize the seeded clear to the host multisampled image.py -3 tools/check_conventions.py --base origin/mainandpy -3 tools/debt_fold.py --check: both passed.py -3 tools/pr_overlap.py --branch fix/agc-msaa-fast-clear-eliminate(2,185 open PRs): 0 overlaps among mergeable PRs; 64 PRs that conflict withmaincould not be compared automatically and were checked manually (along with feat(agc): reuse a native multisample colour target and honour guest HTILE clears #6808, feat(agc): publish completed native color snapshots #6989/feat(agc): publish native color before guest memory reads #6995/feat(agc): publish native color for read-only shader buffers #7002, fix(agc): store storage results pending under a multisampled color target before it takes the memory #13963, feat(agc): expand a CMASK fast clear that matches the DCC clear of its target #13147, feat(agc): resolve packed 11_11_10 float multisample targets #23252, feat(agc): average the samples of a 4_4_4_4 unorm CB resolve #24049, fix(agc): replay stencil reference exports of indirect draws #24572, fix(agc): check stencil replay depth feedback against buffer descriptors #24735); none implements this change (fix(agc): store storage results pending under a multisampled color target before it takes the memory #13963 is a complementary text neighbour inDraw.cpp).Title test: Forza Horizon 5 (
PPSA22327v01.685.672, single run each on this machine):main291739a + fix(agc): read 1D-array T#s through DIM 1D from their base slice #23688, runs 6–7): aborted on a fast-clear eliminate (CB_COLOR_CONTROL=0x00cc0020,CB_COLOR_INFO=0x18046718) over a 4x MSAA 3840x2160B10G11R11target with CMASK fast clear on, DCC and FMASK set.main089d2df + fix(agc): read 1D-array T#s through DIM 1D from their base slice #23688 + this fix'sState.cpp/Draw.cppchange, run 8): passed that eliminate cleanly and progressed to the next unrelated stop.Not tested: other GPUs, Linux/macOS host builds, console hardware measurement of guest CMASK after an eliminate, or a standalone re-run of the title on e2a5008 (the
State.cppandDraw.cppdiff is unchanged from the tested commit).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 VUIDs