feat(agc): draw the last provoking vertex through the barycentric tessellation stages #7426
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/7426"
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 DavidSamir on 2026-10-18T05:45:42Z.
What
With #7308, a device without geometry shaders draws the barycentric emulation through generated tessellation stages. In last provoking vertex mode (
PA_SU_SC_MODE_CNTL.PROVOKING_VTX_LAST) those draws still stopped withlast provoking vertex requires VK_EXT_provoking_vertex with provokingVertexLast enabled. Apple GPUs under MoltenVK have neither geometry shaders nor that extension, so after #7308 this became the next stop for several catalog titles on macOS.The generated stages don't need the extension. The evaluation stage already writes each flat parameter as one vertex's value at every corner of the patch, so the host's choice of provoking vertex for the tessellated triangle cannot change what the pixel shader reads. This PR picks that vertex from the draw's mode, the same way #7251 handles rect lists:
BuildBarycentricTessellationShaderstakes the provoking vertex, 0 or 2 (anything else throws), and the evaluation stage writes the flat parameters from it.ValidateProvokingVertex: for these generated stages, last mode no longer requiresVK_EXT_provoking_vertex. A flat per-vertex parameter (flat && perVertex) still throws, as it does for every pipeline in last mode.shader.mdandlibSceAgcDriver.mdnow describe the exception.Commits: shader stages, driver wiring, tests, docs, then a merge of current
main.Tested
Apple M2, macOS 26.7.1, MoltenVK 1.4.2 (no
geometryShader, noVK_EXT_provoking_vertex), x86-64 under Rosetta, on the community macOS stack with #7308. The changed files also compile on this Mac against currentmain, and the conventions check passes.agc_driver_pixel_barycentric_emulation(extended) passes on the M2. A new pixel shader reads the raw I/J (which turns the emulation on) and a FLAT_SHADE input throughv_interp_mov_f32P0. Inside the triangle the weights match, and the flat value is exactly vertex 0's clip x (-0.8) in first mode and vertex 2's (-0.25) in last mode. The geometry route still runs first mode only, where the device has geometry shaders.agc_driver_graphics_testspasses. New cases:Titles (homebrew catalog, checksum-checked, 60 s each, relinked for macOS):
mutex lock failedmessage appears only when the run is stopped at the end)viewport depth outside [0, 1] requires VK_EXT_depth_range_unrestricted, which the M2 lacksRégie5 (PPSA99520) also gets past this stop, then hangs the GPU about 2 s in. The hang stays when every draw of this PR's stages is skipped (
APS5_SKIP_SHADERon their pixel shader), so it is unrelated.Device limits of the M2 that stop titles here, not tested past them: no
geometryShader,shaderFloat64,VK_EXT_provoking_vertexorVK_EXT_depth_range_unrestricted.Not tested: Windows and Linux, where devices with geometry shaders keep the unchanged geometry route.
Overlap: our #6741 changes the same function, letting a last-mode draw with no flat or per-vertex pixel input use the first-vertex mode. The two only add separate exemptions, so the code merges as both together. Whichever lands second gets a small merge of
Pipeline.cppand the provoking-vertex debt line from me.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)Imported from boykopovar/AnyPS5. Originally posted by DavidSamir on 2026-10-18T05:59:14Z.
Cross-vendor check on NVIDIA, head
814f17982built as is (the merge withmainis already in the head).Setup: Windows 11 Pro 26300, NVIDIA GeForce RTX 3070 (
10de:2488), driver 610.60, Vulkan API 1.4.341 as the device reports it, MinGW GCC (WinLibs), Ninja, Release,BUILD_TESTING=ON. Both tests ran underctestwithANYPS5_NO_SHADER_CACHE=1. The device reportstessellationAvailable=1and has geometry shaders, so the test runs both routes.agc_driver_pixel_barycentric_emulation: passed 3 of 3 runs (0.46 to 0.97 s). Each run prints both routes:agc_driver_graphics: passed 3 of 3 runs (6.9 to 9.0 s).So on NVIDIA the tessellation route gives the same pixels as the geometry route, including the flat inputs from the last provoking vertex.
AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-18T06:01:18Z.
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)core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cppL117-118docs/dev/debt/libSceAgcDriver.mdL134core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cppL117-118docs/dev/debt/libSceAgcDriver.mdL134docs/dev/debt/shader.mdL99-101docs/dev/debt/shader.mdL98-99core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cppL114docs/dev/debt/libSceAgcDriver.mdL134Some 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/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/shader.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/shader.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cppcore/shader/recompiler/Recompiler.hppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/shader/recompiler/Recompiler.hppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/shader.mddocs/dev/debt/shader.mddocs/dev/debt/shader.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cppcore/shader/recompiler/Recompiler.hppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/shader/recompiler/Recompiler.hppdocs/dev/debt/shader.mdcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/shader.mddocs/dev/debt/libSceAgcDriver.mdcore/shader/recompiler/Recompiler.hppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/shader.mdcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/shader.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cppcore/shader/recompiler/Recompiler.hppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/shader.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/shader/recompiler/Recompiler.hppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/shader.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/shader/recompiler/Recompiler.hppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/shader/recompiler/Recompiler.hppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/shader/recompiler/Recompiler.hppdocs/dev/debt/shader.mddocs/dev/debt/shader.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cppcore/shader/recompiler/Recompiler.hppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cppcore/shader/recompiler/Recompiler.hppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/shader.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cppcore/shader/recompiler/Recompiler.hppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cppdocs/dev/debt/shader.mdcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/shader/recompiler/Recompiler.hppdocs/dev/debt/shader.mddocs/dev/debt/libSceAgcDriver.mdcore/shader/recompiler/Recompiler.hppdocs/dev/debt/shader.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cppcore/shader/recompiler/Recompiler.hppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/shader.mdcore/shader/recompiler/Recompiler.hppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/shader.mdcore/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cppcore/shader/recompiler/Recompiler.hppdocs/dev/debt/shader.mddocs/dev/debt/libSceAgcDriver.mdcore/shader/recompiler/Recompiler.hppdocs/dev/debt/shader.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/shader.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/shader/recompiler/Recompiler.hppdocs/dev/debt/shader.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/shader/recompiler/Recompiler.hppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/shader.mddocs/dev/debt/libSceAgcDriver.mdcore/shader/recompiler/Recompiler.hppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/shader/recompiler/Recompiler.hppcore/shader/recompiler/Recompiler.hppdocs/dev/debt/shader.mddocs/dev/debt/shader.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/shader/recompiler/Recompiler.hppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/shader.mdImported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-18T10:19:51Z.
Rebase handoff — rebased onto current
main(the full 36-commit series, authorship unchanged). One conflict inBarycentricGeometryShader.cpp:main's newer evaluation-output access-chain form kept, with yourprovokingVertexsubstitution for flat values layered onto it (the PR's olderglIn/glOutindexing superseded).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 knownmainregression (agc_driver_tessellationsegfault — Mesa, #5444), not this PR — the provoking-vertex tests pass.To pick it up:
Head is
b0cf7e91c.Imported from boykopovar/AnyPS5. Originally posted by savvaniss on 2026-10-19T06:35:50Z.
Intel and AMD Windows data: with this PR the 19 tests built from
tests/Graphics.cppandPixelBarycentricEmulation.cpppass 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 head8f4a50d72merged intomain07377573f.The test files don't build on
mainwithout the rest of the PR, so there is no before-run.I also ran full CTest with this PR and the 13 other open AGC and shader PRs I tested in the same batch merged together (#7668, #7659, #7504, #7432, #7413, #7480, #7465, #7466, #7464, #7449, #7489, #7673, #7560). Neither GPU showed a failure beyond
main's own: the five image-table tests (#6647) andagc_driver_sample_multisample_target(#6957) on the UHD 770, andagc_driver_layered_volume_vertex_no_gpl(#4768) on the RX 9070 XT.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by DavidAmsellem on 2026-10-19T18:23:51Z.
First AMD-on-Linux (RADV) run of this PR. Merged onto
main8d5d4df96(clean merge), built in full and compared with the samemain, on the same machine.AMD Radeon RX 7900 XT (RADV NAVI31, gfx1100), Mesa 25.2.8, Linux Mint 22.3 (Ubuntu 24.04 base), kernel 7.0.0-38, GCC 13.3, Release.
Full suite (
ANYPS5_REQUIRE_VULKAN=1 ctest -j8) atb4532dacd: 1638/1640 with this PR, against 1638/1640 onmain. The two failures are the same on both, so this PR adds none:agc_driver_image_table_vouched_lookups(#7766, fixed by #7916) andagc_driver_guest_memory_lifetime(#7784).Comparing the JUnit output with
main: this PR adds no ctest entry, and none is skipped or removed.This checks correctness only; I did not measure performance.
GPUs tested: AMD Radeon RX 7900 XT (RADV NAVI31, gfx1100), Mesa 25.2.8, Linux Mint 22.3 / kernel 7.0.0-38
AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by DavidSamir on 2026-10-19T19:10:14Z.
Title evidence for #6741 and #7426 together, from a macOS catalog sweep: Apple M2, MoltenVK 1.4.x (no
VK_EXT_provoking_vertex, no geometry shaders), Rosetta 2, onmain00d7e611efwith @mugurc'sci/macos-series-2and #7937 (so libkernel builds on macOS). 30 s per title, same build apart from the two PRs.On that base, 12 catalog titles stop at
AGC graphics: last provoking vertex requires VK_EXT_provoking_vertex with provokingVertexLast enabled. Results:So on a device without the extension these titles need both changes: #6741 for their last-vertex draws whose pixel shader cannot see which vertex provokes, and #7426 for the ones whose pixel shader reads emulated barycentrics through the generated tessellation stages. Either alone still stops at the same check. Nothing past 30 s is tested; MoltenVK-specific limits (#6235, #6528) are not in the way of these 11.
The two PRs touch the same function (
ValidateProvokingVertex); merged together, the #7426 block for barycentric patches goes first and #6741's check of whether a pixel input reads the provoking vertex follows, with no other change.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by DavidSamir on 2026-10-19T21:11:27Z.
Validation-layer comparison, as AGENTS.md now asks for AGC changes. Apple M2, MoltenVK 1.4.x (Vulkan SDK 1.4.363), macOS 26, x86-64 under Rosetta 2, same machine and build directory, on
mainwith @mugurc'sci/macos-series-2and #7937 (needed for libkernel on macOS). Each test run withANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation; the loader reports loadinglibVkLayer_khronos_validation.dylib, and no log containswas not found but was requested by env var VK_INSTANCE_LAYERS.agc_driver_pixel_barycentric_emulationVUID-VUID-agc_driver_graphicsVUID-VUID-agc_driver_provoking_vertexrequired provoking vertex rendering coverage is unavailable: provokingVertexLast is not supportedVK_EXT_provoking_vertex; withoutANYPS5_REQUIRE_VULKANit skips)No new validation errors with the two changes. The title results for the pair are in the comment above (11 catalog titles run past the provoking-vertex stop with both).
AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by DavidSamir on 2026-10-19T22:44:43Z.
Validation-layer comparison as AGENTS.md describes:
maine5b65a911againstmainplus head573d85e2b8. Linux, WSL2 Ubuntu 24.04, lavapipe (llvmpipe, LLVM 20.1.2, Mesa 25.2.8), Khronos validation layer 1.3.275. Environment:VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,ANYPS5_NO_SHADER_CACHE=1,ANYPS5_REQUIRE_VULKAN=1. Command:ctest -R "agc_driver_pixel_barycentric_emulation|agc_driver_graphics|agc_driver_provoking_vertex" -V.was not found but was requested by env var VK_INSTANCE_LAYERS.VUID-errors. Both logs carry the same set, already present onmain: 66VUID-VkGraphicsPipelineCreateInfo-pLibraries-06681and 6VUID-VkDeviceCreateInfo-pNext-pNext.agc_driver_provoking_vertexexercises first, last and first again on lavapipe, which hasprovokingVertexLast, so the native path is the one compared here.Not covered: an NVIDIA run with the validation layer. This machine's RTX 3070 has no Khronos layer installed.
AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by DavidSamir on 2026-10-19T23:37:43Z.
No-regression run on a GPU with
VK_EXT_provoking_vertex:main567c5fd630againstmainplus head573d85e2b8. Windows 11 Pro 26300, NVIDIA RTX 3070 (driver 610.60), WinLibs GCC 15.2.0, Release. Catalog releases with sha256 checked, 60 s each.The nine titles listed for the Mac all run the full 60 s on both builds: SymphonyStation5 (PPSA17641), VITA5 (PPSA39410), Signal Companion (PPSA69426), PokeMMO (PPSA98001), ProsperoLight (PPSA99002), PS5LM (PPSA99575), Cloud Play (PPSA99600), PShare (PPSA99773) and Pulse (PPSA99993). None stops early.
This device takes the extension's native path, so this run checks only that nothing regresses. The emulated path is covered by the Mac runs in the description.
AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-21T11:09:11Z.
Re-checked against current
main: same patch, clean merge, every caller ofBuildBarycentricTessellationShaderspasses the provoking vertex. The validation exemption stays limited to the generated tessellation route (guest tessellation and the geometry route still requireVK_EXT_provoking_vertex), flat per-vertex parameters still throw, and the execution test pins the flat value per vertex (-0.8 first, -0.25 last). Debt entries match the code; merged.