fix(agc): create tessellation pipelines without the pipeline cache on MoltenVK #10046
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10046"
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 jotitadev on 2026-10-23T06:08:45Z.
What
On MoltenVK,
agc_driver_tessellation's merged hull cases draw nothing (#10045). MoltenVK pads the domain stage's input struct to the per-vertex outputs of the hull it is linked with. The shader cache inside aVkPipelineCachematches a cached conversion when the new configuration has the inputs that conversion used, so the domain shader converted next to a 16-byte hull is reused next to the merged hull. The merged hull'sControlSharedrecord adds a second per-vertex output, so the domain stage reads its control points at 16 bytes over a 48-byte buffer.This PR creates tessellation pipelines without the pipeline cache when the driver is MoltenVK. Each tessellation pipeline then gets a conversion for its own interface. Tessellation pipelines also skip the graphics pipeline library path while the cache is off (
libraryKeysinPipeline.cpp), so the parts, the link and the optimized relink inPipelineLibrary.cppnever seecontext.pipelineCachefor them. MoltenVK does not exposeVK_EXT_graphics_pipeline_library(not listed byvulkaninfowith MoltenVK 1.4.2 or MoltenVK main), so the guard does not change what runs on Apple today; it keeps the rule if that changes.TessellationPipelineCacheUsable(VkDriverId)followsFragmentShaderBarycentricUsableandSubgroupControlBarrierUsable, with a unit test for its driver table.agc_driver_graphicschecks with the mock device that a tessellation pipeline is prebuilt from graphics pipeline libraries when the cache is shared and is not when it is off. Other drivers and other pipelines keep the cache.Tested
Apple M2 Max (32 GB), macOS 27.2, x86_64 build under Rosetta, Release.
maindoes not build on macOS yet, so I applied this diff to #8658 (feat/macos-port) @46673ede9e, which hasmain0db47b263dmerged.ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1,ctest -j1 --timeout 30.agc_driver_tessellation, with every case run: both merged hull cases fail before and pass after. The only case left failing isRequireInstancedRelativePatches, which fails before and after (see #10045).4e0468722f). That confirms the order dependence.ctest -R "^agc" -E "agc_display_buffer_dcc|agc_driver_flip|agc_driver_lds_atomics64", 898 tests before and 899 after: the same 22 failures with MoltenVK 1.4.2 and the same 21 with MoltenVK main + SPIRV-Cross #2704, before and after.agc_driver_tessellationis in both lists: before it stops at the merged hull, after atRequireInstancedRelativePatches. The other failures are unrelated to tessellation and fail the same way on the base.agc_tessellation_pipeline_cacheandagc_driver_graphicspass.agc_driver_graphics(mock device,tessellationPipelineLibraryCacheTests): fails without thelibraryKeyschange with "tessellation pipelines without the pipeline cache were built from graphics pipeline libraries" and passes with it. The shared-cache case passes in both, so the test reaches the library path.tools/check_conventions.py --base origin/mainpasses.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)maindoes not build on macOS)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-23T06:11:21Z.
Review: CHANGES_REQUESTED
Reviewed exact head
8404eb5f14134d0184f810fe3ddbf36fb90421a2. Blocking gap: the newpipelineCachelocal is used only inPipeline.cpp’s non-library creation calls. Whenlibrariesis true, this code callsLinkPipelineFromLibraries, whose pre-rasterization library creation and final link inGraphics/src/PipelineLibrary.cppstill passcontext.pipelineCachedirectly (around lines 234 and 281); optimized relinking also captures that cache (around line 290). Thus any device using the graphics pipeline library path still has tessellation shader conversions in the same VkPipelineCache, despitetessellationPipelineCache == false. Please thread the per-pipeline cache choice through the library parts/link/relink paths, or disable the affected GPL path for MoltenVK, and add coverage for the path that reproduces #10045. The standalone driver-table test, diff check, and conventions pass locally;check_main_sync.pyreports a clean merge but notesCMakeLists.txtalso changed in #6946. Hosted product builds are skipped by path policy. This request is for a code path that bypasses the stated fix, not repository intake.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-23T06:13:22Z.
Review: CHANGES_REQUESTED
Thanks, the diagnosis in #10045 is clear. One gap, the same one MarcZX10 raised:
Pipeline.cpp:215(libraryKeys) does not exclude tessellation, so whencontext.graphicsPipelineLibraryis on,LinkPipelineFromLibrariesis used and its pre-rasterization library creation (PipelineLibrary.cpp:234), final link (:281) and optimized relink (:291) still passcontext.pipelineCache. The new toggle only reaches the non-library calls. Please make tessellation pipelines skip the library path when!context.tessellationPipelineCache(or pass the null cache through those three places), so the rule holds whatever extensions the device exposes. If MoltenVK can never expose graphics pipeline libraries, say so in the PR and keep the guard anyway.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-23T11:51:03Z.
Review: APPROVED
Reviewed the updated head
0e38bdc3d02f0d72f0c39451fc3f74af4d8d7289. The fix now covers both pipeline creation paths: tessellation pipelines for drivers that cannot safely share the cache bypass graphics pipeline libraries, and direct creation usesVK_NULL_HANDLEfor their cache. The new mock test exercises the shared-cache and no-cache library-selection cases, including the failure mode when the guard is absent. The author reports the merged-hull regression passing on MoltenVK before/after, with unrelated failures unchanged; hosted conventions, eligibility, labels and report checks pass. Product/relinker checks are skipped by path policy, so I am relying on the reported focused Apple/MoltenVK runs for the driver-specific behavior.