shader: convert 11_11_10 UNORM image loads and gathers to float #1115

Closed
github-bot wants to merge 1 commit from gh-pr/1115/head into gh-pr/1115/base
Owner

@⁠NeySlim on GitHub · 2026-10-06 19:44 UTC · original
NeySlim:feat/unorm-11-11-10-storage → main · +137 −14 · 2 files · 1 commits · closed without merging

God of War Ragnarök (PPSA08332) uses a 1920x1080 k11_11_10UNorm (format 30) render target written by a compute pass.

Main now backs the format with R32_UINT and handles stores (c11254a9) and direct 2D sample_lz (56738aa4). What is left is reading it with image_load and gathers: a load or gather of a sampled 11_11_10 UNORM image stops with packed UNorm sampling requires a direct 2D sample_lz, and the shared unpack path would return the raw 11/11/10 fields instead of normalized floats.

Change

  • image_load and gathers of a sampled 11_11_10 UNORM image go through the usual fetch and gather paths; filtered samples still use SamplePackedUnormLz.
  • UnpackImageTexel and UnpackImageGather convert each packed UNORM field to field / (2^bits - 1) as a float, and swizzle constants give 1.0 and 0.0. The result is passed on as a float result, so D16 loads pack halves as for other float formats.

The materialization checks of main (single-mip centered 2D image, direct image, bilinear clamp sampler for sampled pairs) are unchanged.

Test

Two new GPU cases next to the packed UINT ones:

  • ImageLoadPackedUnormConvertsToFloat: an IMAGE_LOAD returns each field divided by 2047 or 1023 as float bits, and a 1 swizzle returns 1.0.
  • ImageGatherPackedUnormConvertsToFloat: IMAGE_GATHER4_LZ of the 10-bit field, of an 11-bit field and of a constant 1 component on a 2x2 image returns the four texels in gather order as floats.

Both stop with the error above on main, and fail when the conversion or the constant handling is removed.

Validation

Linux, AMD Radeon 8060S, Mesa RADV 26.2.3, rebased on 9e41d832. CPU suites pass; shader_recompiler_compute_tests one case per process: 629 of 639, the 10 failures are the same as on main (627 of 637).

Not tested on Windows/macOS; the change is platform-independent SPIR-V code.

AI use

I used Claude Code (AI agent) to investigate the failure, write the change and the tests, and run the tests above on my machine. I reviewed the diff and the results before opening this PR.

**@⁠NeySlim** on GitHub · 2026-10-06 19:44 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1115) `NeySlim:feat/unorm-11-11-10-storage` → `main` · +137 −14 · 2 files · 1 commits · closed without merging God of War Ragnarök (PPSA08332) uses a 1920x1080 `k11_11_10UNorm` (format 30) render target written by a compute pass. Main now backs the format with `R32_UINT` and handles stores (c11254a9) and direct 2D `sample_lz` (56738aa4). What is left is reading it with `image_load` and gathers: a load or gather of a sampled 11_11_10 UNORM image stops with `packed UNorm sampling requires a direct 2D sample_lz`, and the shared unpack path would return the raw 11/11/10 fields instead of normalized floats. ## Change - `image_load` and gathers of a sampled 11_11_10 UNORM image go through the usual fetch and gather paths; filtered samples still use `SamplePackedUnormLz`. - `UnpackImageTexel` and `UnpackImageGather` convert each packed UNORM field to `field / (2^bits - 1)` as a float, and swizzle constants give 1.0 and 0.0. The result is passed on as a float result, so D16 loads pack halves as for other float formats. The materialization checks of main (single-mip centered 2D image, direct image, bilinear clamp sampler for sampled pairs) are unchanged. ## Test Two new GPU cases next to the packed UINT ones: - `ImageLoadPackedUnormConvertsToFloat`: an `IMAGE_LOAD` returns each field divided by 2047 or 1023 as float bits, and a `1` swizzle returns 1.0. - `ImageGatherPackedUnormConvertsToFloat`: `IMAGE_GATHER4_LZ` of the 10-bit field, of an 11-bit field and of a constant `1` component on a 2x2 image returns the four texels in gather order as floats. Both stop with the error above on main, and fail when the conversion or the constant handling is removed. ## Validation Linux, AMD Radeon 8060S, Mesa RADV 26.2.3, rebased on 9e41d832. CPU suites pass; `shader_recompiler_compute_tests` one case per process: 629 of 639, the 10 failures are the same as on main (627 of 637). Not tested on Windows/macOS; the change is platform-independent SPIR-V code. ## AI use I used Claude Code (AI agent) to investigate the failure, write the change and the tests, and run the tests above on my machine. I reviewed the diff and the results before opening this PR.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:43:35 +00:00
github-bot closed this pull request 2026-11-26 09:43:35 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-06 19:50 UTC · original · edited 2026-10-14 07:17 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: d62f7882-dd44-4613-916e-118c1fb69e5c
📥 Commits

Reviewing files that changed from the base of the PR and between a39d5c690de48353696c0ce7c0e269e68b92ab32 and 2377f36956.

📒 Files selected for processing: 2
  • src/graphics/shader/recompiler/backend/spirv/spirvEmitterImage.cpp
  • tests/ShaderRecompilerComputeTests.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

The SPIR-V image emitter now returns normalized float values for packed UNORM fields in image reads and gathers. It uses float result types and swizzle constants for these formats, while other packed fields retain their integer values. The special packed sampling path excludes image reads and raw gathers. Two compute tests cover packed UNORM image loads and gathers.

Suggested reviewers: nmzik

Priority: ➖ Normal

Change: Feature

Merge Risk: ⚪ Minimal · up to 2377f

The supported packed-UNORM image paths retain the required conversion and filtering behavior. No new merge-blocking risk is established.

Pre-merge checks: Passed 4 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Docstring Coverage Inconclusive Docstring coverage is 18.18% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 2 files. (1 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
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.
Title check Passed The title clearly and concisely describes the main change: converting 11_11_10 UNORM image loads and gathers to float results.
Description check Passed The description directly explains the affected format, image operations, implementation, tests, validation results, and relationship to the pull request objectives.
Full details: Docstring Coverage

Explanation

Docstring coverage is 18.18% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 2 files. (1 skipped: 1 too large.)

  • 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 19:50 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1115#issuecomment-6024226891) · edited 2026-10-14 07:17 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/1115?scope=ghh_OusAJGA4HG8ljoOV0wJvVx8NmnZIjc2DdjmxOu0xZWA&amp;cs_source=review_comment"><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui-dark.svg?v=3"><source media="(prefers-color-scheme: light)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg?v=3"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg?v=3" alt="Review in Change Stack →" height="32"></picture></a> <!-- review_stack_entry_end --> <!-- recent_review_start --> No actionable comments were generated in the recent review. 🎉 <details> <summary><strong>ℹ️ Recent review info</strong></summary> <dl> <dd> <details> <summary><strong>⚙️ Run configuration</strong></summary> <dl> <dd> - **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `d62f7882-dd44-4613-916e-118c1fb69e5c` </dd> </dl> </details> <details> <summary><strong>📥 Commits</strong></summary> <dl> <dd> Reviewing files that changed from the base of the PR and between a39d5c690de48353696c0ce7c0e269e68b92ab32 and 2377f36956a851a4ba82ec12fe63eb9b498df144. </dd> </dl> </details> <details> <summary><strong>📒 Files selected for processing: 2</strong></summary> <dl> <dd> * `src/graphics/shader/recompiler/backend/spirv/spirvEmitterImage.cpp` * `tests/ShaderRecompilerComputeTests.cpp` </dd> </dl> </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. </dd> </dl> </details> <!-- recent_review_end --> <!-- walkthrough_start --> <details> <summary><strong>📝 Walkthrough</strong></summary> <dl> <dd> The SPIR-V image emitter now returns normalized float values for packed UNORM fields in image reads and gathers. It uses float result types and swizzle constants for these formats, while other packed fields retain their integer values. The special packed sampling path excludes image reads and raw gathers. Two compute tests cover packed UNORM image loads and gathers. **Suggested reviewers:** `nmzik` </dd> </dl> </details> <!-- walkthrough_end --> <!-- change_assessment_start --> **Priority:** ➖ Normal <!-- change_assessment_commit:"2377f36956a851a4ba82ec12fe63eb9b498df144" --> **Change:** Feature <!-- change_assessment_end --> <details> <summary><strong>Merge Risk:</strong> <strong>⚪ Minimal</strong> · up to <code>2377f</code></summary> <dl> <dd> <!-- final_review_risk_start --> <!-- final_review_risk_label **Merge Risk:** **⚪ Minimal** · up to `2377f` --> <!-- final_review_risk_coverage:{"sourceCommitId":"2377f36956a851a4ba82ec12fe63eb9b498df144","coveredCommitId":"2377f36956a851a4ba82ec12fe63eb9b498df144","kind":"reviewed"} --> The supported packed-UNORM image paths retain the required conversion and filtering behavior. No new merge-blocking risk is established. <!-- final_review_risk_end --> </dd> </dl> </details> <!-- pre_merge_checks_walkthrough_start --> <details> <summary><strong>Pre-merge checks: <sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-passed-14-v2.svg" width="14" height="14" align="middle" alt="Passed" title="Passed"></picture></sup> 4 · <sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-inconclusive-14-v2.svg" width="14" height="14" align="middle" alt="Inconclusive" title="Inconclusive"></picture></sup> 1</strong></summary> <dl> <dd> <strong><sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-failed-14-v2.svg" width="14" height="14" align="middle" alt="Failed" title="Failed"></picture></sup> Failed checks: 1 inconclusive</strong> | Check name | Status | Explanation | Resolution | | :---------------- | :--------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------- | | Docstring Coverage | ![Inconclusive](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-inconclusive.svg) | Docstring coverage is 18.18% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 2 files. (1 skipped: … | Write docstrings for the functions missing them to satisfy the coverage threshold. | <details> <summary><strong><sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-passed-14-v2.svg" width="14" height="14" align="middle" alt="Passed" title="Passed"></picture></sup> Passed checks: 4 passed</strong></summary> <dl> <dd> | Check name | Status | Explanation | | :------------------------ | :--------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Linked Issues check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | Check skipped because no linked issues were found for this pull request. | | Out of Scope Changes check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | Check skipped because no linked issues were found for this pull request. | | Title check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The title clearly and concisely describes the main change: converting 11_11_10 UNORM image loads and gathers to float results. | | Description check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The description directly explains the affected format, image operations, implementation, tests, validation results, and relationship to the pull request objectives. | </dd> </dl> </details> <details> <summary><strong>Full details: Docstring Coverage</strong></summary> <dl> <dd> **Explanation** Docstring coverage is 18.18% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 2 files. (1 skipped: 1 too large.) </dd> </dl> </details> </dd> </dl> </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=1115)! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. <details> <summary><strong>❤️ Share</strong></summary> <dl> <dd> - [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) </dd> </dl> </details> <sub>Comment `@coderabbitai help` to get the list of available commands.</sub> <!-- tips_end -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-06 19:50 UTC · original · edited 2026-10-06 19:57 UTC
On src/graphics/guest_gpu/gpu_format.cpp line 243 (outdated):

@@ -238,6 +240,7 @@ BufferFormat RemapTextureFormat(BufferFormat format) {
 		case BufferFormat::k8UScaled: return BufferFormat::k8UNorm;
 		case BufferFormat::k8_8UScaled: return BufferFormat::k8_8UNorm;
 		case BufferFormat::k11_11_10UInt: return BufferFormat::k32UInt;
+		case BufferFormat::k11_11_10UNorm: return BufferFormat::k32UInt;

🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

🔎 Supported by static analysis

🏁 Script executed:

set -e
nl -ba src/graphics/guest_gpu/gpu_format.cpp | sed -n '180,275p'
printf '%s\n' '--- symbols ---'
rg -n -F -- 'UnpackImageTexel' src || true
rg -n -F -- 'RemapTextureFormat' src || true
rg -n -F -- 'k11_11_10UNorm' src || true
rg -n -F -- 'k32UInt' src/graphics src || true
printf '%s\n' '--- sampler/filter terms ---'
rg -n -i -- 'linear.*filter|filter.*linear|sampler.*create|vkCreateSampler|magFilter|minFilter|filterMode' src/graphics src || true

Repository: KytyPS5/KytyPS5

Length of output: 12530


🏁 Script executed:

set -e
printf '%s\n' '--- sampler cache ---'
nl -ba src/graphics/host_gpu/renderer/cache/samplerCache.cpp | sed -n '1,145p'
printf '%s\n' '--- texture creation ---'
nl -ba src/graphics/host_gpu/renderer/image/textureCommon.cpp | sed -n '130,205p'
printf '%s\n' '--- image format and unpack helpers ---'
nl -ba src/graphics/shader/recompiler/backend/spirv/spirvEmitterImage.cpp | sed -n '370,470p'
nl -ba src/graphics/shader/recompiler/backend/spirv/spirvEmitterImage.cpp | sed -n '690,745p'
nl -ba src/graphics/shader/recompiler/backend/spirv/spirvEmitterImage.cpp | sed -n '850,985p'
printf '%s\n' '--- format metadata and Vulkan mapping ---'
nl -ba src/graphics/guest_gpu/gpu_format.cpp | sed -n '1,55p'
nl -ba src/graphics/host_gpu/vulkanCommon.cpp | sed -n '1,50p'

Repository: KytyPS5/KytyPS5

Length of output: 33757


🏁 Script executed:

set -e
printf '%s\n' '--- sampler creation completion ---'
nl -ba src/graphics/host_gpu/renderer/cache/samplerCache.cpp | sed -n '135,190p'
printf '%s\n' '--- sampler cache callers ---'
rg -n -F -- 'GetSampler(' src/graphics/host_gpu src/graphics/shader || true

Repository: KytyPS5/KytyPS5

Length of output: 1931


Preserve UNORM filtering for sampled k11_11_10UNorm textures.

k11_11_10UNorm now uses vk::Format::eR32Uint. Linear samplers are created without format-specific rejection or emulation. The shader samples this integer image first and calls UnpackImageTexel afterward, so the UNORM component conversion cannot participate in filtering. Add a sampled-image path that filters the unpacked normalized components, or use a backing format that preserves normalized filtering.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-06 19:50 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1115#discussion_r4199789985) · edited 2026-10-06 19:57 UTC On `src/graphics/guest_gpu/gpu_format.cpp` line 243 (outdated): ```diff @@ -238,6 +240,7 @@ BufferFormat RemapTextureFormat(BufferFormat format) { case BufferFormat::k8UScaled: return BufferFormat::k8UNorm; case BufferFormat::k8_8UScaled: return BufferFormat::k8_8UNorm; case BufferFormat::k11_11_10UInt: return BufferFormat::k32UInt; + case BufferFormat::k11_11_10UNorm: return BufferFormat::k32UInt; ``` **🎯 Functional Correctness** | **🟠 Major** | **🏗️ Heavy lift** <details> <summary>🔎 Supported by static analysis</summary> 🏁 Script executed: ```bash set -e nl -ba src/graphics/guest_gpu/gpu_format.cpp | sed -n '180,275p' printf '%s\n' '--- symbols ---' rg -n -F -- 'UnpackImageTexel' src || true rg -n -F -- 'RemapTextureFormat' src || true rg -n -F -- 'k11_11_10UNorm' src || true rg -n -F -- 'k32UInt' src/graphics src || true printf '%s\n' '--- sampler/filter terms ---' rg -n -i -- 'linear.*filter|filter.*linear|sampler.*create|vkCreateSampler|magFilter|minFilter|filterMode' src/graphics src || true ``` Repository: KytyPS5/KytyPS5 Length of output: 12530 --- 🏁 Script executed: ```bash set -e printf '%s\n' '--- sampler cache ---' nl -ba src/graphics/host_gpu/renderer/cache/samplerCache.cpp | sed -n '1,145p' printf '%s\n' '--- texture creation ---' nl -ba src/graphics/host_gpu/renderer/image/textureCommon.cpp | sed -n '130,205p' printf '%s\n' '--- image format and unpack helpers ---' nl -ba src/graphics/shader/recompiler/backend/spirv/spirvEmitterImage.cpp | sed -n '370,470p' nl -ba src/graphics/shader/recompiler/backend/spirv/spirvEmitterImage.cpp | sed -n '690,745p' nl -ba src/graphics/shader/recompiler/backend/spirv/spirvEmitterImage.cpp | sed -n '850,985p' printf '%s\n' '--- format metadata and Vulkan mapping ---' nl -ba src/graphics/guest_gpu/gpu_format.cpp | sed -n '1,55p' nl -ba src/graphics/host_gpu/vulkanCommon.cpp | sed -n '1,50p' ``` Repository: KytyPS5/KytyPS5 Length of output: 33757 --- 🏁 Script executed: ```bash set -e printf '%s\n' '--- sampler creation completion ---' nl -ba src/graphics/host_gpu/renderer/cache/samplerCache.cpp | sed -n '135,190p' printf '%s\n' '--- sampler cache callers ---' rg -n -F -- 'GetSampler(' src/graphics/host_gpu src/graphics/shader || true ``` Repository: KytyPS5/KytyPS5 Length of output: 1931 --- </details> **Preserve UNORM filtering for sampled `k11_11_10UNorm` textures.** `k11_11_10UNorm` now uses `vk::Format::eR32Uint`. Linear samplers are created without format-specific rejection or emulation. The shader samples this integer image first and calls `UnpackImageTexel` afterward, so the UNORM component conversion cannot participate in filtering. Add a sampled-image path that filters the unpacked normalized components, or use a backing format that preserves normalized filtering. <!-- fingerprinting:phantom:poseidon:wombat --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:095c06b7cc6c4b80627b2239 --> <!-- This is an auto-generated reply by CodeRabbit -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-06 19:51 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: 89647e10-34bf-4f1f-b7b5-c0a216e1e737
📥 Commits

Reviewing files that changed from the base of the PR and between 199d0a9d92 and 0b14de25de3789d2de2d1c220abd8090bfa2091c.

📒 Files selected for processing (2)
  • src/graphics/guest_gpu/gpu_format.cpp
  • src/graphics/shader/recompiler/backend/spirv/spirvEmitterImage.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 19:51 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1115#pullrequestreview-5433819960) · **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**: `89647e10-34bf-4f1f-b7b5-c0a216e1e737` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 199d0a9d9225e560432301e39439296d57fa0e34 and 0b14de25de3789d2de2d1c220abd8090bfa2091c. </details> <details> <summary>📒 Files selected for processing (2)</summary> * `src/graphics/guest_gpu/gpu_format.cpp` * `src/graphics/shader/recompiler/backend/spirv/spirvEmitterImage.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=541dbea1-7d0c-42c7-acc9-85d840ba683c attempt=5426baf5-3f53-4495-b27c-1d7f46a5217f batch=1/1 -->
Author
Owner

@⁠NeySlim on GitHub · 2026-10-06 19:57 UTC · original
On src/graphics/guest_gpu/gpu_format.cpp line 243 (outdated):

@@ -238,6 +240,7 @@ BufferFormat RemapTextureFormat(BufferFormat format) {
 		case BufferFormat::k8UScaled: return BufferFormat::k8UNorm;
 		case BufferFormat::k8_8UScaled: return BufferFormat::k8_8UNorm;
 		case BufferFormat::k11_11_10UInt: return BufferFormat::k32UInt;
+		case BufferFormat::k11_11_10UNorm: return BufferFormat::k32UInt;

Accepted as a known limitation. Sampled use of k11_11_10UNorm was unsupported before this change (no format info entry, so the materializer aborted); it now resolves to unfiltered reads through the UINT backing, which is the same treatment the existing k11_11_10UInt remap gets. Filtering the unpacked components in the shader can follow if a title samples this format with a linear sampler; none of the GoW Ragnarök shaders do.

**@⁠NeySlim** on GitHub · 2026-10-06 19:57 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1115#discussion_r4199845184) On `src/graphics/guest_gpu/gpu_format.cpp` line 243 (outdated): ```diff @@ -238,6 +240,7 @@ BufferFormat RemapTextureFormat(BufferFormat format) { case BufferFormat::k8UScaled: return BufferFormat::k8UNorm; case BufferFormat::k8_8UScaled: return BufferFormat::k8_8UNorm; case BufferFormat::k11_11_10UInt: return BufferFormat::k32UInt; + case BufferFormat::k11_11_10UNorm: return BufferFormat::k32UInt; ``` Accepted as a known limitation. Sampled use of `k11_11_10UNorm` was unsupported before this change (no format info entry, so the materializer aborted); it now resolves to unfiltered reads through the UINT backing, which is the same treatment the existing `k11_11_10UInt` remap gets. Filtering the unpacked components in the shader can follow if a title samples this format with a linear sampler; none of the GoW Ragnarök shaders do.
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-06 19:57 UTC · original
On src/graphics/guest_gpu/gpu_format.cpp line 243 (outdated):

@@ -238,6 +240,7 @@ BufferFormat RemapTextureFormat(BufferFormat format) {
 		case BufferFormat::k8UScaled: return BufferFormat::k8UNorm;
 		case BufferFormat::k8_8UScaled: return BufferFormat::k8_8UNorm;
 		case BufferFormat::k11_11_10UInt: return BufferFormat::k32UInt;
+		case BufferFormat::k11_11_10UNorm: return BufferFormat::k32UInt;

@NeySlim Thanks for clarifying. This is an accepted filtering limitation, not a regression in previously supported sampled use. Given that the GoW Ragnarök shaders do not require linear sampling of this format, I will not press for filtering support in this PR.

Would you like a follow-up issue for filtering the unpacked UNORM components?


✏️ Learnings added
Learnt from: NeySlim
Repo: KytyPS5/KytyPS5 PR: 1115
File: src/graphics/guest_gpu/gpu_format.cpp:243-243
Timestamp: 2026-10-06T19:57:32.855Z
Learning: In KytyPS5/KytyPS5, `k11_11_10UNorm` uses `k32UInt` backing through `RemapTextureFormat` in `src/graphics/guest_gpu/gpu_format.cpp`, with shader conversion in `src/graphics/shader/recompiler/backend/spirv/spirvEmitterImage.cpp`. Filtering unpacked UNORM components is an accepted limitation of this implementation. The author reports that GoW Ragnarök shaders do not sample this format with linear samplers. Do not treat missing linear filtering as a regression in previously supported sampled use.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

You are interacting with an AI system.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-06 19:57 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1115#discussion_r4199848670) On `src/graphics/guest_gpu/gpu_format.cpp` line 243 (outdated): ```diff @@ -238,6 +240,7 @@ BufferFormat RemapTextureFormat(BufferFormat format) { case BufferFormat::k8UScaled: return BufferFormat::k8UNorm; case BufferFormat::k8_8UScaled: return BufferFormat::k8_8UNorm; case BufferFormat::k11_11_10UInt: return BufferFormat::k32UInt; + case BufferFormat::k11_11_10UNorm: return BufferFormat::k32UInt; ``` `@NeySlim` Thanks for clarifying. This is an accepted filtering limitation, not a regression in previously supported sampled use. Given that the GoW Ragnarök shaders do not require linear sampling of this format, I will not press for filtering support in this PR. Would you like a follow-up issue for filtering the unpacked UNORM components? --- <details> <summary>✏️ Learnings added</summary> ``` Learnt from: NeySlim Repo: KytyPS5/KytyPS5 PR: 1115 File: src/graphics/guest_gpu/gpu_format.cpp:243-243 Timestamp: 2026-10-06T19:57:32.855Z Learning: In KytyPS5/KytyPS5, `k11_11_10UNorm` uses `k32UInt` backing through `RemapTextureFormat` in `src/graphics/guest_gpu/gpu_format.cpp`, with shader conversion in `src/graphics/shader/recompiler/backend/spirv/spirvEmitterImage.cpp`. Filtering unpacked UNORM components is an accepted limitation of this implementation. The author reports that GoW Ragnarök shaders do not sample this format with linear samplers. Do not treat missing linear filtering as a regression in previously supported sampled use. ``` > Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure [review instructions](https://docs.coderabbit.ai/guides/review-instructions). You can manage existing learnings in the [app](https://app.coderabbit.ai/learnings). </details> _You are interacting with an AI system._ <!-- This is an auto-generated reply by CodeRabbit -->
Author
Owner

@⁠NeySlim on GitHub · 2026-10-09 19:29 UTC · original

Rebased on main (59183dbf); the change applied cleanly. Added GPU tests that were missing: ImageLoadPackedUnormConvertsToFloat and ImageStorePackedUnormClampsAndRounds (a39d5c69). Both fail without the change. Full GPU suite, one case per process: 604/614, same 10 failures as main (602/612). The description now has Test, Validation and AI use sections.

**@⁠NeySlim** on GitHub · 2026-10-09 19:29 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1115#issuecomment-6087820330) Rebased on main (59183dbf); the change applied cleanly. Added GPU tests that were missing: `ImageLoadPackedUnormConvertsToFloat` and `ImageStorePackedUnormClampsAndRounds` (a39d5c69). Both fail without the change. Full GPU suite, one case per process: 604/614, same 10 failures as main (602/612). The description now has Test, Validation and AI use sections.
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-09 19:34 UTC · original · reviewed

🧹 Nitpick comments (1)
tests/ShaderRecompilerComputeTests.cpp (1)

35825-35825: 🗄️ Data Integrity & Integration | 🔵 Trivial | 🏗️ Heavy lift

Add a guest kRenderTarget round-trip for k11_11_10UNorm.

The added cases use RunCase, which creates host R32_UINT images from raw vectors. MakeSampledTextureData and MakeStorageTextureData only provide shader metadata. They do not exercise guest render-target allocation, RemapTextureFormat, render-target tiling, or guest-memory readback.

The existing R11G11B10 render-target case uses k11_11_10Float, so it does not detect a regression in the new UNorm mapping. Add the compute-written render-target case described in the PR. Assert the effective R32_UINT backing format and the packed guest-memory result.


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 96ea5396-2f80-447b-8270-fb6c2b2af216
📥 Commits

Reviewing files that changed from the base of the PR and between 0b14de25de3789d2de2d1c220abd8090bfa2091c and a39d5c690de48353696c0ce7c0e269e68b92ab32.

📒 Files selected for processing (2)
  • src/graphics/shader/recompiler/backend/spirv/spirvEmitterImage.cpp
  • tests/ShaderRecompilerComputeTests.cpp

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

**@⁠coderabbitai[bot]** on GitHub · 2026-10-09 19:34 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1115#pullrequestreview-5474542779) · **reviewed** <details> <summary>🧹 Nitpick comments (1)</summary><blockquote> <details> <summary>tests/ShaderRecompilerComputeTests.cpp (1)</summary><blockquote> `35825-35825`: **🗄️ Data Integrity & Integration** | **🔵 Trivial** | **🏗️ Heavy lift** **Add a guest `kRenderTarget` round-trip for `k11_11_10UNorm`.** The added cases use `RunCase`, which creates host `R32_UINT` images from raw vectors. `MakeSampledTextureData` and `MakeStorageTextureData` only provide shader metadata. They do not exercise guest render-target allocation, `RemapTextureFormat`, render-target tiling, or guest-memory readback. The existing `R11G11B10` render-target case uses `k11_11_10Float`, so it does not detect a regression in the new UNorm mapping. Add the compute-written render-target case described in the PR. Assert the effective `R32_UINT` backing format and the packed guest-memory result. <!-- cr-comment:v1:9839e0cc6b62b133aacfbd14 --> </blockquote></details> </blockquote></details> --- <details> <summary>ℹ️ Review info</summary> <details> <summary>⚙️ Run configuration</summary> - **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `96ea5396-2f80-447b-8270-fb6c2b2af216` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 0b14de25de3789d2de2d1c220abd8090bfa2091c and a39d5c690de48353696c0ce7c0e269e68b92ab32. </details> <details> <summary>📒 Files selected for processing (2)</summary> * `src/graphics/shader/recompiler/backend/spirv/spirvEmitterImage.cpp` * `tests/ShaderRecompilerComputeTests.cpp` </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 1 remain after this review. </details> <!-- This is an auto-generated comment by CodeRabbit for review status --> <!-- coderabbit-review-publication v1 publication=e7ee2e11-b1f7-45d4-98e4-4ac189f10ff7 attempt=e0de6617-af47-41f7-94de-efb6f626b36b batch=1/1 -->
Author
Owner

@⁠NeySlim on GitHub · 2026-10-14 07:09 UTC · original

Rebased on main. The stores and sample_lz landed in c11254a9 and 56738aa4; what is left is the UNORM to float conversion for image_load and gathers, with a test for each.

**@⁠NeySlim** on GitHub · 2026-10-14 07:09 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1115#issuecomment-6162937540) Rebased on main. The stores and sample_lz landed in c11254a9 and 56738aa4; what is left is the UNORM to float conversion for image_load and gathers, with a test for each.
Author
Owner

@⁠NeySlim on GitHub · 2026-10-16 17:46 UTC · original

Closing: 1905b28b3 decodes 11_11_10 UNORM image loads through the shared conversion, which covers what God of War needed here. Gathers are the only part left, and main rejects them on purpose for now. I'll send that separately if a game actually hits it.

**@⁠NeySlim** on GitHub · 2026-10-16 17:46 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1115#issuecomment-6221360046) Closing: 1905b28b3 decodes 11_11_10 UNORM image loads through the shared conversion, which covers what God of War needed here. Gathers are the only part left, and main rejects them on purpose for now. I'll send that separately if a game actually hits it.

Pull request closed

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