shader: treat an image format that names nothing as no descriptor instead of aborting #1019
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!1019
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1019"
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?
@tvhdev on GitHub · 2026-10-03 20:26 UTC · original
tvhdev:fix/undefined-image-format→main· +38 −0 · 3 files · 3 commits · openSymptom
Demon's Souls (PPSA01341 1.07) aborts at a fixed spot in the first area with
The same line appears in #697, #63 and #316 (Demon's Souls) and in #485, #938 and #541 for other titles.
Cause
ValidImageDescriptoraccepts every format value up tokBc7Srgb. Format 139 lies in a gap of theencoding (between
k4_4_4_4UNorm= 136 andkFmask8_S2_F1= 156), so the descriptor passes thecheck,
SampledTextureNumericClassthen returnsUnsupported, and specialization fails hard.The descriptor itself is garbage by design, not by accident: the shader indexes a texture table slot
that the guest never filled. On the console that slot is never sampled from, so the game does not care
what it holds.
Fix
Prospero::IsDefinedBufferFormat(format)ingpu_format.{h,cpp}: true whenFindFormatInfoknowsthe format.
ValidImageDescriptorrejects a descriptor whose format is not defined. Both the direct and theindirect-table path then treat it like a null descriptor and bind the null texture, which is what the
zeroing path already did for other invalid descriptors.
case stays visible instead of silently becoming a null texture.
Verification
across runs since, no recurrence of this message as a fatal.
resource_materialization_tests,resource_tracking_tests,shader_recompiler_compute_testsunchanged.Two commits, 30 added lines, no behaviour change for defined formats.
@coderabbitai[bot] on GitHub · 2026-10-03 20:35 UTC · original · edited 2026-10-03 22:08 UTC
Navigate logical layers of code changes, visualize relationships, and explore their blast radius.
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
9703dd27-4b42-41f5-bcdf-426265fab85e📥 Commits
Reviewing files that changed from the base of the PR and between
e3f0a07ac1and0e73f15ca4.📒 Files selected for processing (3)
src/graphics/guest_gpu/gpu_format.cppsrc/graphics/guest_gpu/gpu_format.hsrc/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp🚧 Files skipped from review as they are similar to previous changes (3)
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
📝 Walkthrough
Walkthrough
The change adds
IsDefinedBufferFormatto check whether a buffer format has metadata. Image descriptor validation now rejects undefined formats, including encodings within the accepted numeric range. Materialization logs invalid, non-null image descriptors once per shader hash and slot, up to 64 pairs. Invalid descriptors continue to be replaced with null descriptors. All-zero unbound descriptors are not logged.Priority: ➖ Normal
Change: Bug fix
Merge Risk: ⚪ Minimal · up to
0e73fThis change stops an abort on image descriptors whose format is undefined by treating them as null descriptors. Defined formats behave as before. No merge-blocking risk was identified.
Security Architecture Review
Security architecture risk: 🔵 Low · up to
e3f0aThe fix strengthens validation and reuses an existing null-resource fallback. Current execution paths serialize the new bounded diagnostic state, and no material security regression was identified in those paths. Safe concurrent use outside that execution model was not fully established.
Retained concerns
No architecture-level concerns identified.
Security review details
Security Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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
Comment
@coderabbitai helpto get the list of available commands.@AdelRdp2024 on GitHub · 2026-10-10 13:53 UTC · original
I’m testing Demon’s Souls Remake (PPSA01341) on a recent KytyPS5 build. The game reaches the main menu, but the emulator crashes after selecting New Game and Offline with this error:
failed to create image: extent=4096x4096x1 format=43 layers=5 levels=1The error points to
src/graphics/host_gpu/renderer/image/image.cpp:727.Could this be related to the image-format issue addressed by this PR, or is it a separate problem? Thanks!
@tvhdev on GitHub · 2026-10-11 19:55 UTC · original
@AdelRdp2024 i had this error too with two different images, the reason was that the graphics card's VRAM was exhausted. you could start the emulator with --printf-direction File --printf-output-file kyty_log.txt to see if there's a VMA heap info right before the crash.
@AdelRdp2024 on GitHub · 2026-10-11 22:43 UTC · original
@tvhdev Thanks, that was it. The log shows VMA heap 0: usage=4133105664, budget=3213950157, so VRAM is exhausted (GTX 980, 4GB). Not related to the PR then. Thanks for the tip!
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.