Repository navigation
feat(agc): take a full DCC fill of a resident multisampled target as its fast clear - #7250
Conversation
|
Windows datapoints, head
|
|
Independent validation of head 257a470, composed with our retained Sonic integration in fork6d76fb2098, on main922dc8999e. Original PR commits/authorship are retained; #6543 is also present. This is a composed integration check, not an isolated upstream-main result. Regression and devices (Windows11 Enterprise10.0.26200, GCC15.2):
Sonic Unleashed Recompiled (PPSA99902, #4443 / #5336): integration6146 previously stopped at NOW LOADING after28.101s on
This corroborates the practical relevance of the resident-clear handoff preserved in our historical08891d938 menu/cinematic branch. Your current-backend implementation lets us recover that milestone without copying the broad historical stack. Thank you. AI-assisted validation/reporting: Codex. Extended observation: same6d76/RTX5080 reaches the level-loading/tutorial screen after the movie, then exits0xC0000409 after758.222s without timeout on New main-only follow-up — 2026-10-19 UTCOn literal main A local test-only print probe narrows the NVIDIA4x failure to That 4MiB import covers both the destination and resident source. This is a CPU metadata-fill case, earlier than the mode5 GPU-fill/rewatch case discussed above. #6457's aligned-import grouping is relevant context, not an established introducing commit. Production code/guards are unchanged in the probe; no fix or new game result is claimed. Import-window control completed: restricting this fixture to single-allocation imports passes4x3/3; restoring the default-window probe reproduces the refusal3/3. Production guards are unchanged. Distinct report #8103 holds the reproduction, control and limits; no global window reduction is proposed. AI-assisted: yes (Codex). |
|
@Amoenus, thank you for the two-GPU validation and the Sonic run. I've added both to the description, with Sonic noted as your integration composition rather than an upstream AI-assisted: yes (Claude Code) |
|
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.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
257a470 to
c92d72c
Compare
c92d72c to
802150f
Compare
|
Windows title run on head Ruffle (PPSA68091), Cross to start the demo, 120 s,
So your Linux result reproduces on Windows/NVIDIA. One question: from the demo start to the limit, every frame dump is uniform white (mean 255 per channel, cursor only), 13 and 11 dumps, and the screenshot at the limit looks the same. White is the Tests:
Not checked: AMD, Intel, Linux, Rush 2, Wave Race 64. Written with Claude Code assistance (validation by a subagent, reviewed in this session). |
|
Thanks @screamm for the Windows run, and for narrowing the White frames. It's white on Linux too. On The demo is a 21-byte stub in the eboot (at file offset 0x140ec31: To check that drawn content survives the absorbed clear, I gave Ruffle a 180-byte SWF I generated. It has a white 960x540 stage with three rectangles: red 200x150, blue 300x200 and green 150x150. The red one moves between x = 100 and x = 300 on alternate frames (2 frames at 2 fps). Copied to
The cover Ruffle saves from its own readback ( The
Tested on head 5be36f0:
I haven't run it on Windows. With these commits, your failing 8-sample case should either report AI-assisted: yes (Claude Code) |
|
Title data on the current heads, now that #7253 is in AI-assisted: yes (Claude Code) |
5be36f0 to
58c28d9
Compare
|
Rebased onto AI-assisted: yes (Claude Code) |
58c28d9 to
cbae9e7
Compare
|
Rebased onto
AI-assisted: yes (Claude Code) |
jotitadev
left a comment
There was a problem hiding this comment.
Apple GPU / MoltenVK run of the new DccRefillTests, as another vendor next to the NVIDIA, AMD and Intel runs.
Machine: Apple M2 Max, macOS 27.2, x86_64 build under Rosetta 2. Head cbae9e7af. Method: macos-port platform (main a373e85 + the macOS series) + this PR's diff, not main. Stacked with #7600 (038f050) in the same build.
| Test | SDK MoltenVK 1.4.2 | MoltenVK main + SPIRV-Cross #2704 |
|---|---|---|
agc_driver_msaa_dcc_clear_2 |
pass 3/3 | pass 3/3 |
agc_driver_msaa_dcc_clear_4 |
pass 3/3 | pass 3/3 |
agc_driver_msaa_dcc_clear_8 |
skipped | skipped |
clear_8skips cleanly ("the device lacks the requested multisample color attachments"): MoltenVK reportsframebufferColorSampleCounts1/2/4 only on this GPU, so the 8x refill path has no coverage on Apple.- The write-watch probe reports "host imports resolve write protection: no ... imported ranges stay watched", so the GPU-fill case runs the watched path here (as on NVIDIA, not as on ANV).
- Red check: with only this PR's
tests/execution/AlphaToCoverage.cppon the base,clear_2andclear_4fail on both drivers withwrites to a resident multisampled DCC target or its metadata are not implemented. - Full
^agcsuite (excluding flip/display/lds_atomics64,-j1, 30 s timeout): failure list identical to the base on both drivers (known MoltenVK capability gaps), no new failures.
GPUs tested: Apple M2 Max (MoltenVK 1.4.2 from Vulkan SDK 1.4.363, and MoltenVK main + SPIRV-Cross #2704), macOS 27.2.
Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
|
@jotitadev thanks for the Metal runs. The 8x skip is useful to know: MoltenVK's 1, 2 and 4 color sample counts leave that refill path without Apple coverage. It's in the description now, along with the red check on both drivers. AI-assisted: yes (Claude Code) |
…its fast clear A multisampled DCC color target imports its uniform DCC fast clear on first use and then refuses any later change to its color, DCC or CMASK memory. Titles built on the PS5 Mesa stack fast-clear such a target every frame with two buffer fills, the CMASK to 0xcc (FMASK cleared, color expanded) and the DCC to a uniform clear key, so the second frame stopped on "writes to a resident multisampled DCC target or its metadata are not implemented". The fills of a resident DCC target's metadata are now noted. When a fill covered the whole DCC range since the last use and the range holds its key once pending writes land (LandedUniformMetadataByte, which reads the bytes directly rather than through the resident read guard), the next use clears every sample to that key's color, as the import does, and takes the new DCC and CMASK generations. A CMASK written since must have been filled whole too. Partial fills, other keys, CMASK-only writes and any write to the color memory are still refused. Fills of a DCC target's CMASK no longer go to the CMASK-only fast-clear tracker, which refused the expanded code 0xcc. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e their writes When a fill of the metadata could not be taken because one of its ranges was no longer watched, the check reached a watched range that the fill had changed first and reported the write instead of the unwatched range. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Off Windows, the GPU fill case now runs with host imports kept watched, so it always checks the absorbed clear, and a new case runs it with imports left unwatched, which must be refused. On Windows a settled import is watched again when its settle is polled, possibly before the draw takes the fill, so an unwatched fill may be either refused or drawn, and a drawn one is checked. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
cbae9e7 to
50264ab
Compare
|
Rebased onto AI-assisted: yes (Claude Code) |
|
Checked the absorbed DCC/CMASK fill path against the refusals it keeps (partial fill, other keys, CMASK-only, color writes), the watch check running over every range before any write check, and the new |
What
A native multisampled color target with DCC imports its uniform DCC fast clear on first use (
initialDccClear). After that,checkDccCurrentrefuses any change to its color, DCC or CMASK memory.Titles built on the PS5 Mesa stack fast-clear such a target with two buffer fills. The RADV fill kernel, which #6543 takes as a buffer fill, writes the CMASK to
0xcc(FMASK cleared, color expanded) and the DCC to a uniform clear key. They do this every time they clear the target. So the target's second use stops on:A local print in
NoteColorMetadataFillshowed the fills (main e383833 + #6543):0x40062c0000+0x1000<-0xcccccccc0x40062c1000+0x1000<-0x404040400x4004600000+0x6000<-0xcccccccc0x4004606000+0x14000<-0xc0c0c0c0The fills are recorded on the GPU. When the next draw binds the target, they're usually still pending in the same batch.
This PR handles that case in
MultisampleTarget.cpp:NoteColorMetadataFillnow records, per resident DCC target, the last fill over its DCC range and the last one over its CMASK range. A fill that covers the range only partly clears the record.ApplyFastClearfirst runsabsorbDccFill. When a whole-range DCC fill was noted and the range holds that key once pending writes land, it computes the clear withMultisampledDccClear, as the import does, from those bytes. It then clears every sample to it and takes the ranges' new write generations. A CMASK written since the last use must also have been filled whole with what it now holds.LandedUniformMetadataByte(DccMetadata.cpp) returns the uniform byte a range holds once pending recorded writes land (KeysAfterPendingWrites), or the bytes in memory when nothing is pending. It reads the bytes directly, afterFlushGpuWrites, rather than throughGuestMemory::Read, whose resident-image read guard refuses these ranges.checkDccCurrentthen checks only the color range, so the absorbed fill may still be pending.MultisampledCmask. That tracker models CMASK-only fast clears and refused0xccas mixed (its MSAA codes are fix(agc): read a multisampled target's CMASK by its MSAA codes #6669's topic).Why the fill is enough: after a fill of uniform clear keys over the whole DCC range, every block reads as the clear color whatever its color bytes and FMASK hold. The guest's DCC bytes can't tell us this on their own, because draws don't update them on the host. A same-value CPU store to the keys stays refused (the existing case in
DccFastClearTests).Tested
Linux (Ubuntu 24.04, GCC 13.3, Release), RTX 4070 Ti, NVIDIA 595.99.02;
main5859889. Rebased ontomaine0fcdb5 (c92d72c), which has #7132; the only conflict was this debt entry next to #7071's new one. On the rebased headagc_driver_msaa_dcc_clear_{2,4,8}pass 3 of 3, and the 20 tests matchingmsaa|multisample|dcc|cmask|fmask|alpha_to_coveragepass.agc_driver_msaa_dcc_clear_{2,4,8}(newDccRefillTests, run by--dcc-fast-clear), at 2, 4 and 8 samples with and without a CMASK:1111by a whole DCC fill, plus a whole CMASK fill, on the CPU and recorded on the GPU withVulkanDevice::FillBuffer, resolves to the new color under the next draw;0xffkeys and a CMASK-only fill are refused.On
mainall three tests fail withwrites to a resident multisampled DCC target or its metadata are not implemented. With this change they pass 3 of 3.ctest
^agc_(662 tests, NVIDIA): all pass, on d73d04f7a. The head differs only in sending unwatched metadata to the existing refusal (below), which doesn't happen on this driver. The three DCC tests pass 3 of 3 on the head too.On an Intel Arrow Lake iGPU (Mesa 26.1.6 ANV), the 19
^agc_tests whose names cover MSAA, multisample, DCC, CMASK, FMASK and alpha-to-coverage: 18 pass.agc_driver_sample_multisample_targetfails the same way onmainthere; test(agc): skip the multisampled target test without storage image multisampling #7191 addresses it.[write-watch]line reads "host imports resolve write protection: yes".checkDccCurrent's existingrequires watched guest memoryrefusal, and the GPU-fill case expects that refusal when the range is unwatched.Titles, 60 s each with scripted pad input, measured on b4e35279a:
main+ #6543 + #7132writes to a resident multisampled DCC target ...sampling multisampled color target 0x400c000000 (3840x2160, 8 samples, vk format 44) as a 3840x2160 texture of 8 samples and guest format 56 (vk 37) is not implementedWith #7253 on top, which samples that 8x target through a red/blue swizzle, Rush 2 runs to the 60 s limit at 600 presents per 10 s. Wave Race 64 presents at that rate until a segfault at 48 s that I haven't looked at yet.
Ruffle also needed #7132, now in
main: without it, a store to a neighbouring range in a shared 64 KiB tracker block still trips the color or metadata check later. Rush 2 and Wave Race 64 reach their next stop with #6543 alone.Rush 2 and Wave Race 64 again on the current heads, now that fix(agc): sample a multisampled target whose format differs only in red/blue order #7253 is in
main:main5057673 + fix(agc): take RADV's fill-memory kernel as a buffer fill #6543 (7bfb645) + this PR (5be36f0), 60 s with pad input. Rush 2 runs to the limit and ends on its "Locate ROM / Exit" launcher (104 frame dumps, one every 30 frames). Wave Race 64 presents until the segfault at 48 s (57 dumps). For comparison,main13e48ed alone stops both at 2 s onmultisampled DCC CMASK compression or register clear is not implemented, andmain385ed71 + fix(agc): take RADV's fill-memory kernel as a buffer fill #6543 stops both at 2 s onwrites to a resident multisampled DCC target or its metadata are not implemented.@Amoenus validated head 257a470 on Windows with an RTX 5080 and an AMD Radeon (comment). The DCC refill tests and four related groups pass 3 of 3 on both, and Linux/lavapipe passes the groups it supports. With their Sonic integration branch and fix(agc): take RADV's fill-memory kernel as a buffer fill #6543, Sonic Unleashed Recompiled (PPSA99902) no longer stops at NOW LOADING. It reaches PRESS START, the CONTINUE menu, the opening cinematic and the level-loading screen, where it stops on an unrelated mipmapped 3D target (AGC: mipmapped 3D color targets stop PPSA99902 after the opening movie #7260).
Rebased onto
mainb106f6f (50264ab). The conflict was fix(agc): identify invalidated multisample DCC ranges #6869'srequireDccRangeincheckDccCurrent: the refill's shortened range list now goes throughmain's helper, and the watch check still runs over every range before any write check. The debt line is cut to the gap, as CONTRIBUTING.md now asks. The 39 tests matchingdcc|multisample|msaa|alpha_to_coverage|cmask|fillpass, and this PR's 8 tests pass 3 of 3. Khronos validation (the LunarG SDK's 1.4.363 layer,ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 ctest -V, RTX 4070 Ti): no validation messages onmainor with this PR, and neither log reports the layer missing.Rebased onto
main0d078f7 (802150f). The only conflict wasdocs/dev/debt/libSceAgcDriver.md, where feat(libSceAgcDriver): support polygon primitive type 21 #7175 added the polygon primitive entry just above this PR's DCC fast clear entry; both are kept. The 24 tests matchingmultisample|dcc|cmask|fill|msaapass.Rebased onto
main6e27fc8 (58c28d9, with the two follow-up commits). The only conflict was next tomain's new view-type parameter ofMultisampleTarget::Sampled: this PR'sNoteMetadataFillsits just above it, and both are kept. On the rebased headagc_driver_msaa_dcc_clear_{2,4,8}pass 3 of 3, and the 25 tests matchingmultisample|dcc|cmask|fill|msaapass.Head 5be36f0 adds two commits after @screamm's Windows run (comment), which found
clear_8failing 3 times in 113 runs:checkDccCurrentnow checks that every range is watched before it checks any for writes, so a fill it can't take because a range is unwatched is reported asrequires watched guest memory. Off Windows, the GPU-fill test case now runs with host imports kept watched, and a new case with them unwatched must be refused. On Windows, where a settled import can be watched again before the draw, an unwatched GPU fill may be refused or drawn, and a drawn one is checked.clear_{2,4,8}pass 20 of 20 on NVIDIA and 3 of 3 on Intel ANV, and the 28 tests matchingmsaa|multisample|dcc|cmask|fmask|alpha_to_coverage|fillpass.Ruffle's built-in demo is an empty 21-byte SWF, so its frames are white with or without this PR. With a generated SWF of three rectangles on a white stage, one of them moving every other frame, Ruffle on
main385ed71 + fix(agc): take RADV's fill-memory kernel as a buffer fill #6543 + this PR draws it correctly in all 84 frame dumps, with no content left over from the previous frame. Without this PR it stops at 11 s on the same line (comment).check_conventions.pypasses.pr_overlap.pylists the multisample work inMultisampleTarget.cpp(fix(agc): reclaim retired multisample color targets #6215, fix(shader,agc): support multisampled 2D array descriptor image shape and runtime views #6635, fix(agc): keep the guest's sample order where pixel (0,0)'s locations stand in for a 2x2 grid #6683, fix(agc): identify invalidated multisample DCC ranges #6869, fix(agc): sample multisampled targets in read-only layout #6971, feat(agc): preserve initial native multisample color contents #6973, feat(agc): snapshot resident multisample color bytes #6987, 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) and the same debt entry (fix(agc): let the storage image cache budget follow the heap's use like the sampled one #7071, feat(libSceAgcDriver): support polygon primitive type 21 #7175). This PR touchesApplyFastClear, thecheckDccCurrentloop and a few new members, and I'll rebase onto whichever lands first. It doesn't change the lines fix(agc): exclude neighboring stores from DCC invalidation #7132 edits.macOS: @jotitadev ran the DCC refill tests on an Apple M2 Max under MoltenVK 1.4.2 and MoltenVK main + SPIRV-Cross Ratchet & Clank: Rift Apart: SIGSEGV since #861, an address-less 64 GiB reservation now takes the addresses the title hints next #2704 (head cbae9e7, x86-64 build under Rosetta, stacked with feat(agc): take RADV's comp-to-single clear of a multisampled DCC target #7600):
clear_2andclear_4pass 3 of 3 on both drivers and fail with only the test file applied;clear_8skips, since MoltenVK offers 1, 2 and 4 color samples there. The rest of their^agcsuite is unchanged.Validated on Windows by @Amoenus (RTX 5080 and an AMD Radeon) and by @screamm (RTX 4070, before the last two commits), and on macOS by @jotitadev (Apple M2 Max). Not checked on a console.
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