shader: remap only the image resources of live image instructions (A Quiet Place: The Road Ahead) #2009
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!2009
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2009/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?
@Nawid3333 on GitHub · 2026-10-31 02:05 UTC · original
Nawid3333:fix/quiet-place-image-remap→main· +36 −3 · 2 files · 2 commits · closed without mergingA Quiet Place: The Road Ahead (PPSA19006) stops at the end of the Prologue with
condition (index >= source_count) is true in ResourceMaterialization.cpp:892(#1973).Cause. After specialization,
ApplyResourceSpecializationrenumbersmemory.resourceof every image entry inmemory_info(exceptplanning_onlyones) throughImageRemap, which only knows the images inspecialization.images. Dead-code elimination removes image instructions but leaves theirmemory_infoentries behind, and such an entry can hold an index that is not in the specialization, soImageRemap::operator[]exits. Every other reader ofmemory_infogets its index from a live instruction'sMemoryFlags; this loop is the only one that visits all entries.Change. The pass over image instructions marks the entries they use, and only those are renumbered. The entries of eliminated instructions keep their index; nothing reads them.
Tests.
TestEliminatedImageMemoryRemapbuilds the state after elimination directly: an image entry (resource 8) that no image instruction uses, past the specialized images; the mixed case adds a liveImageWritewhose entry is still renumbered. With the test on main,resource_materialization_testsstops in this case with exit code 0xC0000409 (anEXIT); with the fix, all cases pass.4919fdbwith this fix past the end of the Prologue (#1973).a79ac2d3.This is the fix from my #1112 (closed on 10-10, when no game was known to hit it), now with a game that does.
#690 also touches this lookup: it skips out-of-range indices instead of leaving dead entries out of the renumbering.
Written with Claude Code (AI): it found the cause, wrote the change and the test, and ran the test on my PC; Crispy81 tested the game.
@coderabbitai[bot] on GitHub · 2026-10-31 02:12 UTC · original
No actionable comments were generated in the recent review.
f358ff1a-a734-4447-b980-98646219aba3Reviewing files that changed from the base of the PR and between
4919fdb6e6anda79ac2d38b.src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpptests/ResourceMaterializationTests.cppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Walkthrough
ApplyResourceSpecializationnow tracks which image-memory entries are used by live image instructions. It remaps only live, non-planning image-memory entries. The new test checks that eliminated image memory retains its resource index and that live image memory uses the compacted index, with and without a live storage image.Suggested reviewers:
nmzik,claxten10Change: Bug fix
Merge Risk:
Minimal · up to
a79acEliminated image entries retain their indices without being emitted. No merge-blocking risk was identified.
Pre-merge checks:
4 ·
1
Full details: Docstring Coverage
Explanation
Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 3 functions across 2 files.
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
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.@Nawid3333 on GitHub · 2026-11-08 17:00 UTC · original
Superseded by
f27f4216din main, which remaps each image memory entry through its live image operation, so the entries of eliminated operations keep their index. Closing this one.Pull request closed