fix(shader): match barycentric tessellation clip interfaces #7330
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/7330"
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 MarcZX10 on 2026-10-18T00:38:29Z.
What
Fixes #7328. Keep the generated tessellation control and evaluation Position blocks aligned with the vertex shader's Position-only block. Pass ClipDistance separately as a BuiltIn array through the generated stages, preserving the vertex clip values, and update the regression to assert that separate interface representation.
Tested
Linux, GCC 12.2:
agc_driver_graphics_testsand the shader recompiler built successfully. The build required a temporary, revertedtemplatedisambiguator in an unrelated upstream source file because GCC 12 could not compile it as checked out. The test executable could not run on this host: its CPU guard rejects the Xeon E5-1620 v2 for missing AVX2, BMI1/2, LZCNT, MOVBE, and FMA. No GPU runtime validation was run here.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 milescoviello on 2026-10-18T00:47:39Z.
I ran this on a machine that can: Ubuntu 24.04, GCC 13.3, Release, RTX 4070 Ti (NVIDIA 595.99.02), head
06379ceac7onmainf1af6c5915.agc_driver_graphicsandagc_driver_pixel_barycentric_emulationboth fail, 3 of 3, in the recompiler's SPIR-V validation:The barycentric emulation test fails the same way with
float_uint_1(the vertex shader there has one clip distance). Indexing the per-vertexgl_ClipDistancevariable (an array of 3float[N]) with one vertex index gives afloat[N], so that access chain's result type must be a pointer tofloat[N](ptrInputClip), not to the whole array of arrays. TheptrOutputClipaccess into the control stage's arrayed output needs the same.For reference, with the separate variables built that way (per-vertex
float[N]arrays of 3 in and out of the control stage; an array of 3 in and afloat[N]out of the evaluation stage), both tests pass 3 of 3 here, and the layer (1.3.275) reports noVUID-RuntimeSpirv-OpVariable-08746foragc_driver_pixel_barycentric_emulation(5 onmain). I'm leaving the barycentric stages to this PR.The rect-list stages have the same block mismatch since #7124 (2
08746errors inagc_driver_rect_list_indirectonmain). I opened #7334 for those; it changes onlyRectListShaders.cppand arectListTestscase, and merges cleanly with this PR.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by Amoenus on 2026-10-18T00:49:55Z.
Thanks for picking up #7328. I ran your exact
06379ceac760effb19b113b4746df98daf8fce56on both physical GPUs. The full Windows relinker/libs and selected fixtures build, butagc_driver_pixel_barycentric_emulationfails before tessellation pipeline creation on RTX5080 (0.48s) and AMD Radeon Graphics (0.29s):A three-line correction be22d2fc8 is directly on your exact head, preserving your implementation. The control-stage output variable needs the outer3-control-point array; after an access chain selects one control point, both input result pointers need the inner clip-array type. No fixture change is needed for this correction.
Corrected composition: full Release relinker/libs, graphics and pixel fixtures build on Windows11 Enterprise26200 / GCC15.2r7 and Ubuntu24.04 WSL2 / GCC13.3. Pixel test passes3/3 on each verified RTX5080 (10de:2c02,610.62/32.0.16.1062), AMD Radeon Graphics (1002:13c0,32.0.21036.18), and llvmpipe LLVM20.1.2/Mesa25.2.8. All9 processes exercise both geometry and tessellation paths:932 perspective plus932 linear I/J pixels per path, raw vertex values, host interpolation and face culling. Windows Khronos1.4.363 is confirmed loaded with no observed VUID/validation errors; Linux has no layer. CPU graphics also passes3/3 on each OS:15 passing processes total, no skips/timeouts. Every selected test finishes below30s.
Vulkan required; shader cache/pipeline journal disabled, driver caches uncontrolled; existing SPIRV-Tools build option OFF. Cppcheck2.20 then clang-tidy23.1.3 on the changed TU:3.011s, no selected diagnostics or parser failure. Conventions/diff checks pass. No title-unblock or performance claim. The preceding cross-platform results describe be22, not the original06379 head. Update: the author incorporated the corrections in
ba9aec51194b8b4a4ea0e89e6b5a7b31451fa8eb; its complete tree exactly matches be22. I also checked out and built that exact published head on Windows (full relinker/libs plus both fixtures), then reran CPU graphics3/3 and the pixel test3/3 on each physical GPU:9 passing processes, no skips/timeouts, both generated-stage paths exercised, Khronos1.4.363 loaded for all6 GPU processes with no VUIDs or validation warnings/errors. Linux results above remain explicitly the identical-tree be22 run. No duplicate PR was opened.AI-assisted investigation and correction: Codex; author responsible.
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-18T00:57:18Z.
Thanks for this. #7328's diagnosis is right, and moving ClipDistance out of the Position block is the correct shape. At
06379ceac, though, bothagc_driver_graphicsandagc_driver_pixel_barycentric_emulationfail SPIR-V validation before reaching the pipeline:Three types in
BarycentricGeometryShader.cppneed changing:ptrControlInputClipshould point toclipArrayType, notcontrolInputClipType. The access chain indexes one vertex, so its result isfloat[N].ptrEvaluationInputClip: the same change.clipOut = addInterface(spv::StorageClassOutput, controlInputClipType);. It is indexed by the invocation id.With these three changes, both tests pass on an RTX 4090 with the Khronos validation layer on. Both the geometry and the tessellation arms run, and no VUID-RuntimeSpirv-OpVariable-08746 is reported. Without your emitter change, the same run reports the 5 errors from #7328.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-18T01:02:12Z.
I've updated the PR head to
ba9aec511, incorporating the three SPIR-V type corrections identified in review: the control-stage output carries the outer per-vertex array, and the access-chain result pointers use the inner clip-distance array.\n\nThe corrected composition was independently built and exercised on Windows and Ubuntu 24.04/WSL2. The pixel barycentric test passed 3/3 on RTX 5080, AMD Radeon Graphics, and llvmpipe; the report says both generated-stage paths ran and Windows validation emitted no observed VUIDs. I haven't run that GPU matrix locally.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-18T01:10:28Z.
Some 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/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/shader/recompiler/SpirvBackend/src/BarycentricGeometryShader.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppImported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-18T05:07:15Z.
Thanks for identifying the access-chain result types and the per-control-point output shape. Amoenus's three-line correction is now incorporated in the current head (
ba9aec511), and the reported pixel-barycentric and graphics validation passes are recorded in the follow-up. I reviewed the current tree against your points; no further change is needed on this thread.