feat(agc): support last provoking vertex for native primitives #2322
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2322"
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 jweidenh on 2026-10-09T15:28:42Z.
What
PA_SU_SC_MODE_CNTL.PROVOKING_VTX_LAST(bit 19) previously rejected a draw. This change decodes it as first/last provoking vertex and usesVK_EXT_provoking_vertexfor native primitive pipelines, including flat P0 inputs already emitted as SPIR-VFlat. Keep first-vertex mode usable without the extension. Include the mode in the pipeline cache key and split render-pass instances when the device cannot mix modes within one pass.This addresses the raster-state rejection reported in #2026, with
PA_SU_SC_MODE_CNTL = 0x00080244. Another contributor reported that execution; I have not run the showcase. Bit 19 follows opengnm'sflatshade_firstmapping at db752da. Pipeline state and pass separation follow Khronos's provoking-vertex requirements.The merged implementation rejects last mode when the device feature is unavailable, for rectangle lists, decoded geometry/mesh/tessellation paths or unsupported topologies, for explicit per-vertex flat inputs, and for triangle strips with any explicit per-vertex inputs. The latter need a verified mapping for device-dependent barycentric vertex ordering. These limitations and the absence of console measurements are recorded in TechnicalDebt. No shader instruction lowering changes.
A separate integration gap remains: #1547 inserts a geometry stage for barycentric emulation while leaving the decoded path as Vertex. The merged guard does not inspect that inserted stage, so it does not reject every generated-geometry pipeline. Last mode on that fallback remains unverified; the follow-up described below adds explicit rejection.
Tested
The maintainer rebased this PR to
03cb1147792090a37c03a7e25307af7f49201381and merged it on October 10, 2026, at 06:36:55 UTC as d43d50be. The maintainer reported both graphics and provoking-vertex tests passing on the rebased head. Our local results below apply to explicitly identified revisions.Tested revision
3f5691adfd248044ec420db5102ed9c8c6c23051was based onmain691c0c3b35da50d3ef5a75231b9b0bd5d4e4388d. The raster-mask conflict retains upstream #1915's conditionallineOffsetacceptance and this PR's bit-19 exclusion. Its point/line rejection assertion remains; the expected message now readspolygon mode, depth bias or nonstandard rasterization. The provoking-vertex rendering test and shader fixtures are unchanged.Private validation run
38028219729validated3f5691adon a locally managed self-hosted Ubuntu 24.04 x86-64 runner (GCC 13.3.0, CMake 3.28.3, Mesa 25.2.8 lavapipe/LLVM 20.1.2): Release,BUILD_TESTING=ON,ANYPS5_ENABLE_SPIRV_TOOLS=ON, explicit lavapipe ICD, Xvfb, fresh shader cache, andANYPS5_REQUIRE_VULKAN=1. Its logs are not publicly accessible.libstarget passed.agc_driver_graphics: 7.3733 s;agc_driver_provoking_vertex: 0.093926 s (7.40 s total). Both used 30-second limits. Graphics reported its heap-mirror branches untested because the guest arena was unavailable or not write-watched; the provoking-vertex rendering fixture passed. The full suite was not rerun for this rebase.git diff --checkpassed.Validated follow-up, not merged:
Guard patch
6bf6e3bf, on a separate validation branch based on0aaadd6457c3f413563ba8f27171baa433627ff3, adds a compiled-stage Geometry check. Its regression uses the actual barycentric-emulation geometry fixture: first mode remains accepted without the provoking-vertex feature, and last mode rejects even when the feature is available. This guard is not included in merged head03cb1147or merged43d50be.Private self-hosted run
38031414843, workflow1ff7598f2904f828a9fd132436e6dde03d877b0f, passed for candidate6bf6e3bfe7aa74b616eba5239897a2c8d508971don Ubuntu 24.04, GCC 13.3, CMake 3.28.3 and Mesa 25.2.8 lavapipe/LLVM 20.1.2:These results apply to the separate candidate, not to merged head
03cb1147. The private workflow artifacts require repository access; the linked patch is public.Earlier validation and limitations:
On
dda8a724, based onmaind70b8998, a full Release build and patchedlibstarget succeeded on Ubuntu 24.04 x86-64 with GCC 13.3, CMake 3.28.3, and Mesa 25.2.8 lavapipe. CTest reported 490 passed, 26 capability skips, one baseline timeout, out of 517 tests.agc_driver_graphicspassed in 3.84 s: register decode/reset, existing flat P0 lowering, unsupported-path rejection, and production render-pass keys for bothprovokingVertexModePerPipelinevalues.agc_driver_provoking_vertexpassed in 0.034 s: exact triangle-list and triangle-strip pixel colors, first/last/first, with both reference GLSL and an actual recompiled guestv_interp_mov P0fragment shader. Stable shader variants exercise pipeline-cache separation. Render-pass continuation identity is tested on the CPU; rendering uses synchronous linear targets.agc_driver_flat_storetimed out at 30.05 s waiting on a GPU fence. It independently reproduced on unmodifiedmaind70b8998with the same toolchain and Vulkan settings (30.07 s). This remains a recorded failure; no timeout increase or exclusion was used.Independent Windows validation reported by popcoder565 passed
agc_driver_provoking_vertexandagc_driver_graphicson Windows 10, RTX 3060 Laptop, NVIDIA 616.92, and MinGW-w64 GCC 15.2.0. That useddda8a724merged ontomainf8c2f072alongside nine other PRs. The combined suite was 512/513; the reporter attributes its sole failure,agc_driver_depth_fast_clear_submit, to #2325 and reports it also fails intermittently alone. This was a combined build; no title was run.Local validation uses Linux/lavapipe. No title execution, PS5 hardware measurement, or local Windows runtime test was performed.
Checklist
main; maintainer-rebased head03cb1147merged asd43d50beImported from boykopovar/AnyPS5. Originally posted by Kikoarl on 2026-10-09T18:29:44Z.
Tested on Linux (CachyOS x86_64, Intel RPL-S iGPU / Mesa 26.3.0-devel / Vulkan 1.4.363, GCC 16.2.1) at
dda8a724:/tmp/anyps5_build) with zero warnings/errors.python3 tools/check_conventions.py --base origin/main --head HEAD-> PASS (0 errors).VulkanDevice.cppand graphics pipeline. Required for correct flat shading across Vulkan drivers.LGTM!
Imported from boykopovar/AnyPS5. Originally posted by popcoder565 on 2026-10-09T19:03:52Z.
Native Windows run, since no Windows results were posted. Setup: Windows 10 (19045), RTX 3060 Laptop (NVIDIA 616.92), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release. Head
dda8a724, merged ontomainf8c2f072in one build with 9 other PRs that had no Windows run.agc_driver_provoking_vertex,agc_driver_graphics.agc_driver_depth_fast_clear_submitfrom #2325, which fails intermittently on its own too. The test comes from #425, where I reported it.No title was run.
🤖 Addressed by Claude Code
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-10T05:18:41Z.
The new head conflicts with main in
State.cpp; please rebase.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T06:32:28Z.
Rebased onto current
main(conflicts only inlibSceAgcDriver/CMakeLists.txtanddocs/dev/TechnicalDebt.md, both kept) and moved the validation text under### Testedso the conventions check finds it. No code changes.Checked
agc_driver_graphicsandagc_driver_provoking_vertexon the rebased head (Linux, lavapipe); both pass. Merging once the full Build workflow is green.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-10T06:34:47Z.
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/TechnicalDebt.mdL341-342