AGC: RADV's comp-to-single fast clear of a multisampled DCC target stops Ruffle (PPSA68091) #7582
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 milescoviello on 2026-10-18T15:40:03Z.
What
PS5 Mesa's RADV fast-clears a multisampled DCC color target to a color other than 0000/0001/1110/1111 with a comp-to-single clear. The AGC driver models comp-to-single for single-sample surfaces (#2939, #4700) but not for multisampled targets, so Ruffle (PPSA68091) stops when a movie clears a 4x target to such a color. I ran 36 of Ruffle's own visual tests (frame-1 tests from
tests/tests/swfs/visualin ruffle-rs/ruffle):output.expected.png.define_bits_lossless2_rgb15only by the scaling of its 50x50 bitmap, andfilters__bevelin its text, which the test notes depends on the default font.opaque_backgroundstops on this clear (its DCC key shows it). Two more stop on a storage view that matches this clear's shader, though I haven't confirmed it's that shader. The fourth I haven't traced.Setup: Linux, RTX 4070 Ti (NVIDIA 595.99.02).
main385ed71f2c+ #6543 (Ruffle stops at the RADV fill kernel without it) + #7250 (it stops at the first DCC refill without that). Each SWF was the only game in/data/ruffle/games, run for 32 s.opaque_backgroundinitial multisampled DCC contents are not a supported uniform fast clearcolor_transform_issue_9698,gradient_issue_9892compute shader 0x201d95e00: AGC graphics: storage image access to multisampled color target 0x40023a0000 (1920x1080, 4 samples, vk format 37) as a 1920x1080 texture of 4 samples and guest format 20 (vk 98) is not implementedfilters__displacement_mapwrites to a resident multisampled DCC target or its metadata are not implemented: the DCC range 0x4004606000+0x14000 changed with no buffer fill noted for it. I haven't traced what wrote it.What RADV does
radv_clear_dcc_comp_to_singlebinds the image through a storage view in a uint format of the same texel size:VK_FORMAT_R32_UINTfor 4-byte texels, which is theguest format 20above. It then dispatchesmeta_clear_dcc_comp_to_single. That shader stores the clear color, push constants 8 to 24, into sample 0 of the first pixel of every DCC block (block size in push constants 0 to 8). The DCC keys are then set toGFX9_DCC_CLEAR_SINGLE(0x10). The hardware then reads every block as the color stored in its first pixel.A temporary print in
MultisampledDccClearconfirms it foropaque_background: DCC key 0x10, CMASK 0xcc, clear words 0,VK_FORMAT_R8G8B8A8_UNORM, 4 samples, 581x729.What the driver does with it
MultisampledDccCleartakes only the 0x00, 0x40, 0x80 and 0xc0 keys, so a target first used after the clear isn't imported.R32_UINTview. When no target is resident, it creates one in the view's format, which the later draw in the color format doesn't match.A possible approach
The clear color is in the clear shader's push constants. Recognizing that dispatch on a multisampled DCC target, as #6543 recognizes RADV's fill kernel, would give the color without a storage view in another format. A following 0x10 fill of the target's DCC, or 0x10 keys at import, could then be taken as a clear to that color. The import would also have to check that the color memory holds that color at the blocks' first pixels. I haven't written this. It builds on #6543 and #7250, and I'd like to wait for those before starting.
Not checked: Windows, AMD, a console. The stops were reached only with #6543 and #7250 on top of
main.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-18T15:55:47Z.
Confirmed for the storage-view stops. With
APS5_DUMP_SHADERS, the compute shader that stopscolor_transform_issue_9698(0x201d95e00) is 22 code words with an 8x8 workgroup, dispatched as 240x135 threads for the 1920x1080 target, which is one thread per 8x8 DCC block. Its body scales the thread coordinates by a user-data block size, sets the sample index to 0 (v7 = 0), and does oneimage_storeof four user-data dwords at those coordinates. That is RADV'smeta_clear_dcc_comp_to_single(multisampled variant) from the description. The clear color is in the dispatch's user data, so a driver that recognizes this shader can read it from there.Separately,
filters__displacement_mapisn't the only test that stops onwrites to a resident multisampled DCC target or its metadata are not implementedwith no fill noted for the DCC range.blend_modes__shader_as_mask,filters__bevel_full,filters__bevel_inner,filters__bevel_outerandfilters__glow_with_alpha_strengthstop on it too. I'm tracing what writes those ranges.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-18T16:35:01Z.
Opened #7600 for the comp-to-single stops. It recognizes the multisampled clear dispatch by its code, records the color from its user data for the surface its descriptor names, and imports 0x10 keys as a clear to that color, for texels up to 32 bits. With #6543, #7250 and #7233, the five tests that stopped on it run and match their expected images (32x24-cell mean difference 0.1 to 0.6 of 255).
AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by wachi35676 on 2026-10-19T00:20:48Z.
Windows/NVIDIA data point for the fix stack, which the report lists as not checked. Ruffle Flash (PPSA68091, 1.2.0), relinked with
--windows --windows-fixed-base 0x400000, running one of Ruffle's own visual test SWFs (ruffle-rs/ruffle, MIT/Apache-2.0) at a time from/data/ruffle/games, 30 s each.main8e7904b20writes to a resident multisampled DCC target or its metadata are not implementedoutput.expected.pngmultisampled DCC CMASK compression or register clear is not implementedWithout #7600 and #7641, only
opaque_backgroundstops, withinitial multisampled DCC contents are not a supported uniform fast clear.#7250 conflicts with current
maininNoteColorMetadataFill. I resolved it by keepingmain's HTILE check and then #7250's DCC branch.Windows 11 26300, RTX 5070 Ti (32.0.16.1742), WinLibs GCC 15.2.0, Release.
AI-assisted: yes (Claude Code); results above were run on this machine.
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-19T01:06:18Z.
Thanks @wachi35676 for the Windows/NVIDIA run of the whole stack. Six of Ruffle's SWFs matching their expected images, and
opaque_backgroundstopping without #7600 and #7641, is just what the fixes predict. #7250 conflicted withmainagain after the HTILE change inNoteColorMetadataFill. I'm rebasing it now with the same resolution you used:main's HTILE check first, then #7250's DCC branch.AI-assisted: yes (Claude Code)