Recompiler: a pixel shader of LEGO Batman: Legacy of the Dark Knight (PPSA16833) binds more than 16 samplers and is refused ("shader sampler pairs exceed runtime heap capacity"), so a new game aborts; fix branch ready #6692
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 Tamalero on 2026-10-16T05:03:22Z.
When a new game starts, LEGO Batman: Legacy of the Dark Knight compiles a pixel shader that binds more than 16 samplers directly (outside the sampler tables). The recompiler refuses it and the title aborts:
The check is in
BindingAllocator. Each sampler takes two heap entries, one per descriptor variant.RuntimeAbi::SamplerHeapCapacityis 32 entries, so at most 16 samplers fit. #1789 raised the sampled image heap for a similar Unreal shader, but the sampler heap kept its size.Title: LEGO Batman: Legacy of the Dark Knight (PPSA16833 v01.010.000)
Where it stops: choosing New Game, while the first level loads, on
main5d9dcc42dplus the two changes that get it to the menu (#6688 and the #6447 Terms of Service change). Linux, RTX 4090. 1 of 1 run. The build also carried the #6564 input change, which doesn't touch shaders.Fix
Branch: https://github.com/Tamalero/AnyPS5/tree/fix/shader-sampler-heap-32-samplers (one commit on
5d9dcc42d).SamplerHeapCapacitygoes from 32 to 64 entries, so up to 32 samplers fit.ShaderData, soShaderDatagrows from 14528 to 16064 bytes (export mappings move from dword 3624 to 4008). That still fits the 16 KiB uniform buffer range every Vulkan device supports. The two layout asserts are updated.RuntimeAbi::Versiongoes from 12 to 13. The shader cache keys include it, so shaders cached with the old layout are rebuilt instead of reused.agc_shader_device_profilechecks that 20 and 32 samplers allocate (40 and 64 entries). WithRuntimeAbi.hppandBindingAllocator.cppfrommainand the new test, it fails with "shader sampler pairs exceed runtime heap capacity" (negative check).The driver's existing per-device clamp still applies (
maxPerStageDescriptorSamplersandmaxDescriptorSetSamplersinShaderResources.cpp), so a device with a lower limit is still capped there.Result on the title
main+ the two menu changesThe title run used a local build with the same capacity and layout changes as the branch, but without the version bump and the test, which came later; I used a separate, empty shader cache for it instead. I don't know the exact sampler count of
0x1325230000, because it fits now. It's more than 16 and at most 32.Details
BUILD_TESTING=ON, RTX 4090, i9-14900K. The title was relinked with--to-intelby the relinker at5d9dcc42d.ctest -R "agc_|shader|recompiler|spirv" -j 12: 601 of 604 pass.agc_driver_flip_stores_small_resultsandagc_driver_store_idle_resultsfailed under load, and pass 3 of 3 alone.agc_driver_store_over_untrackedfails 3 of 3 on this branch and also 3 of 3 onmain5d9dcc42d(Linux), so it predates this change; #6347 reports it on Windows.tools/check_conventions.py --base origin/mainpasses.Tested and written by Claude (AI assistant) on a contributor's machine.
Video of map loading and gameplay:
o7ZJNCox84E
H4Ez64cP0_8
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-16T05:12:15Z.
I opened PR #6699 carrying your commit unchanged and preserving its author metadata. Intake, eligibility, conventions and progress-report checks pass. The local GCC 12 build was blocked in unchanged
SrtDescriptorEvaluation.cppbefore the focused CTest could run; the test and LEGO Batman gameplay results in the PR description are your reported GCC 15/RTX 4090 results.