Experimental: Improve indirect image resource specialization for Wolverine #1108

Closed
github-bot wants to merge 2 commits from gh-pr/1108/head into gh-pr/1108/base
Owner

@⁠fzfalcon on GitHub · 2026-10-06 15:31 UTC · original
fzfalcon:main → main · +114 −2 · 3 files · 2 commits · closed without merging

Summary

This PR introduces an experimental shader resource specialization change
targeted at improving compatibility with Marvel's Wolverine (PPSA03671)
on Windows.

Wolverine currently reaches shader compilation but can fail during
resource materialization with:

shader resource specialization failed:
indirect image table at pc 0x0000114c has incompatible candidates

The failure occurs in:

src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp

during:

ShaderRecompiler::IR::MaterializeResources()

Changes

  • Adds an experimental Windows-only CMake option:
    KYTY_WOLVERINE_RELAXED_IMAGE_SPECIALIZATION

  • Applies the option to the emulator target on Windows.

  • Adjusts indirect image resource materialization to tolerate specific
    compatible resource metadata differences.

  • Keeps stricter resource properties unchanged, including:

    • numeric resource class
    • image dimension
    • cube/non-cube compatibility
    • conversion format
  • The change is intentionally limited to the shader resource
    specialization path.

Motivation

The goal is to determine whether the current indirect image candidate
compatibility check is too strict for Wolverine's shader/resource usage.

This is an experimental compatibility change and is intended for
testing and further investigation.

Testing

Target:

Marvel's Wolverine
Title ID: PPSA03671
Windows
KytyPS5

Previous behavior:

Shader compilation begins successfully but eventually fails with:

"indirect image table at pc 0x0000114c has incompatible candidates"

Expected behavior:

Allow the affected resource specialization path to proceed so that
the next compatibility/runtime issue can be identified.

Status

Experimental / Work in Progress.

This PR does not claim full Wolverine compatibility or performance
improvements yet.

Further testing is required to determine whether the relaxed
specialization produces correct rendering and stable execution.

**@⁠fzfalcon** on GitHub · 2026-10-06 15:31 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1108) `fzfalcon:main` → `main` · +114 −2 · 3 files · 2 commits · closed without merging ## Summary This PR introduces an experimental shader resource specialization change targeted at improving compatibility with Marvel's Wolverine (PPSA03671) on Windows. Wolverine currently reaches shader compilation but can fail during resource materialization with: shader resource specialization failed: indirect image table at pc 0x0000114c has incompatible candidates The failure occurs in: src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp during: ShaderRecompiler::IR::MaterializeResources() ## Changes - Adds an experimental Windows-only CMake option: `KYTY_WOLVERINE_RELAXED_IMAGE_SPECIALIZATION` - Applies the option to the emulator target on Windows. - Adjusts indirect image resource materialization to tolerate specific compatible resource metadata differences. - Keeps stricter resource properties unchanged, including: - numeric resource class - image dimension - cube/non-cube compatibility - conversion format - The change is intentionally limited to the shader resource specialization path. ## Motivation The goal is to determine whether the current indirect image candidate compatibility check is too strict for Wolverine's shader/resource usage. This is an experimental compatibility change and is intended for testing and further investigation. ## Testing Target: Marvel's Wolverine Title ID: PPSA03671 Windows KytyPS5 Previous behavior: Shader compilation begins successfully but eventually fails with: "indirect image table at pc 0x0000114c has incompatible candidates" Expected behavior: Allow the affected resource specialization path to proceed so that the next compatibility/runtime issue can be identified. ## Status Experimental / Work in Progress. This PR does not claim full Wolverine compatibility or performance improvements yet. Further testing is required to determine whether the relaxed specialization produces correct rendering and stable execution.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:43:13 +00:00
github-bot closed this pull request 2026-11-26 09:43:13 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-06 15:39 UTC · original · edited 2026-10-06 16:14 UTC

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 901107fc-317e-440e-9e8f-c2faebee2ab1
📥 Commits

Reviewing files that changed from the base of the PR and between 79d553f8e6 and 0ff4f1b197.

📒 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)
  • src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp

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

Walkthrough

Adds a default-off CMake option for relaxed image specialization on Windows. Updates indirect-image checks for mip counts and swizzles. When the option is enabled, eligible candidates with remaining metadata mismatches are normalized to the typed exemplar; other incompatible candidates continue to fail specialization.

Priority: ➖ Normal

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 0ff4f

No actionable merge-blocking issue was established. The experimental option can proceed with the further rendering and stability testing the author identified.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the experimental change to indirect image resource specialization for Wolverine.
Description check ✅ Passed The description explains the Windows-only specialization change, its motivation, scope, and expected behavior.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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 help to get the list of available commands.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-06 15:39 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1108#issuecomment-6019844951) · edited 2026-10-06 16:14 UTC <!-- This is an auto-generated comment: summarize by coderabbit.ai --> <!-- review_stack_entry_start --> <a href="https://app.coderabbit.ai/change-stack/KytyPS5/KytyPS5/pull/1108?scope=ghh_OusAJGA4HG8ljoOV0wJvVx8NmnZIjc2DdjmxOu0xZWA&amp;cs_source=review_comment"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui-dark.svg?v=2" alt="Review in Change Stack →" width="220" height="32"></a> <!-- review_stack_entry_end --> <!-- recent_review_start --> No actionable comments were generated in the recent review. 🎉 <details> <summary>ℹ️ Recent review info</summary> <details> <summary>⚙️ Run configuration</summary> - **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `901107fc-317e-440e-9e8f-c2faebee2ab1` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 79d553f8e66a592e1a6e9f5794bc440db97faa3a and 0ff4f1b197b5d111f3fb0cb432dd924e8d90ac3d. </details> <details> <summary>📒 Files selected for processing (1)</summary> * `src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp` </details> <details> <summary>🚧 Files skipped from review as they are similar to previous changes (1)</summary> * src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review. </details> --- <!-- recent_review_end --> <!-- walkthrough_start --> <details> <summary>📝 Walkthrough</summary> ## Walkthrough Adds a default-off CMake option for relaxed image specialization on Windows. Updates indirect-image checks for mip counts and swizzles. When the option is enabled, eligible candidates with remaining metadata mismatches are normalized to the typed exemplar; other incompatible candidates continue to fail specialization. </details> <!-- walkthrough_end --> <!-- change_assessment_start --> **Priority:** ➖ Normal <!-- change_assessment_commit:"0ff4f1b197b5d111f3fb0cb432dd924e8d90ac3d" --> **Change:** Bug fix <!-- change_assessment_end --> <!-- final_review_risk_start --> **Merge Risk:** _⚪ Minimal_ · up to `0ff4f` <!-- final_review_risk_coverage:{"sourceCommitId":"0ff4f1b197b5d111f3fb0cb432dd924e8d90ac3d","coveredCommitId":"0ff4f1b197b5d111f3fb0cb432dd924e8d90ac3d","kind":"reviewed"} --> No actionable merge-blocking issue was established. The experimental option can proceed with the further rendering and stability testing the author identified. <!-- final_review_risk_end --> <!-- pre_merge_checks_walkthrough_start --> <details> <summary>🚥 Pre-merge checks | ✅ 4 | ❌ 1</summary> ### ❌ Failed checks (1 warning) | Check name | Status | Explanation | Resolution | | :----------------: | :--------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------- | | Docstring Coverage | ⚠️ Warning | Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. | Write docstrings for the functions missing them to satisfy the coverage threshold. | <details> <summary>✅ Passed checks (4 passed)</summary> | Check name | Status | Explanation | | :------------------------: | :------- | :------------------------------------------------------------------------------------------------------------- | | Title check | ✅ Passed | The title clearly identifies the experimental change to indirect image resource specialization for Wolverine. | | Description check | ✅ Passed | The description explains the Windows-only specialization change, its motivation, scope, and expected behavior. | | Linked Issues check | ✅ Passed | Check skipped because no linked issues were found for this pull request. | | Out of Scope Changes check | ✅ Passed | Check skipped because no linked issues were found for this pull request. | </details> </details> <!-- pre_merge_checks_walkthrough_end --> <!-- autopilot:start --> - [ ] <!-- {"checkboxId":"2708ad07-9f24-4260-9c11-7dc76a49f2e3"} --> <strong title="Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts">Autopilot</strong> · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts <!-- autopilot:end --> <!-- tips_start --> --- Thanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=KytyPS5/KytyPS5&utm_content=1108)! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. <details> <summary>❤️ Share</summary> - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code) </details> <sub>Comment `@coderabbitai help` to get the list of available commands.</sub> <!-- tips_end -->
@ -645,0 +673,4 @@
std::fprintf(stderr,
"shader resource specialization: relaxed indirect image candidate at pc 0x%08x\n",
program.info.images[root_index].first_use_pc);
continue;
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-06 15:39 UTC · original · edited 2026-10-06 16:04 UTC

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

sed -n '610,695p' src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp
rg -n 'shader_swizzle|shaderSwizzle|swizzle|ImageMipMode|BuildResourceSpecialization' src/graphics/shader/recompiler/backend/spirv/spirvEmitterImage.cpp src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp | head -110
sed -n '23,75p' KytyPS5-Wolverine-v1.patch

Repository: KytyPS5/KytyPS5

Length of output: 12724


🏁 Script executed:

sed -n '390,485p' src/graphics/shader/recompiler/backend/spirv/spirvEmitterImage.cpp
sed -n '560,610p' src/graphics/shader/recompiler/backend/spirv/spirvEmitterImage.cpp
sed -n '660,785p' src/graphics/shader/recompiler/backend/spirv/spirvEmitterImage.cpp
sed -n '500,690p' src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp
sed -n '45,85p' KytyPS5-Wolverine-v1.patch
rg -n 'KYTY_WOLVERINE_RELAXED_IMAGE_SPECIALIZATION|indirect_root|ImageResource::' src/graphics/shader/recompiler/backend/spirv/spirvEmitterImage.cpp src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp KytyPS5-Wolverine-v1.patch

Repository: KytyPS5/KytyPS5

Length of output: 28684


🏁 Script executed:

sed -n '735,855p' src/graphics/shader/recompiler/backend/spirv/spirvEmitterImage.cpp
sed -n '240,365p' src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp
sed -n '390,470p' src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp
sed -n '1288,1330p' src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp
nl -ba KytyPS5-Wolverine-v1.patch | sed -n '45,83p'

Repository: KytyPS5/KytyPS5

Length of output: 18199


🏁 Script executed:

nl -ba src/graphics/shader/recompiler/backend/spirv/spirvEmitterImage.cpp | sed -n '610,690p;825,925p'

Repository: KytyPS5/KytyPS5

Length of output: 9848


Reject candidates with a different relevant swizzle.

The relaxed branch can accept a converted-image candidate with a different swizzle, then apply the root resource’s swizzle to that candidate’s sample. This can produce incorrect channels. Add swizzle_compatible to the fallback guard in both files.

🐛 Suggested fix
 if (image.numeric_class == image_class.numeric_class &&
     (same_coordinates || (is_2d(image.dimension) && is_2d(image_class.dimension))) &&
-    image.conversion_format == image_class.conversion_format) {
+    image.conversion_format == image_class.conversion_format &&
+    swizzle_compatible) {

✅ Addressed in commit 0ff4f1b

**@⁠coderabbitai[bot]** on GitHub · 2026-10-06 15:39 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1108#discussion_r4197357263) · edited 2026-10-06 16:04 UTC **🎯 Functional Correctness** | **🟠 Major** | **⚡ Quick win** <details> <summary>🔎 Supported by static analysis</summary> 🏁 Script executed: ```bash sed -n '610,695p' src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp rg -n 'shader_swizzle|shaderSwizzle|swizzle|ImageMipMode|BuildResourceSpecialization' src/graphics/shader/recompiler/backend/spirv/spirvEmitterImage.cpp src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp | head -110 sed -n '23,75p' KytyPS5-Wolverine-v1.patch ``` Repository: KytyPS5/KytyPS5 Length of output: 12724 --- 🏁 Script executed: ```bash sed -n '390,485p' src/graphics/shader/recompiler/backend/spirv/spirvEmitterImage.cpp sed -n '560,610p' src/graphics/shader/recompiler/backend/spirv/spirvEmitterImage.cpp sed -n '660,785p' src/graphics/shader/recompiler/backend/spirv/spirvEmitterImage.cpp sed -n '500,690p' src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp sed -n '45,85p' KytyPS5-Wolverine-v1.patch rg -n 'KYTY_WOLVERINE_RELAXED_IMAGE_SPECIALIZATION|indirect_root|ImageResource::' src/graphics/shader/recompiler/backend/spirv/spirvEmitterImage.cpp src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp KytyPS5-Wolverine-v1.patch ``` Repository: KytyPS5/KytyPS5 Length of output: 28684 --- 🏁 Script executed: ```bash sed -n '735,855p' src/graphics/shader/recompiler/backend/spirv/spirvEmitterImage.cpp sed -n '240,365p' src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp sed -n '390,470p' src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp sed -n '1288,1330p' src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp nl -ba KytyPS5-Wolverine-v1.patch | sed -n '45,83p' ``` Repository: KytyPS5/KytyPS5 Length of output: 18199 --- 🏁 Script executed: ```bash nl -ba src/graphics/shader/recompiler/backend/spirv/spirvEmitterImage.cpp | sed -n '610,690p;825,925p' ``` Repository: KytyPS5/KytyPS5 Length of output: 9848 --- </details> **Reject candidates with a different relevant swizzle.** The relaxed branch can accept a converted-image candidate with a different swizzle, then apply the root resource’s swizzle to that candidate’s sample. This can produce incorrect channels. Add `swizzle_compatible` to the fallback guard in both files. <details> <summary>🐛 Suggested fix</summary> ```diff if (image.numeric_class == image_class.numeric_class && (same_coordinates || (is_2d(image.dimension) && is_2d(image_class.dimension))) && - image.conversion_format == image_class.conversion_format) { + image.conversion_format == image_class.conversion_format && + swizzle_compatible) { ``` </details> <!-- fingerprinting:phantom:medusa:wombat --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:0ae9d586a3c349b7f79ebab4 --> <!-- This is an auto-generated comment by CodeRabbit --> ✅ Addressed in commit 0ff4f1b
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-06 15:39 UTC · original · reviewed

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b7b799fc-9908-4a18-b83d-beb8a9d8052f
📥 Commits

Reviewing files that changed from the base of the PR and between fb7ff7ec03 and 79d553f8e6.

📒 Files selected for processing (3)
  • CMakeLists.txt
  • KytyPS5-Wolverine-v1.patch
  • src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-06 15:39 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1108#pullrequestreview-5430945441) · **reviewed** **Actionable comments posted: 1** --- <details> <summary>ℹ️ Review info</summary> <details> <summary>⚙️ Run configuration</summary> - **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `b7b799fc-9908-4a18-b83d-beb8a9d8052f` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between fb7ff7ec03e8b7a940b7debdc9f54892a98ab4a5 and 79d553f8e66a592e1a6e9f5794bc440db97faa3a. </details> <details> <summary>📒 Files selected for processing (3)</summary> * `CMakeLists.txt` * `KytyPS5-Wolverine-v1.patch` * `src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp` </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review. </details> <!-- This is an auto-generated comment by CodeRabbit for review status --> <!-- coderabbit-review-publication v1 publication=8375b8dc-20ac-438c-9689-6faf315ab59b attempt=b798c949-170c-4832-8bc3-e466d28ac90e batch=1/1 -->
Author
Owner

@⁠Nmzik on GitHub · 2026-10-06 17:27 UTC · original

@⁠fazilprogrmr-svg We already have #937. Work is in progress

**@⁠Nmzik** on GitHub · 2026-10-06 17:27 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1108#issuecomment-6021734215) @⁠fazilprogrmr-svg We already have #937. Work is in progress

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.