Skip to content

feat(shader): accept more than 32 buffers per shader up to the device limit - #1066

Merged
adriadam10 merged 1 commit into
boykopovar:mainfrom
Celegans12:feat/shader-buffer-limit
Oct 7, 2026
Merged

adriadam10 merged 1 commit into
boykopovar:mainfrom
Celegans12:feat/shader-buffer-limit

Conversation

@Celegans12

Copy link
Copy Markdown
Contributor

What

A program with more than 32 distinct buffer descriptors (V#s) throws buffer resource limit exceeded. The 32 is a recompiler constant, ShaderInfo::MaxBuffers, not a Vulkan limit, so this PR drops it.

Tested

  • Windows 11, MinGW-w64 GCC 15.2.0, based on main db3e659: configure -DBUILD_TESTING=ON, full build, --target libs, ctest:
  • 383/383 tests pass (ctest --output-on-failure)
  • Same build on lavapipe (Mesa 26.2.4 llvmpipe, 8-wide subgroups, VK_DRIVER_FILES): 382/382 pass; agc_driver_flat_store is left out there because it takes several minutes on Windows llvmpipe
  • New agc_driver_many_buffers reads and writes 52 buffers (push constants) and 124 (shader data), three in four not 16-byte aligned.
  • agc_driver_graphics: two buffers and a sampled or storage image throw at maxPerStageResources 2, not 3; samplers don't count. Both fail on main.
  • PPSA26344 v1.008: VALIDATION_PENDING
  • Not tested: Linux (CI), console behaviour.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes

… limit

The resource tracker refused a program's 33rd distinct V# with "buffer
resource limit exceeded". The 32 was a recompiler constant, not a
Vulkan limit: every buffer is one constant-indexed element of the guest
buffers binding, which ShaderResources checks against the device's
storage-buffer limits.

Drop ShaderInfo::MaxBuffers and the tracker's refusal, and size the
SPIR-V emitter's per-buffer offset list from the binding layout. When
the user data and offsets do not fit in the push constants, they all go
to the shader data buffer as before. ShaderResources counted only
storage buffers against maxPerStageResources (200 on Intel UHD) and now
adds the stage's sampled and storage images.

agc_driver_many_buffers reads and writes 52 and 124 buffers, and
agc_driver_graphics rejects buffers plus an image above the limit.
@adriadam10

Copy link
Copy Markdown
Collaborator

Checked on RADV (merged onto current main, 395/395): no other per-buffer 32-entry table or mask is left, both new tests fail without the change, and agc_driver_many_buffers runs in 1.4 s cold on CI's lavapipe. Merging.

@adriadam10
adriadam10 merged commit 8f510f3 into boykopovar:main Oct 7, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* docs shader core/shader

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants