fix(agc): draw a PS_ITER_SAMPLE program once per pixel into a one-sample color target #8121
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/8121"
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-19T22:37:17Z.
What
#7729 draws a pixel program with
PS_ITER_SAMPLEonce per pixel into a one-sample depth target under a multisampled rasterizer withoutMSAA_ENABLE. It left the one-sample color target branch refusingPS_ITER_SAMPLE, because no title needed it yet. Ghost of Tsushima (PPSA02225) now does: after its intro it draws into a one-sampleR16G16_SFLOAT960x540 color target with no depth target. The draw has 2xPA_SC_AA_CONFIG(0x108001),PA_SC_MODE_CNTL_00x2 (MSAA_ENABLEclear),PA_SC_MODE_CNTL_10x06030000 (PS_ITER_SAMPLE),DB_SHADER_CONTROL0x50, andSPI_PS_INPUT_ENA0xb01 (PERSP_SAMPLEand position, noANCILLARYorSAMPLE_COVERAGE), and it stopped with "a one-sample color target under a multisampled rasterizer without MSAA_ENABLE is unsupported with PS_ITER_SAMPLE ...".#7729's reasoning (checked there by @SandstromPL) holds for a color target too. On this path every sample is taken to be at the pixel center, and the one-sample target keeps sample 0. So without an
ANCILLARYorSAMPLE_COVERAGEinput every invocation gets the same position, interpolants and derivatives, and gives the same color, and only sample 0's reaches the target. The branch now acceptsPS_ITER_SAMPLEthere and clearsperSampleShading, which this branch, unlike the depth one, decodes before it reduces the draw to one sample. The program then runs once per pixel.ANCILLARYandSAMPLE_COVERAGEinputs and a sample-mask export still throw.PS_ITER_SAMPLEwith one-sample color targets as throwing.Stacked on #7729. The first two commits are #7729's.
Tested
371652fd0e, rebased ontomain9232ee9c98(debt entry conflict withmain'sINTERPOLATE_COMP_Zrewrite:main's text kept with this PR's two edits). Linux (Ubuntu 26.04.1, GCC 15.2, Release, RTX 4070 Ti, 615.71.09): of the 61 tests matching^agc_driver_graphics$|multisample|msaa|depth, 60 pass 3 of 3;agc_driver_sample_order_recipe_depth_locationsfails 3 of 3 as it does onmainon this GPU (#9313, fixed by #9056).Rebased onto
main751b2881aeasc974601a60. The only conflict was the debt entry, which #8871 rewrote onmain:main's text is kept, with this PR's two changes (no longer listingPS_ITER_SAMPLEwith one-sample color targets as throwing, and the once-per-pixel sentence covering both targets). On that head, Ubuntu 26.04.1, GCC 15.2, RTX 4070 Ti (615.71.09), the 59 tests matching^agc_driver_graphics$|multisample|msaa|depthgive 58 passing 3 of 3. The one failure,agc_driver_sample_order_recipe_depth_locations, fails the same way onmain("the clear between the recorded draw and its replay left depth other than the clear value") and is fixed by #9056.Ubuntu 24.04, GCC 13.3, Release, NVIDIA RTX 4070 Ti (595.99.02).
agc_driver_graphics: draw C (a one-sample color target under 4xPA_SC_AA_CONFIGwithoutMSAA_ENABLE) withPS_ITER_SAMPLEand aPERSP_SAMPLEinput now decodes as one sample without sample shading and passes the precheck. With anANCILLARYinput added, it is still refused.^agc_driver_graphics$|multisample|msaa|depthpass 3 of 3.agc_driver_graphicspasses 3 of 3 on an NVIDIA RTX 3080 (617.42) and on an AMD Radeon RDNA 2 iGPU (1002:164e, 32.0.21045.5002). That run did not use the validation layer or a title.main3fd1cc393againstmainwith 54a7460f5 merged, with the Khronos validation layer,ANYPS5_NO_SHADER_CACHE=1andANYPS5_REQUIRE_VULKAN=1,ctest -R '^agc_driver_graphics$|multisample|msaa|depth|lds|subgroup_barrier|shader_disk_cache' -V. Both give the same result, 67 of 69 passing,agc_driver_graphicswith the new checks among them.agc_driver_native_depth_bda_clearskips on both, andagc_driver_image_msaa_address_on_planewasn't built in either. Neither log reports the layer missing or has aVUID-error.VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 ctest -R '^agc_driver_graphics$|multisample|msaa|depth' -Von #7729's head1f63ba35afand on this PR. 47 of 47 pass on each, neither log reports the layer missing, and neither has aVUID-error.mainwith the PRs it needs to get here (#7726, #7725, #7729, #6300 rebased, #7985, #8115 and a local separate-stencil-plane change). Without this PR it stops 55 s and 70 s in (two runs) on this refusal. With it, the refusal is gone, and the run goes on loading until its 16 GiB memory limit stops it 108 s in.test/ghost-9742-9717at 3ec696f7fe (#9533, #9742 and #9717) with #8115 (2620f8d62e) merged, release libraries, 20 GiB cap. Without this PR a warm and a cold run stop 146 s and 267 s in on this refusal. With this PR merged as well (54a7460f52), a warm and a cold run both reach the 600 s limit with no refusal: the game shows its brightness calibration screen and then its intro, at about 1.3 FPS.tools/check_conventions.pypasses, apart from thedebt-lengthwarning on the entry this PR shortens (3,161 characters, already over 1,000).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
Imported from boykopovar/AnyPS5. Originally posted by SandstromPL on 2026-10-20T07:25:57Z.
@milescoviello I read the color-target branch on 54a7460f5 against #7729's head, and the reasoning holds there as well.
State.cppL1295 is needed. L1216 decodesperSampleShadingwhilesamplesis still above one, and only the depth branch lowerssamplesbefore that (L1193-1201).sampleCoverageSupported(L1217). It can refuse onlySAMPLE_COVERAGE, which this branch already refuses.samplesis 1 and the sample locations are zeroed (L1207-1209). SoPERSP_SAMPLEandLINEAR_SAMPLEresolve to the center barycentrics (InstructionTranslator.cppL351-353), and every invocation sees the same inputs.Require, it fails on the refusal (your da132bb60d). Without the clear, it fails inrequireOneSampleon!perSampleShading(Graphics.cppL723).One checklist item: the body describes the PPSA02225 stop at 55 s and 70 s that this PR removes, but the line says
Unblocks: none. CONTRIBUTING.md asks for the title ID and its Game bring-up discussion there. That would beUnblocks: PPSA02225 #4461, since Ghost of Tsushima's discussion is #4461 (#5166 is the Windows black-frames issue). It also adds theunblocks titlelabel, so reviewers take the PR first. #8115 describes a PPSA02225 stop too and saysnoneas well.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-20T07:29:45Z.
@SandstromPL thank you for checking the color branch against #7729's head, and for both halves of the test. You're right about the checklist. Both this PR and #8115 now say
Unblocks: PPSA02225 #4461. I also listed the open PRs the title needs on Linux in the discussion: https://github.com/boykopovar/AnyPS5/discussions/4461#discussioncomment-19063501AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by TheSovietWaffle on 2026-10-20T07:39:32Z.
Tested on RTX 3080 (NVIDIA 617.42) and AMD Radeon RDNA 2 iGPU (
1002:164e, 32.0.21045.5002), Windows 10 Pro 22H2, WinLibs GCC 15.2.0, Release, head54a7460f5:agc_driver_graphicspasses 3 of 3 on both GPUs. Not run: the Khronos validation layer, and no title.AI-assisted: yes (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-20T07:44:25Z.
@TheSovietWaffle thank you for the Windows runs on the RTX 3080 and the RDNA 2 iGPU. They're in the description now, credited to you, with what wasn't run.
AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by root-over on 2026-10-20T07:45:28Z.
RADV run, a driver this PR hasn't been tested on yet: Linux (Ubuntu, kernel 7.0), Ryzen 5 5625U iGPU (Vega/GCN 5, RADV RENOIR, Mesa 26.0.8), GCC 15.2.0, Release.
main3fd1cc393againstmainwith this head (54a7460f5) merged (a clean merge), same build directory,ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,ctest -R '^agc_driver_graphics$|multisample|msaa|depth|lds|subgroup_barrier|shader_disk_cache' -V:agc_driver_graphicswith the new draw C checks.agc_driver_native_depth_bda_clearskips on both.agc_driver_image_msaa_address_on_planewasn't built in either run.was not found but was requested by env var VK_INSTANCE_LAYERS), and neither has aVUID-error.Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-20T07:46:50Z.
@root-over thank you for the RADV run. It's the first one on Mesa for this PR, and with the validation layer on both sides. It's in the description now, credited to you, including the skip and the test that wasn't built.
AI-assisted: yes (Claude Code)