graphics: store write-only R16G16 signed images through their unsigned view #2363
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!2363
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2363"
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-11-17 22:11 UTC · original
Nawid3333:fix/storage-sint16x2-writes→main· +72 −5 · 4 files · 1 commits · openProblem
Ark: Survival Ascended (#281, #1986) stops when it creates a compute pipeline:
Format 28 is
k16_16SInt. For written signed storage images,c88f05f7bbinds the unsigned twin view and converts in the shader (RawSignedStorageFormat, ShaderIR.h), but only fork32SInt(write-only or 32-bit atomic) and write-onlyk16SInt. A two-channel signed 16-bit image therefore has no storage view.Change
RawSignedStorageFormatalso maps a write-only, non-atomick16_16SIntimage tok16_16UInt.BuildResourceSpecializationsetsconversion_formatfor every raw signed view exceptk32UInt, not only fork16UInt.StoreTexelthen encodes each of the two channels throughEncodeFormattedStoreComponent, which clamps signed channels narrower than 32 bits to their range, as it does for R16.k16_16SIntimages that are read or used atomically keep failing as before.Tests
resource_materialization_tests:TestSignedStorageSpecializationaddsk16_16SIntto both loops (viewk16_16UInt, guest format kept as the conversion format, numeric class Uint, binding reused). On main39936ffa3it fails withstorage image descriptor 0 uses unsupported format 28; with the change all cases pass.shader_recompiler_compute_tests: newCheckSigned16x2ImageStorewrites two different 32-bit values per lane into X and Y of an R16G16 image (wave 32 and 64), coveringINT32_MIN,-32769,-32768,-1,0,32767,32768,INT32_MAXin both channels, masked lanes and out-of-bounds lanes. With--packed-texture-onlyon an RX 9070 XT (Windows 11, with the harness change of #2038): it passes with the change; on main39936ffa3it fails at resource materialization (storage image descriptor 0 uses unsupported format 28). With the change,ImageLoadPackedUnormD16andImageLoadPackedUnormD16Sparsefail (off by one f16 ulp), as they did without it on2638b1b07; the other checks of that selector pass.shader_cfg_tests: same output with and without the change.Rebased onto main
39936ffa3: the only conflict wasBuildResourceSpecialization, where0a87c6cf8moved the swizzle block after theconversion_formatline; 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.
@coderabbitai[bot] on GitHub · 2026-11-17 22:16 UTC · original · edited 2026-11-21 19:31 UTC
No actionable comments were generated in the recent review.
Walkthrough
The raw signed storage format mapping now includes
k16_16SIntfor written, unread, non-atomic images. Resource specialization sets the conversion format to the descriptor format for raw signed formats exceptk32UInt. Tests cover format selection and signed two-channel 16-bit image stores, including saturation, masked lanes, and out-of-bounds stores.Suggested reviewers:
nmzik,claxten10Change: Bug fix
Merge Risk:
Minimal · up to
52d88This 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:
4
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
b3148820-71c2-43d1-b71a-fa4b1d81b1ffReviewing files that changed from the base of the PR and between
bd2cffb219and52d88c0828.src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpptests/ResourceMaterializationTests.cpptests/ShaderRecompilerComputeTests.cppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.