Skip to content

fix(shader): give converted image stores the cube-face mode again - #22534

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
milescoviello:fix/shader-cube-face-converted-store
Nov 21, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
milescoviello:fix/shader-cube-face-converted-store

Conversation

@milescoviello

@milescoviello milescoviello commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

What

Crimson Desert (PPSA25286) stops on current main with compute shader 0x22946ac100: image descriptor is incompatible with the static runtime image interface: descriptor format 71 decodes to {class 2, dim 5, conversion 71, ..., cube 1, ...}. The exception escapes the queue and terminates the title (EXIT-134).

The shader does a DIM 2D image_store to a cube T# in 16_16_16_16_FLOAT. My #6799 change (dbf176f) gave that store a runtime mode for exactly this case: it writes texel (x, y) of the T#'s BASE_ARRAY face, as measured on RDNA2 for 32_UINT, 32_FLOAT and 16_16_16_16_FLOAT. That mode is offered only when the store has no format conversion.

Since 9d6b917 (round 16-bit float image stores toward zero), 16-bit float stores go through a conversion mode (conversion 71 for 16_16_16_16_FLOAT). So the cube-face mode no longer matches, and the store throws again.

The change in RuntimeImageModes:

  • The cube-face mode is now offered for a converted format when the store is the kind the face mode accepts: a write-only, mip-less storage image. That matches the line mode, which already takes converted write-only stores.
  • The conversion only changes how the texel value is encoded, and the face mode only changes which layer is addressed, so the two compose.
  • 32_SINT, which the face mode used to refuse, now takes it with its conversion. The debt entry records it as measured on gfx1036 storing the data dword unconverted, which the conversion does.

Accesses that read the image, atomics, mip stores, gathers and the rest still throw, as before.

Tested

11-20, title run past the stop: main 93f62d93f8 plus this PR, #22609, #22778, #23864, #23880, #22690 and #22703 (all mine) runs Crimson Desert (PPSA25286) for the whole 602 s and reaches the settings menu over the title screen at about 1.7 fps (shot at 600 s, D#16802 post). All 12 rotation runs on main since 11-19 end on the format-71 cube store this PR fixes, 196 to 301 s in. I haven't checked which of the other six PRs that run needed.

Linux (Ubuntu 26.04.1, kernel 7.0), GCC 15.2, Ninja, Release, -DBUILD_TESTING=ON, RTX 4070 Ti on NVIDIA 615.71:

  • agc_driver_image_store_face_on_cube gains 32_SINT (format 21) and 16_16_16_16_FLOAT (format 71) next to 32_UINT and 32_FLOAT, at BASE_ARRAY 0 and 6. For the 8-byte format it checks the whole texel: the stored value rounded toward zero to half precision in the first component, zero in the other three. Every byte outside the face must stay unchanged.
  • That test, agc_driver_image_store_float_rounding, agc_driver_image_store_float_rounding_codegen and agc_shader_memory (whose image-mode refusals still throw) pass, 3 runs.
  • Negative control: with main's ResourceMaterializer.cpp and the extended test, agc_driver_image_store_face_on_cube fails.

Windows 11 (VM, GeForce GT 1030, WinLibs GCC 16.2, Ninja, Release, ANYPS5_REQUIRE_VULKAN=1): agc_driver_image_store_face_on_cube, agc_driver_image_store_float_rounding and agc_driver_image_store_float_rounding_codegen pass 3 runs on aa18d25, the pre-squash commit with this tree.

Crimson Desert (PPSA25286), Linux, RTX 4070 Ti: offline (APS5_NET_DISCONNECTED=1), 22G cap, 300 s, warm shader cache. Base main b179497; PR 5e54d3fb1e (b179497 with this commit cherry-picked).

run build end cube-store error
1 base EXIT-134 at 224 s, terminate yes
2 base EXIT-134 at 73 s, terminate yes
3 PR ran the full 307 s none
4 PR EXIT-134 at 172 s on the next stop, AGC graphics: unsupported color format 9 number type 4 component swap 0 (a 2_10_10_10 UINT colour target), after a second present none

So with this change the title gets past the cube store and stops later, on an unrelated colour format (#22609 handles that one). The screen is still black after the first present in every run, so I'm not claiming any visible progress.

Still needed on current main 6119c53c4b (11-18, a build with #22778 merged for another test, PLAY=1 presses): Crimson Desert stops on this same error (descriptor format 71 decodes to {class 2, dim 5, conversion 71, ..., cube 1}, compute shaders 0x21d4db4100 and 0x21546a4100) at 509 s with a cold shader cache and at 89 s with a warm one. Builds with this PR, #22609, #22690 and #22778 on main 604828bd44 ran Crimson Desert past it to the 600 s timeout five times.

  • git merge-tree against main is clean. tools/check_conventions.py passes on the branch and this body, and tools/debt_fold.py --check reports nothing for this fragment.
  • rafaconvaitis's Windows + AMD run of be7ab63e59 merged onto main 9a50e1014e (Radeon 760M, AMD Software 26.11.2, WinLibs GCC 15.2.0, Khronos validation layer 1.4.363): agc_driver_image_store_face_on_cube passes 3/3 on both sides with no VUID- lines; with this PR's test on main's sources it fails with image descriptor is incompatible with the static runtime image interface.
  • Colewiz7's Linux RADV run of be7ab63e59 merged onto main 7c836568c8 (Mesa 26.2.6, RX 7900 XT and 7800X3D iGPU, Khronos validation layer 1.4.363.1): no new failures against main in the full suite on the 7900 XT or the GPU tests on the iGPU, and no VUID- or SYNC-HAZARD lines.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt and the licence notice of code adapted from upstream (see AGENTS.md)
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: PPSA25286 Crimson Desert (PPSA25286) #16802 (with feat(agc): draw into 2_10_10_10 UINT color targets #22609 for the next stop; see Tested)
  • GPUs tested: NVIDIA RTX 4070 Ti (Linux), NVIDIA GeForce GT 1030 (Windows), AMD Radeon 760M (Windows, rafaconvaitis), AMD RX 7900 XT and 7800X3D iGPU (Linux RADV, Colewiz7)
  • AI-assisted: yes

A DIM 2D image_store to a cube T# writes texel (x, y) of the T#'s
BASE_ARRAY face, through the cube-face runtime mode boykopovar#6799 added. That
mode is offered only to stores without a format conversion. Since
9d6b917 rounds 16-bit float image stores toward zero through a
conversion, a 16_16_16_16_FLOAT cube store had no matching mode again
and threw "image descriptor is incompatible with the static runtime
image interface". Crimson Desert's compute shader 0x22946ac100 does
this and terminates.

The cube-face mode is now offered for a converted format when the
store is a write-only storage image, as the line mode already is. The
conversion encodes the texel and the face mode picks the layer, so the
two compose. 32_SINT, measured on gfx1036 to store its data dword
unconverted, takes the mode too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 20982 core/libs/prx/libSceAgcDriver/tests/execution/ImageStoreFaceOnCube.cpp L76, L79-81, L93-94, L112, L114, L162-167
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp L2370

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 5371 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
PR 6280 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
PR 6412 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
PR 6488 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
PR 7085 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
PR 7395 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
PR 7642 core/libs/prx/libSceAgcDriver/tests/execution/ImageStoreFaceOnCube.cpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
PR 7684 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
PR 7689 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
PR 8939 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
PR 9508 core/libs/prx/libSceAgcDriver/tests/execution/ImageStoreFaceOnCube.cpp
PR 9633 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
PR 9749 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
PR 9790 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
PR 9969 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
PR 10193 core/libs/prx/libSceAgcDriver/tests/execution/ImageStoreFaceOnCube.cpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
PR 11551 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
PR 13928 core/libs/prx/libSceAgcDriver/tests/execution/ImageStoreFaceOnCube.cpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
PR 13929 core/libs/prx/libSceAgcDriver/tests/execution/ImageStoreFaceOnCube.cpp
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
PR 14853 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
PR 14871 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
PR 15555 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
PR 16260 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
PR 16472 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
PR 16631 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
PR 16812 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
PR 16814 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
PR 18106 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
PR 18107 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
PR 20248 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
PR 20519 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
PR 21199 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
PR 22424 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
PR 23242 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
PR 23409 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — looks good

Nothing blocks this change; the optional point below is informational.

What I ran

Reviewed head be7ab63e591fc8d532ad103f7d30b9d453e22059. I read the PR description, commit summary, manifest, diff, and all three changed files. The author reports tests and a clean merge-tree check; I did not run commands or tests.

Results

Check Result Note
Changed code review passed All three changed files read
Tests and merge check not run Results supplied by the author only

Findings

Blocking

None.

Non-blocking

  • The test's Wanted helper derives the expected 16-bit float value from the known Value bit pattern. The resulting values appear to be exactly representable, so this checks encoding and component layout but does not independently exercise rounding toward zero for an inexact half value. A test with a value between half-precision values would directly cover the rounding behavior described in the PR.

Not verified

I did not run tests, inspect CI output, or independently verify the reported GPU and game runs. No changed files were excluded; all changed files listed in the manifest were read.

To get this to a good state

Nothing is required. The rounding test suggestion is optional.

@domx4q

domx4q commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Ran the description's tests on Linux and NVIDIA's proprietary driver with the Khronos validation layer loaded; the Linux run in the description does not mention the layer.

Setup: Arch Linux (kernel 7.3.4), GCC 16.2.1, Release, NVIDIA GeForce RTX 4090 (vendor 0x10de, device 0x2684, Ada), proprietary driver 620.70.06, Vulkan 1.4.357, Khronos validation layer 1.4.363.1. Head be7ab63e59 merged onto main e4caa07950 with --no-ff, clean merge. Main baseline is a Release build of e4caa07950 on the same machine. The branch already contains main up to e238898fc6, so the merged tree also carries those commits.

ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer \
ctest --test-dir build -R '^(agc_driver_image_store_face_on_cube|agc_driver_image_store_float_rounding|agc_driver_image_store_float_rounding_codegen|agc_shader_memory)$' -V
main e4caa07950 this PR
Result 4/4 passed 4/4 passed
Insert instance layer "VK_LAYER_KHRONOS_validation" 2 2
was not found but was requested by env var VK_INSTANCE_LAYERS 0 0
VUID- none none

The two GPU tests (agc_driver_image_store_face_on_cube, agc_driver_image_store_float_rounding) log Selected GPU name=NVIDIA GeForce RTX 4090 on both sides; the other two do not create a device. On main the face test runs its old formats only.

Negative control: the merged tree with main's ResourceMaterializer.cpp and the extended test fails agc_driver_image_store_face_on_cube with image descriptor is incompatible with the static runtime image interface: descriptor format 21 decodes to {class 2, dim 5, conversion 21, packed 0, cube 1, ...}.

No new VUID- errors; all focused tests pass on Ada.

AI-assisted: yes (Claude Code)

@milescoviello

Copy link
Copy Markdown
Contributor Author

Thanks @MarcZX10 and @domx4q (the Ada run with the validation layer, and the negative control on format 21).

On the rounding point: the half values aren't exactly representable. Value is 0x3f000000 + tid * 0x1357, so every texel except tid 0 has a non-zero low 13 bits. Half precision drops those bits. 0x1357 is odd, so tid * 0x1357 is never a multiple of 0x2000 for tids 1 to 63. Wanted keeps only mantissa >> 13, which is rounding toward zero. Round-to-nearest gives a different half for every tid whose dropped bits are 0x1000 or more, starting at tid 1 (0x1357). So a store that rounded to nearest would fail the 16_16_16_16_FLOAT case at both BASE_ARRAY values. agc_driver_image_store_float_rounding from 9d6b917 keeps the wider rounding coverage (ties, negatives, overflow); this test only checks that the cube-face mode keeps it.

AI-assisted: yes (Claude Code)

@rafaconvaitis

Copy link
Copy Markdown
Contributor

Windows + AMD run; I found no AMD run in the description or in the comments. Head be7ab63e59 merged alone onto main 9a50e1014e with git merge --no-ff (clean merge).

Setup: Windows 11 25H2 (build 26200), AMD Radeon 760M integrated graphics (1002:15bf, Vulkan device name Radeon 5), AMD Software 26.11.2 (driver 32.0.32029.2010, Vulkan 1.4.359), selected with ANYPS5_GPU=Radeon, WinLibs GCC 15.2.0 r7 UCRT, Release, BUILD_TESTING=ON, Khronos validation layer 1.4.363 (LunarG SDK 1.4.363.1). Only the focused test targets were built; the other execution tests were left out with ANYPS5_AGC_EXECUTION_TESTS.

ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer, ctest -R '^(agc_driver_image_store_face_on_cube)$' -V -j 1, 3 runs per side.

test main this PR this PR's tests on main's sources (1 run)
agc_driver_image_store_face_on_cube passes 3/3 passes 3/3 fails
  • Negative control: with the tests of this PR built on main's sources (without the 1 production file this PR changes), agc_driver_image_store_face_on_cube does not pass, so on this driver the test detects the change. It fails with a ShaderRecompiler::Recompile error, image descriptor is incompatible with the static runtime image interface.
  • VUID- lines: 0 in the main and PR logs. Every run logs Selected GPU name=Radeon 5 vendor=0x1002 device=0x15bf and Insert instance layer "VK_LAYER_KHRONOS_validation", and none logs was not found but was requested.

AI-assisted: yes (build and runs scripted with an AI assistant, on the hardware above).

@milescoviello

Copy link
Copy Markdown
Contributor Author

Thanks @rafaconvaitis for the Windows + AMD run with the validation layer, the first AMD result on this PR, and for the negative control on main's sources. I've added it to the Tested section, linked to your comment, and the Radeon 760M to the GPUs tested line.

@Colewiz7

Copy link
Copy Markdown
Contributor

Head be7ab63e59 merged onto main 7c836568c8 as 096777e1c8, no conflict. Linux 7.3.4, GCC 16.2.1 Release, Mesa 26.2.6 RADV, RX 7900 XT (gfx1100) and 7800X3D iGPU (gfx1036).

No new failures and no new validation messages on either GPU.

RX 7900 XT iGPU
tests run (6206 on the 7900 XT, the 2007 GPU ones on the iGPU), new failures vs main none none
-R '^agc' (1940 tests) with the layer, new failures vs main none none
VUID- / SYNC-HAZARD lines 0 / 0 0 / 0

Layer runs used VK_LAYER_KHRONOS_validation 1.4.363.1 with VK_LOADER_DEBUG=layer and ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1; the loader inserted the layer in every run, and the set of distinct validation messages matches main.

AI-assisted: yes

@milescoviello

Copy link
Copy Markdown
Contributor Author

@Colewiz7 thanks for running be7ab63e59 on RADV with the RX 7900 XT and the iGPU: no new failures and no VUID- or SYNC-HAZARD lines on either. Added to Tested and to the GPUs tested line.

AI-assisted: yes

This was referenced Nov 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* docs shader core/shader unblocks title Names a title ID on the Unblocks line

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants