graphics: store write-only R16G16 signed images through their unsigned view #2363

Open
github-bot wants to merge 1 commit from github-bot/gh-2363 into main AGit
Owner

@⁠Nawid3333 on GitHub · 2026-11-17 22:11 UTC · original
Nawid3333:fix/storage-sint16x2-writes → main · +72 −5 · 4 files · 1 commits · open

Problem

Ark: Survival Ascended (#281, #1986) stops when it creates a compute pipeline:

shader resource specialization failed: storage image descriptor 1 uses unsupported format 28

Format 28 is k16_16SInt. For written signed storage images, c88f05f7b binds the unsigned twin view and converts in the shader (RawSignedStorageFormat, ShaderIR.h), but only for k32SInt (write-only or 32-bit atomic) and write-only k16SInt. A two-channel signed 16-bit image therefore has no storage view.

Change

  • RawSignedStorageFormat also maps a write-only, non-atomic k16_16SInt image to k16_16UInt.
  • BuildResourceSpecialization sets conversion_format for every raw signed view except k32UInt, not only for k16UInt. StoreTexel then encodes each of the two channels through EncodeFormattedStoreComponent, which clamps signed channels narrower than 32 bits to their range, as it does for R16.
  • k16_16SInt images that are read or used atomically keep failing as before.

Tests

  • resource_materialization_tests: TestSignedStorageSpecialization adds k16_16SInt to both loops (view k16_16UInt, guest format kept as the conversion format, numeric class Uint, binding reused). On main 39936ffa3 it fails with storage image descriptor 0 uses unsupported format 28; with the change all cases pass.
  • shader_recompiler_compute_tests: new CheckSigned16x2ImageStore writes two different 32-bit values per lane into X and Y of an R16G16 image (wave 32 and 64), covering INT32_MIN, -32769, -32768, -1, 0, 32767, 32768, INT32_MAX in both channels, masked lanes and out-of-bounds lanes. With --packed-texture-only on an RX 9070 XT (Windows 11, with the harness change of #2038): it passes with the change; on main 39936ffa3 it fails at resource materialization (storage image descriptor 0 uses unsupported format 28). With the change, ImageLoadPackedUnormD16 and ImageLoadPackedUnormD16Sparse fail (off by one f16 ulp), as they did without it on 2638b1b07; the other checks of that selector pass.
  • shader_cfg_tests: same output with and without the change.

Rebased onto main 39936ffa3: the only conflict was BuildResourceSpecialization, where 0a87c6cf8 moved the swizzle block after the conversion_format line; the new line stays before it, so a converted R16G16 view keeps its descriptor swizzle as an R16 view does. Fork CI on this head: run 44941030145: Windows, Linux and macOS builds pass.

In a game

@⁠Crispy81 ran Ark: Survival Ascended with the fork build of this change (run 44169933407, official 2638b1b + this change): the game runs again (#1986). That build has the same source change as this head; compared with it, this head only adds the GPU test.

Written with Claude Code (AI): Claude Code wrote the change and the materialization test from the report and ran the tests; Codex drafted the GPU test, which Claude Code reviewed and ran.

**@⁠Nawid3333** on GitHub · 2026-11-17 22:11 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2363) `Nawid3333:fix/storage-sint16x2-writes` → `main` · +72 −5 · 4 files · 1 commits · open ## Problem Ark: Survival Ascended (#281, #1986) stops when it creates a compute pipeline: ``` shader resource specialization failed: storage image descriptor 1 uses unsupported format 28 ``` Format 28 is `k16_16SInt`. For written signed storage images, c88f05f7b binds the unsigned twin view and converts in the shader (`RawSignedStorageFormat`, ShaderIR.h), but only for `k32SInt` (write-only or 32-bit atomic) and write-only `k16SInt`. A two-channel signed 16-bit image therefore has no storage view. ## Change - `RawSignedStorageFormat` also maps a write-only, non-atomic `k16_16SInt` image to `k16_16UInt`. - `BuildResourceSpecialization` sets `conversion_format` for every raw signed view except `k32UInt`, not only for `k16UInt`. `StoreTexel` then encodes each of the two channels through `EncodeFormattedStoreComponent`, which clamps signed channels narrower than 32 bits to their range, as it does for R16. - `k16_16SInt` images that are read or used atomically keep failing as before. ## Tests - `resource_materialization_tests`: `TestSignedStorageSpecialization` adds `k16_16SInt` to both loops (view `k16_16UInt`, guest format kept as the conversion format, numeric class Uint, binding reused). On main 39936ffa3 it fails with `storage image descriptor 0 uses unsupported format 28`; with the change all cases pass. - `shader_recompiler_compute_tests`: new `CheckSigned16x2ImageStore` writes two different 32-bit values per lane into X and Y of an R16G16 image (wave 32 and 64), covering `INT32_MIN`, `-32769`, `-32768`, `-1`, `0`, `32767`, `32768`, `INT32_MAX` in both channels, masked lanes and out-of-bounds lanes. With `--packed-texture-only` on an RX 9070 XT (Windows 11, with the harness change of #2038): it passes with the change; on main 39936ffa3 it fails at resource materialization (`storage image descriptor 0 uses unsupported format 28`). With the change, `ImageLoadPackedUnormD16` and `ImageLoadPackedUnormD16Sparse` fail (off by one f16 ulp), as they did without it on 2638b1b07; the other checks of that selector pass. - `shader_cfg_tests`: same output with and without the change. Rebased onto main 39936ffa3: the only conflict was `BuildResourceSpecialization`, where 0a87c6cf8 moved the swizzle block after the `conversion_format` line; the new line stays before it, so a converted R16G16 view keeps its descriptor swizzle as an R16 view does. Fork CI on this head: [run 44941030145](https://github.com/Nawid3333/KytyPS5/actions/runs/44941030145): Windows, Linux and macOS builds pass. ## In a game @⁠Crispy81 ran Ark: Survival Ascended with the fork build of this change ([run 44169933407](https://github.com/Nawid3333/KytyPS5/actions/runs/44169933407), official `2638b1b` + this change): the game runs again (#1986). That build has the same source change as this head; compared with it, this head only adds the GPU test. Written with Claude Code (AI): Claude Code wrote the change and the materialization test from the report and ran the tests; Codex drafted the GPU test, which Claude Code reviewed and ran.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:18:54 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-11-17 22:16 UTC · original · edited 2026-11-21 19:31 UTC

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The raw signed storage format mapping now includes k16_16SInt for written, unread, non-atomic images. Resource specialization sets the conversion format to the descriptor format for raw signed formats except k32UInt. Tests cover format selection and signed two-channel 16-bit image stores, including saturation, masked lanes, and out-of-bounds stores.

Suggested reviewers: nmzik, claxten10

Change: Bug fix

Merge Risk: Minimal · up to 52d88

This change lets write-only signed two-channel 16-bit storage images be stored through their unsigned view, with per-channel signed clamping. No concrete defect was found, and tests cover both format selection and the store behavior. Merge risk is minimal.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title states the main change: write-only R16G16 signed storage images are stored through their unsigned view. The raw summary confirms the change maps write-only, non-atomic k16_16SInt images to k…
Description check Passed The description explains the problem (format 28, k16_16SInt unsupported for compute pipeline creation), the change to RawSignedStorageFormat and BuildResourceSpecialization, the new and updated tests,…
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.
Full details: Title check

Explanation

The title states the main change: write-only R16G16 signed storage images are stored through their unsigned view. The raw summary confirms the change maps write-only, non-atomic k16_16SInt images to k16_16UInt and sets conversion_format for raw signed views. The title is specific and matches the changeset, so it passes.

Full details: Description check

Explanation

The description explains the problem (format 28, k16_16SInt unsupported for compute pipeline creation), the change to RawSignedStorageFormat and BuildResourceSpecialization, the new and updated tests, and the in-game validation. It matches the changeset closely, so the check passes.

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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between bd2cffb219 and 52d88c0828.

Files selected for processing: 3

  • src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp
  • tests/ResourceMaterializationTests.cpp
  • tests/ShaderRecompilerComputeTests.cpp

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

**@⁠coderabbitai[bot]** on GitHub · 2026-11-17 22:16 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2363#issuecomment-6962583859) · edited 2026-11-21 19:31 UTC <!-- coderabbit-ai-generated:v1 --> <!-- 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/2363?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-buttons-v1/explain-change-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-buttons-v1/explain-change.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-buttons-v1/explain-change.svg" alt="Explain Change →" height="32"></picture></a> <!-- review_stack_entry_end --> <!-- recent_review_status_start --> No actionable comments were generated in the recent review. <!-- recent_review_status_end --> <!-- walkthrough_start --> <details> <summary><strong>Walkthrough</strong></summary> <dl> <dd> <br> The raw signed storage format mapping now includes `k16_16SInt` for written, unread, non-atomic images. Resource specialization sets the conversion format to the descriptor format for raw signed formats except `k32UInt`. Tests cover format selection and signed two-channel 16-bit image stores, including saturation, masked lanes, and out-of-bounds stores. **Suggested reviewers:** `nmzik`, `claxten10` </dd> </dl> </details> <!-- walkthrough_end --> <!-- change_assessment_start --> <!-- change_assessment_commit:"52d88c08281e419f3e38791c09b67a6a774733ea" --> <!-- change_assessment_priority:{"version":1,"urgency":"p1","manual":false} --> **Change:** Bug fix <!-- change_assessment_end --> <details> <summary><strong>Merge Risk:</strong> <strong><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/risk-unassessed-16.svg" width="16" height="16" align="absmiddle" alt=""></picture> Minimal</strong> · up to <code>52d88</code></summary> <dl> <dd> <br> <!-- final_review_risk_start --> <!-- final_review_risk_label **Merge Risk:** **⚪ Minimal** · up to `52d88` --> <!-- final_review_risk_coverage:{"sourceCommitId":"52d88c08281e419f3e38791c09b67a6a774733ea","coveredCommitId":"52d88c08281e419f3e38791c09b67a6a774733ea","kind":"reviewed"} --> This change lets write-only signed two-channel 16-bit storage images be stored through their unsigned view, with per-channel signed clamping. No concrete defect was found, and tests cover both format selection and the store behavior. Merge risk is minimal. <!-- 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</strong></summary> <dl> <dd> <br> | Check name | Status | Explanation | | :------------------------ | :--------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Title check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The title states the main change: write-only R16G16 signed storage images are stored through their unsigned view. The raw summary confirms the change maps write-only, non-atomic k16_16SInt images to k… | | Description check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The description explains the problem (format 28, k16_16SInt unsupported for compute pipeline creation), the change to RawSignedStorageFormat and BuildResourceSpecialization, the new and updated tests,… | | 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. | <details> <summary><strong>Full details: Title check</strong></summary> <dl> <dd> <br> **Explanation** The title states the main change: write-only R16G16 signed storage images are stored through their unsigned view. The raw summary confirms the change maps write-only, non-atomic k16_16SInt images to k16_16UInt and sets conversion_format for raw signed views. The title is specific and matches the changeset, so it passes. </dd> </dl> </details> <details> <summary><strong>Full details: Description check</strong></summary> <dl> <dd> <br> **Explanation** The description explains the problem (format 28, k16_16SInt unsupported for compute pipeline creation), the change to RawSignedStorageFormat and BuildResourceSpecialization, the new and updated tests, and the in-game validation. It matches the changeset closely, so the check passes. </dd> </dl> </details> </dd> </dl> </details> <!-- pre_merge_checks_walkthrough_end --> <!-- tips_start --> Thanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=KytyPS5/KytyPS5&utm_content=2363)! 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> <br> - [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> <!-- tips_end --> <!-- recent_review_start --> <h6> <details> <summary><strong><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/info.svg" width="12" height="12" align="absmiddle" alt=""></picture> Recent review info</strong></summary> <dl> <dd> <br> <!-- review_info_content --> <details> <summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/cog-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/cog.svg" width="16" height="16" align="absmiddle" alt=""></picture> Run configuration</strong></summary> <dl> <dd> <br> - **Source mode**: Auto - **Repository**: [KytyPS5/KytyPS5](<https://github.com/KytyPS5/KytyPS5>) - **Branch**: [main](<https://github.com/KytyPS5/KytyPS5/tree/main>) - **File**: [.coderabbit.yaml](<https://github.com/KytyPS5/KytyPS5/blob/39936ffa39237997080f8d169370667ca63d12fa/.coderabbit.yaml>) - **Commit**: [39936ff](<https://github.com/KytyPS5/KytyPS5/commit/39936ffa39237997080f8d169370667ca63d12fa>) - **Layers**: Repository YAML - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `b3148820-71c2-43d1-b71a-fa4b1d81b1ff` </dd> </dl> </details> <details> <summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/git-commit-horizontal-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/git-commit-horizontal.svg" width="16" height="16" align="absmiddle" alt=""></picture> Commits</strong></summary> <dl> <dd> <br> Reviewing files that changed from the base of the PR and between bd2cffb219f49e1ea04e44b729dc54f41fdf67d7 and 52d88c08281e419f3e38791c09b67a6a774733ea. </dd> </dl> </details> <details> <summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-plus-corner-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-plus-corner.svg" width="16" height="16" align="absmiddle" alt=""></picture> Files selected for processing: 3</strong></summary> <dl> <dd> <br> * `src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp` * `tests/ResourceMaterializationTests.cpp` * `tests/ShaderRecompilerComputeTests.cpp` </dd> </dl> </details> **Included review availability:** This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. </dd> </dl> </details> </h6> <!-- recent_review_end -->
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2363/head:github-bot/gh-2363'
git switch 'github-bot/gh-2363'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2363'
git switch 'github-bot/gh-2363'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2363'
git switch 'github-bot/gh-2363'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2363'
git switch 'main'
git merge --squash 'github-bot/gh-2363'
git switch 'main'
git merge --ff-only 'github-bot/gh-2363'
git switch 'main'
git merge 'github-bot/gh-2363'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.