shader: treat undefined image format (139) as null descriptor for resource specialization #1467
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!1467
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1467/head"
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?
@pedroMartinsMJ on GitHub · 2026-10-12 23:16 UTC · original
pedroMartinsMJ:fix-undefined-image-format→main· +128 −0 · 4 files · 2 commits · closed without mergingProblem
Demon's Souls (and other games) crash on startup with:
The PS5 GPU format encoding has gaps (
137–155); a value like139names no real format. When a guest leaves a texture-table slot unfilled, the emulator may read leftover dwords that decode to an invalid format. Previously the recompiler aborted shader specialization with a fatal error (pipelineCache.cpp:250), preventing the game from starting.Fix
IsDefinedBufferFormat()(src/graphics/guest_gpu/gpu_format.h/cpp) — table lookup confirming whether a format value names a real format (returnsfalsefor encoding gaps).ValidImageDescriptor()now rejects undefined formats; those slots bind as a null image instead of aborting.(shader_hash, slot)viaReportRejectedImageDescriptor()(deduped, capped at 64,std::mutexguarded) to ease future debugging.TestUndefinedImageFormatBindsNullImagecovering gap values137/139/155, valid formatsk4_4_4_4UNorm/kBc7Srgb, and a control (k32Floatstill binds its descriptor intact).Testing (on this system)
Hardware / OS: Fedora 44 KDE, AMD Ryzen AI 9 365 (Zen 5), Radeon 880M, RADV/Mesa 26.2.4, Vulkan 1.4.
./_Build/linux/install/resource_materialization_testsImpact
Checklist
shader:,src/...paths)_Build/ignored)@coderabbitai[bot] on GitHub · 2026-10-12 23:20 UTC · original · edited 2026-10-14 01:16 UTC
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
c918befb-1dee-4e9e-a7ff-0dd2bca8f4bb📥 Commits
Reviewing files that changed from the base of the PR and between
9555b3b61bandbb8a66cd70.📒 Files selected for processing: 1
src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp🚧 Files skipped from review as they are similar to previous changes: 1
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.
📝 Walkthrough
The change adds
IsDefinedBufferFormatto identify buffer formats with table entries. Image descriptor validation rejects undefined formats. Materialization reports nonzero rejected descriptors with deduplication and a 64-pair limit, then clears rejected direct descriptors. Tests cover undefined formats and verify that defined formats remain unchanged.Priority: ➖ Normal
Change: Bug fix
Merge Risk: ⚪ Minimal · up to
bb8a6Undefined image formats take the null-image fallback on both direct and indirect paths. No identified issue remains to block merging after normal checks.
Pre-merge checks:
4 ·
1
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.@coderabbitai[bot] on GitHub · 2026-10-14 01:00 UTC · original · edited 2026-10-14 01:17 UTC
On
src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cppline 119 (outdated):🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Skip only all-zero descriptors in rejection reports.
If word 0 is zero and the low byte of word 1 is zero,
NullImageDescriptorreturns true even when the format or other descriptor words are nonzero. For example, a direct descriptor with format 139, a zero base address, and a nonzero image type is rejected and cleared without the promised report. Test all eight words for zero here; retainNullImageDescriptorfor image-binding decisions.✅ Addressed in commit
bb8a66c@coderabbitai[bot] on GitHub · 2026-10-14 01:00 UTC · original · reviewed
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
2596a326-ada2-41e7-88e3-0bbfcda76624📥 Commits
Reviewing files that changed from the base of the PR and between 68aef8dbfe54c368bae20bd0a2db9cc379b8efe3 and
9555b3b61b.📒 Files selected for processing: 3
src/graphics/guest_gpu/gpu_format.cppsrc/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpptests/ResourceMaterializationTests.cppIncluded review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
@pedroMartinsMJ on GitHub · 2026-10-14 01:17 UTC · original
On
src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cppline 119 (outdated):now checking all 8 dwords for zero instead of using NullImageDescriptor, sorry, I corrected that.
@coderabbitai[bot] on GitHub · 2026-10-14 01:17 UTC · original
On
src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cppline 119 (outdated):@pedroMartinsMJThanks for the fix. The all-eight-dword check suppresses only all-zero descriptors and preserves reports for rejected nonzero descriptors.If you found this review helpful, would you consider giving us a shout-out on X?
Thank you for using CodeRabbit!
✅ Review thread resolved.
You are interacting with an AI system.
@Nmzik on GitHub · 2026-10-21 19:42 UTC · original
Duplicate of #1019.
Pull request closed