feat(recompiler): bindless image tables up to the device's sampled-image limit #1184
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1184"
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 MichonGoddijn231849 on 2026-10-07T16:44:43Z.
What
A whole-table bindless image table binds its entries as one descriptor array, sized by the table (the next power of two, at least
APS5_BINDLESS_SLOTS) up to the device's per-stage sampled-image limit, at most 65536. Before, tables wider than 48 slots were refused. The key indexes the array directly. GTA V's fidelity mode reads a 65536-entry T# heap from a compute pass.(key * 32) & mask, with a contiguous mask keeping at least 16 key bits, matches likekey * 32.SetBindlessTableLimitis reviewed for the shader disk cache key (it reaches the key through the specialization's table slots). The disk cache format version is 8.tests/ShaderMemory.cppcovers the table planning cases.Tested
Windows 11 Pro, AMD Ryzen 5 7600, NVIDIA GeForce RTX 5080 (driver 32.0.16.1074), 32 GB, MinGW-w64 GCC 15.2.0.
gta-v/testingbranch (Performance mode, the prologue).ctestpasses. Not run here: the relinker's Python tests (my local Python does not find their helper modules) andguest_gameupdate.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by fisherjoey on 2026-10-08T08:41:47Z.
Test result: Demon's Souls on Linux/NVIDIA. Direct-index tables work; the material-selected table in this title still runs out of slots
Setup: Nobara 44 x86-64, RTX 5070 Ti, NVIDIA 595.91.07. Demon's Souls (PPSA01341 v1.07). Base is upstream main
df16c4c2plus #861, #864, #157, #1202 and our local fixes. This PR merged with conflicts in ResourceMaterializer.cpp/.hpp and the recompiler CMakeLists, all against our own bindless change, which this PR replaces. Driver ctest -j1: 413/414. The one failure (guest_force_tls_destructor) also fails on main.Tutorial level with APS5_BINDLESS_SLOTS=48 (single run, cache format change, so the boot recompiled about 170 shaders): 2.20 fps against 2.10 and 1.70 without the PR. No new error signatures, and the picture is unchanged. So no regression on this title, but one run can't show a speedup.
Without APS5_BINDLESS_SLOTS, booting straight into the tutorial (FROM's debug start menu with a one-entry map list) still aborts:
On our tree without the PR, the same boot with APS5_BINDLESS_SLOTS=48 fails on the same shader with 93 keys. As far as I can read the code, that table takes the material path (
table.hasMaterial, material buffer small enough to scan). There the distinct keys are still capped byAPS5_BINDLESS_SLOTS(default 16, clamped to 48), and only the direct-index path goes up toBindlessTableLimit(). Raising the material path's cap to the same device limit, or sizing it fromkeys.size(), would cover this shader. Through the normal menu route, 48 slots are enough for the tutorial level.AI-assisted: yes (an agent ran the builds, the game runs and the measurements, and read the code).
Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-08T16:28:06Z.
Rebased onto main and onto the updated #293 (its own changes are now one commit). Adapting to what changed underneath:
nullTexturekeeps #293's rule: withoutnullDescriptor, a comparison binding of a T# no comparison can read (all zero, or a format no comparison reads) throws instead of binding a zero texture.resourceTestsinagc_driver_graphicschecks the refusal namesnullDescriptorand carries the dwords.SetDescriptorLimitand gives a set that does not fit the chain pool a dedicated pool, so the chain-pool growth this PR had is gone; a large table set gets a dedicated pool sized for it.@fisherjoey thanks for the Demon's Souls run. You read it right: the material-selected path (
table.hasMaterial) still caps the distinct keys atAPS5_BINDLESS_SLOTS(16, at most 48); only the direct-index path goes up to the device limit. Raising the material path changes how its slots are materialized, so I'll do it in a follow-up PR rather than grow this one.Imported from boykopovar/AnyPS5. Originally posted by fisherjoey on 2026-10-08T19:50:53Z.
Data from Demon's Souls (PPSA01341 v1.07, Linux, RTX 5070 Ti) on a stack with this PR, for the table paths it doesn't cover.
Compute shader
0x248946900selects its images through a material table (resolveTableImage), and that path still sizes the table fromAPS5_BINDLESS_SLOTS(default 16, clamped to 48) rather than the device limit. The number of distinct keys it needs depends on the scene:With this PR and no
APS5_BINDLESS_SLOTS, the debug-start route ends withexit -6:compute shader 0x248946900: bindless image table: 60 distinct keys exceed the 16 slots. WithAPS5_BINDLESS_SLOTS=128on a local build it reaches the level. Through the normal menus the same shader stayed under 48 in our runs, so this only shows up with the larger material sets.The other failure we saw on this shader,
bindless image table selects no entrywhen every material key is past the heap's entry count (2 of 4 runs in the character creator), is the casebindNullTablehere covers; we had the same fix locally.Is the material-selected path meant to move to the device limit too, here or in #757?
Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-09T08:32:58Z.
Parked as a draft: with #639 a bindless table expands statically into the runtime ABI's sampled heap, so binding tables larger than 16 slots needs a new design rather than a rebase. @fisherjoey thanks for the Demon's Souls data on the material-table path; I'll use it when I redo this on the runtime ABI.
Imported from boykopovar/AnyPS5. Originally posted by simonbronk on 2026-10-14T12:06:33Z.
@MichonGoddijn231849 are you already redoing this on the runtime ABI? Onimusha: Way of the Sword (PPSA27836) needs it too: after #5620 and #5550 it stops at
static bindless image capacity exceeded(#5720), and withMaxImagesandSampledHeapCapacityraised locally to 128, at a compute program that reads a whole 32768-entry table with no material records (bindless image table has 32768 entries (0 materials), limit 16). Details in #5769.If you have not started, I would like to try the redesign and would build on this PR's approach, crediting you. If you have, I will test your branch on this title instead of writing a second version. Either way is fine.
AI-assisted: yes (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-15T11:02:22Z.
Closing: the author said on 2026-10-09 that after #639 a bindless table expands statically into the runtime ABI's sampled heap, so this needs a new design rather than a rebase. The branch has had no push since 2026-10-08, conflicts with
mainin the resource materializer/tracker, binding allocator,ShaderResources.cppand the disk cache, and depends on #293, which was closed as superseded by #639.The measurements here (Demon's Souls material-table counts from @fisherjoey, GTA V's 65536-entry heap, Onimusha's 32768-entry table in #5769) are useful input for the redesign. @simonbronk has offered to redo it on the runtime ABI; feel free to coordinate there or reopen if you push a version rebased on the runtime ABI.
Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-15T15:19:49Z.
@simonbronk I haven't started the redesign, so please go ahead and build on this PR's approach. @adriadam10 closing this is fine.
What I'd keep from it: the table sized from the device's sampled-image limit instead of a slot count. The data in this thread gives the sizes to design for: Demon's Souls' material-selected table needs 60-93 distinct keys in the tutorial level, GTA V binds a 65536-entry heap, and Onimusha reads a whole 32768-entry table with no material records. Since #639 the table expands statically into the runtime ABI's sampled heap, which is where
SampledHeapCapacityandMaxImagesstop it, so the redesign has to start there. Link your PR here and I'll test it on Wolverine and GTA V.Pull request closed