shader: raise ShaderInfo::MaxImages from 64 to 128 #2292
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
GPU
GUI
help wanted
question
Shaders
Video
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/KytyPS5--KytyPS5!2292
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2292"
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?
@RubyUwU56 on GitHub · 2026-11-15 22:23 UTC · original
RubyUwU56:patch-1→main· +1 −1 · 1 files · 1 commits · openCode Vein II (PPSA23908) crashes at boot with:
One of its compute shaders references more than 64 image resources.
MaxImagesis only checked inResourceTracking::AddImage, and images are storedin a
std::vector, so raising the limit to 128 doesn't affect any fixed-size arrays.With this change the game boots past the crash, plays the intro at a stable
60 FPS and reaches the character creator.
Tested on: Windows 11, RTX 2080 Ti, 32 GB RAM, Pro mode off.
Note:
resource_materializationfails onmainindependently of this change.@coderabbitai[bot] on GitHub · 2026-11-15 22:27 UTC · original
Walkthrough
ShaderInfo::MaxImagesincreases from 64 to 128.Suggested reviewers:
nmzik,senaxxChange: Bug fix
Merge Risk:
Low · up to
76ac6The change lets Code Vein II get past its boot crash. On a GPU whose per-stage resource limit is at the Vulkan minimum, shaders that combine many images and buffers could still fail to create pipelines. This is unlikely on common hardware, so merge risk is low, and a follow-up check against the device limit is advisable.
Pre-merge checks:
4
Full details: Title check
Explanation
The title states the single change in the changeset: ShaderInfo::MaxImages is raised from 64 to 128 in ShaderIR.h. The raw summary confirms this is the only modified value (+1/-1 lines), so the title matches the main change.
Full details: Description check
Explanation
The description explains the reason for the change: a Code Vein II compute shader references more than 64 image resources and hits the MaxImages limit in ResourceTracking::AddImage. It also gives the reasoning that the std::vector storage is unaffected, and it lists test results. This relates directly to the changeset.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Share
@ -524,3 +524,3 @@struct ShaderInfo {static constexpr uint32_t MaxBufferRoots = 64;static constexpr uint32_t MaxImages = 64;static constexpr uint32_t MaxImages = 128;@coderabbitai[bot] on GitHub · 2026-11-15 22:27 UTC · original · edited 2026-11-15 22:32 UTC
Count live buffers against the per-stage resource limit before layout creation.
CreateLayoutscounts storage buffers and images in the same per-stagestage_resourcestotal.MaxImagesnow allows up to 128 non-heap images. A compute shader with 100 image descriptors and 29 live buffers gives a combined count of 129. On a device at the Vulkan minimum ofmaxPerStageResources(128),CreateLayoutscallsEXITand the pipeline is not created. A shader with 64 images and 64 buffers still totals 128 and passes.Before the layout is created, check the combined image and buffer count against
maxPerStageResources. Keep the image cap inResourceTracking.cppat the new value only if the combined count also fits the device. The fix needs the device limit in the shader-resource path, so it is not a single-line edit.@coderabbitai[bot] on GitHub · 2026-11-15 22:27 UTC · original · reviewed
Actionable comments posted: 1
b5646e97-83ca-426f-a363-1886d3f3978fReviewing files that changed from the base of the PR and between
41e2147c07and76ac681cf9.src/graphics/shader/recompiler/ir/ShaderIR.hIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
@ -524,3 +524,3 @@struct ShaderInfo {static constexpr uint32_t MaxBufferRoots = 64;static constexpr uint32_t MaxImages = 64;static constexpr uint32_t MaxImages = 128;@RubyUwU56 on GitHub · 2026-11-15 22:32 UTC · original
Good catch, but I don't think this is a regression:
descriptors, and those shaders already failed before this change
("image resource limit exceeded" in ResourceTracking). On a device at the
Vulkan minimum they now fail in CreateLayouts instead, so the outcome for
them is the same.
so the raised cap actually lets these shaders run (e.g. Code Vein II).
Making the image cap depend on the device limit would be the cleaner solution,
but it requires passing the device limits into the shader-resource path. I'd
prefer to keep this PR minimal and can follow up with that if the maintainers
want it.
@ -524,3 +524,3 @@struct ShaderInfo {static constexpr uint32_t MaxBufferRoots = 64;static constexpr uint32_t MaxImages = 64;static constexpr uint32_t MaxImages = 128;@coderabbitai[bot] on GitHub · 2026-11-15 22:34 UTC · original
Analysis chain
Script executed:
Length of output: 12532
Script executed:
Length of output: 18328
Script executed:
Length of output: 31617
@RubyUwU56You’re right. If a shader had more than 64 tracked images, it already failed inResourceTracking. Reaching the device-limit check later is not, by itself, a regression. I withdraw the finding.One clarification: native image descriptors do not always map one-to-one to tracked images.
DefineDescriptorsaddsimage.mip_countto the descriptor count, and materialization can add indirect images. My example of 100 descriptors alone does not establish how many images resource tracking counted.I agree that device-aware resource handling can be separate from this PR.
Review thread resolved.
You are interacting with an AI system.
@Nawid3333 on GitHub · 2026-11-18 08:36 UTC · original
Baldur's Gate 3 (PPSA18463, #2334) stops at this limit too, after its main menu and character creation:
@Crispy81 ran a fork build with this commit on top of official
2638b1band a stencil-only depth-target change the game needs before that point: it goes in game (Windows build, run 44248636917).View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.