fix(agc): draw a PS_ITER_SAMPLE program once per pixel into a one-sample depth target #7729
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/7729"
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-19T03:21:00Z.
What
A one-sample depth target under a multisampled rasterizer without
MSAA_ENABLEis drawn as a one-sample draw at the pixel center (#6196's follow-up,3dadf7712). A pixel program that runs withPS_ITER_SAMPLEthrew there. Ghost of Tsushima (PPSA02225) draws its depth-only, alpha-tested pass this way and stops on it: 2xPA_SC_AA_CONFIG,PA_SC_MODE_CNTL_00x2 (MSAA_ENABLEclear),PA_SC_MODE_CNTL_10x06030000 (PS_ITER_SAMPLE),DB_SHADER_CONTROL0x50 (KILL_ENABLE), no color target, and noANCILLARYorSAMPLE_COVERAGEinput.On this path every sample is taken to be at the pixel center, and the one-sample target keeps sample 0's coverage. So whether the console runs such a program once per pixel or once per sample, each invocation gets the same position, interpolants and derivatives, and gives the same kill decision, depth and color, and only sample 0's reaches the target. The program is now drawn once per pixel, without sample shading (
perSampleShadingwas already off here, since the draw has one sample).ANCILLARY(sample index) andSAMPLE_COVERAGEinputs still throw, as do points, lines, alpha-to-coverage, a sample-mask export andDB_EQAAZ interpolation or overrasterization.PS_ITER_SAMPLE; it isn't needed by any title I know of yet.@SandstromPL, who added this refusal with the one-sample depth path, checked the reasoning: without an
ANCILLARYorSAMPLE_COVERAGEinput an invocation can't tell which sample it runs for. Following their suggestions, ff312a718b rewords the debt entry: it now says up front thatPS_ITER_SAMPLEalone still throws only with one-sample color targets and no depth target, and that atomics and append or consume counters are where a console that runs such a program once per sample would give a different result.Tested
Ubuntu 24.04, GCC 13.3, NVIDIA RTX 4070 Ti (595.99.02), on
mainca13a56a58.agc_driver_graphics: the case that expected the refusal forPS_ITER_SAMPLEwithKILL_ENABLEnow decodes as one sample, with or without a one-sample color target, with no sample shading, and passes the precheck. Adding anANCILLARYinput to it still throws.mainwith the changed test, it fails on the refusal (a one-sample depth target under a multisampled rasterizer without MSAA_ENABLE is unsupported ...).multisample|msaa|sample|depth|^agc_driver_graphics$pass.main676d42396(MinGW-w64, WinLibs):agc_driver_graphicspasses 3 of 3, and fails 3 of 3 withmain'sState.cppand the changed test.main6b8228b2b. The 21 tests built fromtests/Graphics.cpppass 3 of 3. With only this PR's test change,agc_driver_graphicsfails on the refusal.mainf72c7aacfa(head1f63ba35af). @blawesom offered the same rebase, green on an RX 9070 XT with RADV. The debt line is cut to the gap, as CONTRIBUTING.md now asks, with no title named in it. The 621 tests matching^agc_driver_|^agc_shader|recompiler|spirvpass, andagc_driver_graphicspasses 3 of 3.PS_ITER_SAMPLE(PA_SC_MODE_CNTL_10x06030000,DB_SHADER_CONTROL0x50), which threw, and one without it, with a depth export (DB_SHADER_CONTROL0x11). With this PR it draws past both and stops 39 s in at an unrelated check, a compute shader that imports a multisampled depth or stencil surface (native multisample stencil or depth format import is not implemented).VK_LAYER_PATH,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 ctest -V, RTX 4070 Ti, Linux. Neither log reportswas not found but was requested by env var VK_INSTANCE_LAYERS.^agc_driver_graphics$onmainf72c7aacfaand on this PR's code (c7aa42ebe5, the same code as the current head) gives no validation messages in either log.mainf72c7aacfaor on this head.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-19T03:28:35Z.
@milescoviello yes, the reasoning holds for me. I didn't have a specific case in mind; the refusal was there because I hadn't worked through what per-sample invocations could observe on this path. With
MSAA_ENABLEclear every sample is taken to be at the pixel center, which this path already assumes. So without anANCILLARYorSAMPLE_COVERAGEinput, an invocation can't tell which sample it runs for. Sample-rate interpolants, derivatives, the kill decision, an exported depth and the color all come out the same, and the one-sample targets keep sample 0's. The diff and the test look right to me: the old case now decodes as one sample without sample shading, and addingANCILLARYstill refuses it. I only read it and didn't run it.Two small suggestions, take them or leave them:
PS_ITER_SAMPLE, anANCILLARYorSAMPLE_COVERAGEpixel input and a sample-mask export throw in a pixel program that runs", and makes the exception two sentences later. Saying there thatPS_ITER_SAMPLEalone only throws on the color-only path would read more directly.The color-only branch could take the same rule later; I agree it can wait for a title.
AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-19T03:28:53Z.
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.
main)docs/dev/debt/libSceAgcDriver.mdL34Some 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.
core/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdImported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-19T05:12:56Z.
Windows data point for
2c99c48ffalone merged ontomain676d42396(mergee3beedebf, clean): Windows, MinGW-w64 (WinLibs) toolchain,ANYPS5_NO_SHADER_CACHE=1,ctest -R '^agc_driver_graphics$', three separatectestinvocations.Graphics/src/State.cpprestored tomain(the changed test kept): exit code 8 in 3 of 3 runs. The tail of a failing run ends withAGC graphics: unexpected failure: AGC graphics: a one-sample depth target under a multisampled rasterizer without MSAA_ENABLE is unsupported for points or lines and with alpha-to-coverage, PS_ITER_SAMPLE, a sample index or coverage input, a sample-mask export, or DB_EQAA Z interpolation or overrasterization(the message namesPS_ITER_SAMPLEamong the refused cases).agc_driver_graphicsis the only test I ran. Not tested: the othermultisampletests listed in the PR, a title run, other GPUs.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-19T06:04:34Z.
@SandstromPL thanks for working through it, and for both suggestions. I took them in ff312a718b. The debt entry now says at the start that
PS_ITER_SAMPLEalone still throws only with one-sample color targets and no depth target. It also names atomics and append or consume counters as the accesses where a once-per-sample console would give a different result. It's a docs-only commit, so the test results stand.@xXPBSXx thanks for the Windows run, including the reverted
State.cppcontrol. It's in the description now.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-19T09:26:23Z.
Rebase handoff — rebased onto current
maincleanly (both commits, authorship unchanged).Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release,
BUILD_TESTING=ON, AMD RX 9070 XT / RADV): builds; conventions pass; full suite green apart from the four knownmainregressions (#5444 Mesa, #7584 BDA, #7766, #7784), none from this PR.To pick it up:
Head is
f962ba0ac.Imported from boykopovar/AnyPS5. Originally posted by savvaniss on 2026-10-19T09:33:14Z.
Intel and AMD Windows data: with this PR's test changes,
agc_driver_graphicsfails onmainand passes with the PR, on an Intel UHD 770 and an AMD RX 9070 XT.Windows 11 Pro 26300, WinLibs GCC 15.2.0 r7, Release, every execution test built,
ANYPS5_NO_SHADER_CACHE=1, serial CTest. Intel UHD Graphics 770 (8086:a780), driver 32.0.101.7088. AMD Radeon RX 9070 XT (1002:7550), driver 32.0.31041.1004, withVkCacheemptied first. This headff312a718merged intomain6b8228b2b. "Without" means only this PR's diff totests/Graphics.cpp, applied tomain6b8228b2b.tests/Graphics.cppagc_driver_graphicsfails:a one-sample depth target under a multisampled rasterizer without MSAA_ENABLE is unsupported for points or lines and with alpha-to-coverage, PS_ITER_SAMPLE, ...; the other 20 passAI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-19T11:30:34Z.
@blawesom thanks for the rebase and the RADV run. I pushed my own rebase onto
mainf72c7aacfa(1f63ba35af), not yours, because the debt line also had to change. oneandonlydean asked for no titles to be named in the debt files, and CONTRIBUTING.md now asks for entries cut to the gap. The code changes are the same as in yours. The 621 driver and recompiler tests pass on the new head, andagc_driver_graphicspasses 3 of 3.@savvaniss thank you for the UHD 770 and RX 9070 XT runs, with the test-only control failing on both. They're in the description now.
AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-20T18:49:56Z.
Picking this up for our testing: it addresses the stop we see in PPSA03208 on current main, one of the titles we're bringing up, and we'd like to move it into main. We'll review, test and merge it under the normal process. Your comments and review are still very welcome, @adriadam10.
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-20T19:02:36Z.
Thanks @oneandonlydean. It merges cleanly with current
main, so I'll leave the branch alone while you test it, unless you'd like a rebase or a change. #8121 makes the same change for a one-sample color target, in case PPSA03208 needs that case too.AI-assisted: yes (Claude Code)