feat(agc): draw PS4 multisampled color targets as host-resident targets #9892
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/9892"
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 savvaniss on 2026-10-22T20:49:28Z.
What
Get-fix/AnyPS5#6, moved upstream. #9431 has merged, so the diff against
mainis now only this pull request's own files. oneandonlydean mergedmaininto the branch and fixed it on 29 Oct (head5c8fb7de19), and removed the two refusal assertions (EQAA and single-sample fast clear) fromtests/GcnColorTarget.cppthat their review asked to drop.On #9431 a PS4 color target with more than one sample threw "multisampled GCN color targets are not implemented". Boggle (CUSA03312) renders its 3D scenes into a 4x target, then resolves it with a CB resolve, after an FMASK decompress.
DecodeGcnColorBuffernow decodes 2x, 4x and 8x targets (CB_COLOR_ATTRIB NUM_SAMPLES) when NUM_FRAGMENTS matches. These go to the host-resident multisampled targets that the AGC path already draws, fast-clears and resolves.The debt file gains an entry for PS4 multisampled color targets.
main'sdrawCoversnow holds the CB metadata pass's viewport and scissor test. The padded-extent rule above is an optional GCN target argument of that helper.Tested
Windows 11 Pro 26300, WinLibs GCC 15.2.0, Release, AMD Radeon RX 9070 XT (driver 32.0.31041.1004),
ANYPS5_GPU=AMD.Merge of
main828ac0b2ae, 31 Oct. Head9110e4e17a. The only conflict was indocs/dev/debt/libSceAgcDriver.md: both sides kept.agc_gcn_color_target,agc_driver_graphicsandagc_driver_gcn_detilepass, 3 of 3 on the RX 9070 XT, noVUID-line. Not rerun: the other tests, Linux, games.Merge of
maincae3edaf11, 1 Nov. Head83a0d8ea00. The only conflict waslibSceAgcDriver/CMakeLists.txt:mainmoved the AGC test registrations intotests/cmake, andtools/agc_test_split.py resolvemovedagc_gcn_color_target_teststo its own fragment.agc_gcn_color_target,agc_driver_graphicsandagc_driver_gcn_detilepass, 3 of 3 on the RX 9070 XT under the validation layer, noVUID-line. Not rerun: the other tests, Linux, games.Merge of
main1e658521a0, 3 Nov. Head3c0ee17922(onfde9ff2d9a). The only conflict was indocs/dev/debt/libSceAgcDriver.md: the merge keeps this branch's PS4 multisampled color target entry andmain's render-target entry with its new PS4 depth-target sentence.FormatVersionstaysmain's 52 (this branch does not change it) and no size guard changes. On the RX 9070 XT (Windows, Release) withANYPS5_GPU=AMD ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation:agc_gcn_color_target,agc_driver,agc_driver_graphicsandagc_shader_memorypass, 4 of 4, everySelected GPUline names the RX 9070 XT and there is noVUID-line.tools/check_conventions.py --base origin/mainpasses. Not rerun: the rest of the suite, Linux, and the game.Base. This branch is now
545e2b5b3f, built in two merges:main07da04f947merged into #9431's head26d651d3e0, asmerge/9431-main(4e8243ac48). That merge is offered to Get-fix as Get-fix/AnyPS5#22.merge/9431-mainmerged into this branch, with no file conflicts.agc_gcn_color_target(new) covers these cases:With
State.cppas onmerge/9431-main, on545e2b5b3f, it fails with "multisampled GCN color targets are not implemented".Validation layer: run with
ANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1andVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,ctest -V, onmain07da04f947and on this branch. The tests:agc_gcn_color_target,agc_driver,agc_driver_pm4,agc_driver_graphics,agc_driver_register_key,agc_driver_gcn_detileandagc_driver_pattern_buffer_fillagc_driver_flipand the 16video_out_flip_*modesagc_gcn_decode,texture_format_lookup,agc_driver_resource_cache_replaced_textureandagc_depth_copy_kept_bytesagc_driver_depth_*testsResults:
main: 48 of 49 pass (agc_gcn_color_targetandagc_driver_gcn_detileare not onmain).agc_driver_depth_plane_partial_store, "repeated lookups of the first layer of an unchanged array proved no refresh", on every run on this machine.VUID-line orwas not found but was requested by env var VK_INSTANCE_LAYERS. EverySelected GPUline names the RX 9070 XT.Boggle (CUSA03312), on
ps4/limbo-gpuat93eeee0141(#6977's head then) with Get-fix/AnyPS5#1, #2 and #5, #8223, #8224 and local stand-ins forsceGnmDrawInitDefaultHardwareState200andsceGnmUpdate*Shader: its title, menus and a round render through the 4x target, the FMASK decompress and the resolve, at 16 to 60 fps. Not rerun on this base: the title also needs #9432.tools/check_conventions.py --base origin/mainpasses.tools/pr_overlap.py --branch feat/ps4-gcn-msaa-targets, againstmain88f99678bf. This PR's own lines conflict only indocs/dev/debt/libSceAgcDriver.md, on neighbouring entries, with three pull requests:The other rows come from #9431. #6977, #9432, #9672 to #9676, #9842 and #10435 share its new files and exports. #6612, #6905, #7085, #7978, #9508, #9899, #9915, #10064, #10348, #10556, #10764 and #11098 conflict in files #9431 changes, and conflict the same way with
merge/9431-mainalone.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)main)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-10-29T03:37:11Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
This PR's own change (the GCN multisample decode, the CMASK fields and the padded-extent rule) builds and passes its tests when I apply it to
main+ #9431's current head. The head545e2b5b3fitself conflicts withmainand does not compile on Linux, because it carries an older #9431.What I ran
545e2b5b3f83fed05a1a34fb21b1fdfda0c0707amain:b433c40f2f46aa2e59e19806010a839ac8572d64eefa50841267cd0bd5352af17248139445fb0613Results
mainb433c40f2fGraphics/include/State.hpp(2 hunks) andGraphics/src/State.cpp(2 hunks)git diff --checktools/check_conventions.py --base origin/mainAll conventions checks passed.545e2b5b3f(Linux, GCC 16)PipelineJournal.cpp:41-42static assertsmain+ #9431eefa508412: buildagc_gcn_color_targetVUID-lines, nowas not found but was requested by env var VK_INSTANCE_LAYERSVUID-lines, nowas not found but was requestedVK_LAYER_KHRONOS_validationinserted; everySelected GPUline names the RTX 4070 Ti SUPERMerge conflicts with main
State.hpp:ShaderStages(mainaddshullWaveSizeandtessellationGeometry, the branch addslegacyVertex) andDrawKeyRegisters(array size 50 onmain, 52 on the branch).State.cpp:decodeDepthPlane's extent (GCNDB_DEPTH_SIZEbranch) andDecodeShaderStages(main's tessellation-geometry path against the branch's GCN legacy-vertex block).All four hunks are #9431 code. #9431's current head resolves them: it merges cleanly with this
main.Build of the head alone
Validation-layer run on the PR
Negative control
On the reconstructed tree I restored only
Graphics/src/State.cppto the version onmain+ #9431, rebuiltagc_gcn_color_target_testsand ran it. It fails, as the description says:I then restored the PR's
State.cpp.Findings
Blocking
main. See the table above. The conflicting hunks are #9431 code that this branch carries from the older merge4e8243ac48. #9431 has since moved on (eefa508412, rebased onto a newermain), and that head merges cleanly. Fix: rebuild this branch on #9431's current head, or rebase the single commitdb05653037onto it. This PR's own diff (CMakeLists.txt,State.cpp,GcnColorTarget.cpp, the debt entry) applies tomain+eefa508412without conflicts. The checklist line "Based on currentmain" does not hold for the current head.main. The guards atPipelineJournal.cpp#L41-L42expectsizeof(State) == 840andsizeof(ShaderStages) == 112, but #9431'sShaderStages::legacyVertex(State.hpp#L35) makes them 848 and 116. The guards sit under#if defined(__linux__) && defined(__x86_64__) && defined(__GLIBCXX__), which is why the Windows/MinGW runs in the description and in ycbuzi's comment did not hit them. #9431 fixed this ineefa508412("update the pipeline journal layout guards for ShaderStages::legacyVertex"), so moving to that head (finding 1) fixes this too.Non-blocking
State.cpp#L2200-L2202,drawCoversswaps the target's padded extent for the covered extent, so the pass is accepted. The host resolve still uses the whole padded extent:MultisampleTarget.cpp#L1275setsrenderArea = {{0, 0}, source.extent}. For a 1920x1088 target resolved with a 1080-row viewport, the host writes destination rows 1080 to 1087, which the console leaves alone. Those rows are usually tile padding, but a texture with the padded height, or a copy of the whole surface, would see different bytes. Fix: either limit the resolve's render area to the covered extent, or state in the debt entry that the padding rows outside the viewport are resolved (and that an FMASK decompress also expands them).GcnColorTarget.cpp#L100-L101. The head has not changed since that comment.I checked the decode against what the AGC multisample path consumes and found nothing wrong. The GCN path fills only
cmaskAddress,cmaskBytesandcmaskFastClear. WithdccAddress == 0,MultisampledCmaskonly acts on whole-range uniform fills (NoteFill,SeedCode), so the pipe-interleaved GCN CMASK layout does not matter, and a single slice's(CMASK_SLICE.TILE_MAX + 1) * 128bytes is covered by the guest's aligned clear.MultisampledColorBytesreturns 0 for GCN tile modes, so a memory fill over the color surface is refused, not absorbed. That is a throw, not silent behaviour.Not verified
main+ #9431eefa508412+ this PR's own diff.mainwithout #9431:agc_gcn_color_target,agc_driver_gcn_detileandagc_driver_pattern_buffer_filldo not exist there. The baseline ismain+ #9431.video_out_flip_*tests and theagc_driver_depth_*tests from the description; I ran only the tests closest to this PR's own change.To get this to a good state
eefa508412or later) so it merges cleanly withmainand builds on Linux (blocking findings 1 and 2).GcnColorTarget.cpplines 100 and 101.Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-10-29T12:32:23Z.
Review: CHANGES_REQUESTED
Re-checked — changes still requested
The new head
6a7d99f3bemerges currentmain(which now contains #9431) and drops the two refusal assertions. It merges cleanly, but it does not compile: the merge declares threeGuestTextureResourcefields twice. With that duplicate removed locally, the PR's own change builds, its tests pass under the validation layer, and the negative control fails as expected.What changed since my last review
afc92cbb87:main5454cd2e45merged into the branch. #9431 has since been merged intomain, so the PR diff againstmainis now only this PR's own five files.6a7d99f3be: removes the EQAA and single-sample fast-clear refusal assertions fromtests/GcnColorTarget.cpp, as oneandonlydean asked.State.cpp,CMakeLists.txt, the debt entry) is the same as indb05653037.What I ran
6a7d99f3be4a1c21904fa774de11450564ac4032main:5454cd2e455994d992aca39335ce60507eeda1ebmain5454cd2e45git diff --checktools/check_conventions.py --base origin/mainAll conventions checks passed.GuestTextureResource.hpp:112-114redeclaregcnPitch,gcnPow2Pad,gcnLinearGeneralVUID-lines, nowas not found but was requested by env var VK_INSTANCE_LAYERSmain(8 tests)VUID-lines, nowas not found but was requestedSelected GPUline names the RTX 4070 Ti SUPER, in both runsBuild of the merged head
The compiler printed these in French; I translated them.
Validation-layer run, PR + local fix
Negative control: with only
Graphics/src/State.cpprestored frommain,agc_gcn_color_targetfails:Previous findings
main: Resolved. #9431 is merged and the head merges cleanly withmain5454cd2e45.PipelineJournal.cpplayout guards: Resolved. The PR no longer touchesState.hpp. With the duplicate fields removed,libSceAgcDriverbuilds on Linux with GCC 16,PipelineJournal.cppincluded.drawCoversrule (State.cpp#L2353-L2356) and the full-extent render area (MultisampleTarget.cpp#L1381) are unchanged, and the debt entry does not mention it.6a7d99f3be. The 2x/4x/8x cases, the missing-CMASK-address check and the partial-coverage cases remain, and the production refusals with their debt entry are unchanged.New findings
Blocking
GuestTextureResource.hpp#L108-L114declaresgcnPitch,gcnPow2PadandgcnLinearGeneralonce beforefmaskCmaskAddress(the branch's old #9431 copy) and once after it (main's copy, as merged from #9431). Git merged both insertions without a conflict because they sit on different sides offmaskCmaskAddress. Every translation unit that includes the header fails, solibSceAgcDriverand everything that links it fails too. Fix: delete lines 108-110. The file then matchesmainexactly, which is correct, because this PR has no change of its own in that header. That is the only change I made to get the results above.Non-blocking
545e2b5b3f", built in two merges. Its test counts are from that head. The checklist still lists "Depends on: #9431", which is merged now. After the fix, suggest setting Depends on to none and restating the base and test results for the new head.Not verified
video_out_flip_*andagc_driver_depth_*tests from the description; I ran only the tests closest to this PR's change.To get this to a good state
gcnPitch,gcnPow2PadandgcnLinearGeneraldeclarations atGuestTextureResource.hpp:108-110, so that the header matchesmain.Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T05:42:16Z.
Review: APPROVED
Re-checked — approved
5c8fb7de19removes the duplicateGuestTextureResourcefields that blocked the previous head, andfde9ff2d9amerges currentmain. The merged tree builds,agc_gcn_color_targetpasses and fails withmain's production files, and both failures that look new also fail withmain's production files.What changed since my last review
5c8fb7de19deletes the second copies ofgcnPitch,gcnPow2PadandgcnLinearGeneral.9110e4e17a,83a0d8ea00andfde9ff2d9amergemain. The AGC test registration now lives intests/cmake/agc_gcn_color_target_tests.cmake, followingmain's split. The PR's ownState.cppchange, test and debt entry are unchanged.Depends on: noneand lists eachmainmerge with its test results.What I ran
fde9ff2d9a1a81604be4962c7f717fb10d06e3c6,main5cb015caaaaf83f8ee431414ee6a457b5b307d49, merged treed7c08d33052c2d537b6490e4fa0f540615dbdc50.maingit diff --checkcheck_conventions.pyAll conventions checks passed.main; I traced the 2 that look new tomain(see below).VUID-; the layer loaded in 758agc_gcn_color_target,agc_driver_graphics,agc_tiled_resolve,agc_driver_gcn_detilemainThe 2 failures that look new are not the PR's. The script's baseline (
096c45570f) is older thanmain5cb015caaa. With the PR's production files restored frommainand the targets rebuilt, both still fail in the same way:agc_driver_image_sample_lod_clamp_shader_lanereportsthread 0 component 1 is 0.000000, expected 0.062500.unwrap_self_UnwrapTest_test_new_output_inherits_the_destination_directory_groupreportsOSError: [Errno 22]fromos.chown, which is the sandbox's group handling.Run with main's production files
Negative control
I restored
Graphics/src/State.cppandGraphics/include/GuestTextureResource.hppfrommainand rebuilt.agc_gcn_color_targetthen fails withAGC graphics: multisampled GCN color targets are not implemented. With the merged files restored and rebuilt, it passes, andgit status --porcelainis empty.Previous findings
GuestTextureResource.hpp#L108-L112declares each field once, and the merged tree builds.Depends onis now none and each merge is listed. The Base paragraph still says "This branch is now545e2b5b3f", and its numbers are for older heads. The latest results the description itself gives are for83a0d8ea00.State.cpp#L2376-L2379is unchanged. The resolve'srenderAreais stillsource.extent(MultisampleTarget.cpp#L1468). oneandonlydean says this was left on purpose.New findings
Blocking
None.
Non-blocking
fmaskCmaskAddressmoves inGuestTextureResource.hppfor no reason. This confirms BunnyFl's note. The PR's only change to the header (L112) moves the field belowlinearPitch. I found no positional initialization,sizeof,offsetoformemcmpof the struct; every use assigns by name (GuestTextureResource.cpp:309,MultisampleTarget.cpp:85,:103), so the move is harmless. Restoringmain's order would remove the file from the diff and avoid future merge conflicts there.Not verified
Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T19:42:35Z.
Review: APPROVED
Re-checked — approved
The only new commit is
3c0ee17922, a merge ofmain1e658521a0. The PR's own three commits are byte-identical in range-diff, and the diff againstmainis still the same five files (+183/−5). The merged tree builds,agc_gcn_color_targetpasses and fails again withmain's production files, and the one test flagged with newVUID-lines reports the same lines withmain's production files.What changed since my last review
3c0ee17922mergesmain1e658521a0intofde9ff2d9a. The conflict indocs/dev/debt/libSceAgcDriver.mdis resolved by keeping both sides: the PS4 multisampled color target entry (now L119) sits directly abovemain's render-target entry (L120), andmain's new PS4 depth-target sentence is kept.range-diffshowsdb05653037,6a7d99f3beand5c8fb7de19unchanged.main1e658521a0" paragraph with RX 9070 XT results for this head. These results are author-reported.What I ran
3c0ee179221d343ec624148fe66a3b7c3f90f436,main086c0686c8adff3ee648fdbe34e0b0b647e1d511, merged tree1c4c5e95106cae318149af2b382b3cd106062d4b.maingit diff --checkcheck_conventions.pyAll conventions checks passed.libs(script)main.agc_driver_image_gather_volume, was flagged as "not run on main". It comes frommain(see below).agc_gcn_color_target,agc_driver_graphics,agc_driver_gcn_detileThe
agc_driver_image_gather_volumeVUIDs (VUID-VkSamplerCreateInfo-addressModeU-01079and theaddressModeU/V/W-parameterones) are not the PR's. I restoredmain'sState.cppandGuestTextureResource.hppand rebuilt. The test then reports the same four validation errors with the same message IDs, and it still passes. The script's baseline did not run this test. The PR changes only the GCN color-target decode and the metadata-pass coverage check, so it does not reach sampler creation.With main's production files
Negative control
With
Graphics/src/State.cppandGraphics/include/GuestTextureResource.hpprestored frommainand rebuilt,agc_gcn_color_targetfails withAGC graphics: multisampled GCN color targets are not implemented. With the merged files restored and rebuilt, it passes, andgit status --porcelainis empty.Previous findings
545e2b5b3f", though, and the long validation list below it is for older heads.State.cpp#L2388is unchanged.fmaskCmaskAddressmoved inGuestTextureResource.hpp: Still open, non-blocking. The field is still belowlinearPitch(L112-L113). The move is harmless, but restoringmain's order would drop the file from the diff.New findings
Blocking
None.
Non-blocking
None.
Not verified