fix(agc): retain used descriptor sets in pipeline libraries #4456
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4456"
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 Mouhand-Kaddo on 2026-10-12T12:17:27Z.
What
Demon's Souls (PPSA01342) needs correct graphics-pipeline-library descriptor layouts while testing its image-table support. Split libraries currently assume pre-rasterization uses set 0 and fragment uses set 1, but ordinary fragment shaders can use set 0. Derive each part's used-set mask from its compiled bindings, retain exactly those native layouts, and include the selected layouts in its cache key. Invalid sets throw before shifting.
The original Linux investigation baseline
ffa198407e70296c50d0011a4157a430408dd00estopped earlier on a captured title shader:That prerequisite is covered by #757/#758, not this PR. After applying their table support, the native image-table test stopped at:
The used-set correction passes that RADV test and has a standalone regression on current main.
Original overlap checks: #4363 fixes depth/stencil/view-mask state; #4445 fixes shader-module lifetime and is now merged and included in this branch's base. They touch the same linker for different behavior. Pairwise
git merge-tree --write-treechecks against both heads are clean. Neither implements this descriptor-layout correction.Tested
Windows review follow-up: rebased onto public
main27873b0f7(includes #4445). Windows 11, WinLibs GCC 15.2.0 r7, Release, SPIRV-Tools enabled, RX 6900 XT / AMD driver 32.0.21045.5002.agc_driver_graphicsreproducesshader library tests leaked Vulkan objectsafter the rebase.mockDestroyShaderModulenow ignoresVK_NULL_HANDLE, matching Vulkan destruction semantics for the moved-from modules.--repeat until-fail:3 --timeout 30(18 executions, no CTest skips). Default native pipeline-library linking passes with link-time optimization enabled. The explicit off and fast-only variants also pass. The graphics check takes about 5.5 seconds per run.main,agc_driver_graphicsstill fails withshader library lost a used set or retained an unused set. The mock correction does not weaken the descriptor-layout regression.libsruntime targets. Conventions andgit diff --checkpass.GetImageResource dword 0 is not a valid runtime value, matching the earlier image-resource investigation above. No menu or frame capture was verified within 600 seconds; the debugger showed the main thread inAwaitRegisteredPreparation. The test process was stopped at the limit. Gameplay remains unverified.Linux, RX 6900 XT, RADV. Built the explicit test targets.
agc_driver_graphicsfails:AGC graphics: shader library lost a used set or retained an unused set.agc_driver_graphics,agc_descriptor_pool_reset_failure,agc_compute_descriptor_layout_flags,agc_pipeline_library,agc_pipeline_library_off,agc_pipeline_library_fast_only. The regression exercises both shader parts with masks 0/1/2/3, native layout handles, push-constant slots, cache invalidation/reuse, and invalid set 32.git diff --checkandpython3 tools/check_conventions.py --base HEAD^pass.Separate integration result, not this PR alone: Demon's Souls reached the main menu (New Game/Settings visible and user-confirmed interaction) on
c36fd0a0plus #757/#758/#4288/#3991/#4402, this fix, and a local split-descriptor-load correction. New Game then produced a black screen. Gameplay beyond the menu is unverified.That title run temporarily used Linux
udmabufsize_limit_mb=2048instead of 64 because larger GPU imports were rejected at the default limit. The user restored 64 afterward and it was read back. The focused PR checks ran after restoration. Game assets were read directly through an enforced read-only view of the Windows gaming drive, without copying the game or changing its inputs.Checklist
main; no duplicate of this descriptor-layout correction found. Same-linker changes in #4363/#4445 are disclosed above.NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt. No new stubs..mdfiles or images added to the repositoryImported from boykopovar/AnyPS5. Originally posted by kr4y4 on 2026-10-12T18:39:48Z.
Windows run on current
main, which now has #4445.Setup: Windows 11 (26200), WinLibs GCC 15.2.0 r7, Release, CI configure flags, an RTX 4070 Laptop GPU and an Intel Raptor Lake-S iGPU. The head cace9368c merged into
main2a5eca11c, with no conflicts.agc_pipeline_library,agc_pipeline_library_off,agc_pipeline_library_fast_only,agc_descriptor_pool_reset_failureandagc_compute_descriptor_layout_flagspass on both GPUs with--repeat until-fail:3.agc_driver_graphicsfails on both GPUs in every run withshader library tests leaked Vulkan objects.mock.liveends at -4.8fa5cc486. Since then, a prebuild hands its shader modules to the library and callsvkDestroyShaderModuleon the moved-fromVK_NULL_HANDLE, andClearPipelineLibrariesdestroys the kept modules later.mockDestroyShaderModulealso counts the null destroy, so each kept module is counted down twice. In the first pass (mask 0), where the test stops, four modules are kept by the clear, which gives -4. A trace of the mock's handles shows the null destroys and the four destroys at the clear.mockDestroyShaderModuleskipping it (if (module != VK_NULL_HANDLE) --mock.live;),agc_driver_graphicspasses on both GPUs with--repeat until-fail:3.main'sPipeline.cpp,PipelineLibrary.cppandPipelineLibrary.hpp, it fails on both GPUs withshader library lost a used set or retained an unused set. So the regression still catches the bug.ctest --timeout 120 --parallel 4): the only failures areagc_driver_graphicsabove and, on the iGPU,agc_driver_f32_dot2_rounding, which fails the same way onmain(noshaderFloat64, #4528).Written with AI assistance.
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-12T20:34:34Z.
The full build fails
agc_driver_graphicson Linux and on Windows with this merged onto main:AGC graphics: shader library tests leaked Vulkan objects(https://github.com/boykopovar/AnyPS5/actions/runs/38276879354). kr4y4's run above explains it: since #4445 a prebuild destroys the moved-fromVK_NULL_HANDLEmodule andmockDestroyShaderModulecounts that too, somock.liveends at -4. Please rebase over #4445 and make the mock skip the null handle; I'll rebuild after that.Imported from boykopovar/AnyPS5. Originally posted by Mouhand-Kaddo on 2026-10-12T21:25:22Z.
@oneandonlydean Done. Rebased over #4445 and updated the mock to ignore
VK_NULL_HANDLE, as requested.