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

Merged
milescoviello merged 1 commit from upstream-pr/22534 into main 2026-11-21 11:03:11 +00:00
milescoviello commented 2026-11-17 19:34:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-11-17T19:34:13Z.


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 (dbf176f2ef) 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 9d6b917388 (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 aa18d259c5, 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 b179497cf5; PR 5e54d3fb1e (b179497cf5 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 #16802 (with #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
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5363643205 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/22534). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-11-17T19:34:13Z. --- ### 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 (dbf176f2ef) 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 9d6b917388 (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](https://github.com/milescoviello/AnyPS5/releases/download/cd-stack3-1120/cd-stack3-600s.png), [D#16802 post](https://github.com/boykopovar/AnyPS5/discussions/16802#discussioncomment-19788998)). 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 aa18d259c5, 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` b179497cf5; PR `5e54d3fb1e` (b179497cf5 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](https://github.com/boykopovar/AnyPS5/pull/22534#issuecomment-6995933536) 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](https://github.com/boykopovar/AnyPS5/pull/22534#issuecomment-7014261181) 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 - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) and the licence notice of code adapted from upstream (see AGENTS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: PPSA25286 #16802 (with #22609 for the next stop; see Tested) - [x] 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) - [x] AI-assisted: yes
MarcZX10 commented 2026-11-18 14:17:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-18T14:17:18Z.

Review: APPROVED


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.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5958375593 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/22534#pullrequestreview-5958375593). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-18T14:17:18Z. **Review:** APPROVED --- # 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.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!22534
No description provided.