feat(shader): decode PS4 (GCN) shaders by re-encoding them to RDNA #9430

Merged
Get-fix merged 3 commits from upstream-pr/9430 into main 2026-10-22 11:31:29 +00:00
Get-fix commented 2026-10-21 21:51:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Get-fix on 2026-10-21T21:51:01Z.


What

Part 2 of the PS4 Limbo stack, split out of #6977 for the AGC reviewers (the whole stack is listed in #6978). PS4 shaders do not get a second recompiler: each GCN (Sea Islands) instruction is re-encoded to its RDNA encoding and decoded by the existing RDNA decoder, so control flow, SPIR-V emission and the shader disk cache run PS4 shaders unchanged.

  • GcnInstructionDecoder.cpp with opcode tables generated from shadPS4's opcodes.h (GPL-2.0-or-later; opcode numbers, no code); encodings without an RDNA counterpart throw.
  • PS4 legacy vertex shaders: user data from s0, vertex index in v0, instance index in v1-v3; fetch shaders called through the user pair (s_swappc_b64 s[0:1], s[0:1]) return through it.
  • MIMG without a DIM field: 2D, or 2D array when DA is set; the materializer rejects a T# whose type needs another address count.
  • PS4 V#: GCN DATA_FORMAT/NUM_FORMAT (named from the most significant field) to the unified format, OOB_SELECT from the stride as Mesa's GFX6-7 range rules, and a 44-bit base (Limbo leaves 0x7 in word 1 bits 15:12). PS4 T#: PS5 layout with the GCN tiling index, POW2_PAD and pitch kept in word 7 for the AGC driver.
  • s_setreg_imm32_b32 keeps its literal word, from javierUDP's review of #6977 and savvaniss's decode case (both are co-authors of that commit); the new agc_gcn_decode test decodes the reported stream.
  • Everything PS4-only is behind GcnGuestShaders(), which is keyed into the shader disk cache, so PS5 titles take the paths they took before. That includes the user-data pointer check in unchangedUntil (a13d01bcc): a scalar write at the s_load that reads the pointer is skipped only for PS4 shaders, and PS5 shaders keep main's rule.

The facts that come from public sources rather than console measurements are in docs/dev/debt/shader.md.

Tested

Windows 11, WinLibs GCC 15.2, NVIDIA GeForce RTX 5060 Ti (driver 610.88), on main 7e2ba73e4:

  • agc_gcn_decode (new): the stream from the review, {0xba80f801, 0x12345678, 0xbf810000}, decodes as s_setreg_imm32_b32 in two words with 0x12345678 in source0, and s_movk_i32 stays one word. Without the fix the test fails with literal operand word is out of the code span bounds.
  • agc_driver_graphics: every GCN DATA_FORMAT/NUM_FORMAT pair maps to at most one unified buffer format, and each unified format comes from exactly one pair.
  • This branch alone: of the 914 AGC, shader, recompiler and VideoOut tests in the validation run below, 908 pass and 3 skip for device features this GPU lacks. The 3 that fail also fail on main 7e2ba73e4 on this machine: agc_driver_sample_order and its --grid-reference and --recipe-depth-locations cases.
  • With #9431 and #9432 on top: the full suite of 1,893 tests: 1,886 pass and 4 skip, the same 4 that skip on main. The 3 that fail also fail on main 7e2ba73e4 on this machine: agc_driver_sample_order and its --grid-reference and --recipe-depth-locations cases.
  • Limbo (CUSA01664) runs in game with the whole stack (see #9432); its compute, legacy vertex (with fetch shaders) and pixel shaders (with MIMG) go through this decoder.
  • Validation layer: ctest -R "^(agc|video_out|shader|recompiler|gcn)" -V with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1 and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation (Vulkan SDK 1.4.363), on main 7e2ba73e4 and on this branch alone, same machine and GPU. Both builds use -DANYPS5_VIDEO_OUT_TEST_DRIVER=windows, so the 14 VideoOut flip tests get a real display.
    • Neither log reports the layer missing.
    • main: 913 tests; 907 pass, 3 skip and 3 fail (the agc_driver_sample_order cases).
    • This branch: the same 913 tests with the same results, plus agc_gcn_decode, which passes.
    • Both logs hold the same 50 VUID- errors in the same 8 existing PS5 tests, with the same IDs and counts test for test (agc_driver_prepared_exports, the three agc_driver_sample_order cases and four others). This PR adds none.
    • The same holds with #9431 and #9432 on top.

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
  • 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 (the overlap report's entries are insertion points only; see the comment below)
  • Fixes: none
  • Unblocks: Limbo (CUSA01664) #6978, with #9431 and #9432 on top
  • GPUs tested: NVIDIA GeForce RTX 5060 Ti, driver 610.88, Windows 11
  • AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4958851799 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9430). Originally posted by [Get-fix](https://github.com/Get-fix) on 2026-10-21T21:51:01Z. --- ### What Part 2 of the PS4 Limbo stack, split out of #6977 for the AGC reviewers (the whole stack is listed in #6978). PS4 shaders do not get a second recompiler: each GCN (Sea Islands) instruction is re-encoded to its RDNA encoding and decoded by the existing RDNA decoder, so control flow, SPIR-V emission and the shader disk cache run PS4 shaders unchanged. - `GcnInstructionDecoder.cpp` with opcode tables generated from shadPS4's `opcodes.h` (GPL-2.0-or-later; opcode numbers, no code); encodings without an RDNA counterpart throw. - PS4 legacy vertex shaders: user data from s0, vertex index in v0, instance index in v1-v3; fetch shaders called through the user pair (`s_swappc_b64 s[0:1], s[0:1]`) return through it. - MIMG without a DIM field: 2D, or 2D array when DA is set; the materializer rejects a T# whose type needs another address count. - PS4 V#: GCN DATA_FORMAT/NUM_FORMAT (named from the most significant field) to the unified format, OOB_SELECT from the stride as Mesa's GFX6-7 range rules, and a 44-bit base (Limbo leaves `0x7` in word 1 bits 15:12). PS4 T#: PS5 layout with the GCN tiling index, POW2_PAD and pitch kept in word 7 for the AGC driver. - `s_setreg_imm32_b32` keeps its literal word, from javierUDP's review of #6977 and savvaniss's decode case (both are co-authors of that commit); the new `agc_gcn_decode` test decodes the reported stream. - Everything PS4-only is behind `GcnGuestShaders()`, which is keyed into the shader disk cache, so PS5 titles take the paths they took before. That includes the user-data pointer check in `unchangedUntil` (a13d01bcc): a scalar write at the `s_load` that reads the pointer is skipped only for PS4 shaders, and PS5 shaders keep `main`'s rule. The facts that come from public sources rather than console measurements are in `docs/dev/debt/shader.md`. ### Tested Windows 11, WinLibs GCC 15.2, NVIDIA GeForce RTX 5060 Ti (driver 610.88), on `main` 7e2ba73e4: - `agc_gcn_decode` (new): the stream from the review, `{0xba80f801, 0x12345678, 0xbf810000}`, decodes as `s_setreg_imm32_b32` in two words with `0x12345678` in `source0`, and `s_movk_i32` stays one word. Without the fix the test fails with `literal operand word is out of the code span bounds`. - `agc_driver_graphics`: every GCN DATA_FORMAT/NUM_FORMAT pair maps to at most one unified buffer format, and each unified format comes from exactly one pair. - This branch alone: of the 914 AGC, shader, recompiler and VideoOut tests in the validation run below, 908 pass and 3 skip for device features this GPU lacks. The 3 that fail also fail on `main` 7e2ba73e4 on this machine: `agc_driver_sample_order` and its `--grid-reference` and `--recipe-depth-locations` cases. - With #9431 and #9432 on top: the full suite of 1,893 tests: 1,886 pass and 4 skip, the same 4 that skip on `main`. The 3 that fail also fail on `main` 7e2ba73e4 on this machine: `agc_driver_sample_order` and its `--grid-reference` and `--recipe-depth-locations` cases. - Limbo (CUSA01664) runs in game with the whole stack (see #9432); its compute, legacy vertex (with fetch shaders) and pixel shaders (with MIMG) go through this decoder. - Validation layer: `ctest -R "^(agc|video_out|shader|recompiler|gcn)" -V` with `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1` and `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation` (Vulkan SDK 1.4.363), on `main` 7e2ba73e4 and on this branch alone, same machine and GPU. Both builds use `-DANYPS5_VIDEO_OUT_TEST_DRIVER=windows`, so the 14 VideoOut flip tests get a real display. - Neither log reports the layer missing. - `main`: 913 tests; 907 pass, 3 skip and 3 fail (the `agc_driver_sample_order` cases). - This branch: the same 913 tests with the same results, plus `agc_gcn_decode`, which passes. - Both logs hold the same 50 `VUID-` errors in the same 8 existing PS5 tests, with the same IDs and counts test for test (`agc_driver_prepared_exports`, the three `agc_driver_sample_order` cases and four others). This PR adds none. - The same holds with #9431 and #9432 on top. ### 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) - [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 (the overlap report's entries are insertion points only; see the comment below) - [x] Fixes: none - [x] Unblocks: Limbo (CUSA01664) #6978, with #9431 and #9432 on top - [x] GPUs tested: NVIDIA GeForce RTX 5060 Ti, driver 610.88, Windows 11 - [x] AI-assisted: yes (Claude Code) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-actions[bot] commented 2026-10-21 22:39:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-21T22:39:15Z.


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 5941 core/shader/recompiler/Translation/include/Translation/InstructionTranslator.hpp L38
PR 6009 core/shader/recompiler/Translation/include/Translation/InstructionTranslator.hpp L38
PR 6010 core/shader/recompiler/Translation/include/Translation/InstructionTranslator.hpp L38
PR 7803 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp L120
PR 8026 core/libs/prx/libSceAgcDriver/tests/TextureFormat.cpp L270
PR 8429 core/shader/recompiler/RdnaDecoder/include/RdnaDecoder/RdnaDescriptorFormat.hpp L4-5
PR 8564 docs/dev/debt/shader.md L24
PR 9020 docs/dev/debt/shader.md L24
PR 9335 docs/dev/debt/shader.md L24

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 907 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
PR 1368 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 1395 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 2434 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 4072 core/shader/recompiler/Recompiler.cpp
core/shader/recompiler/Translation/include/Translation/InstructionTranslator.hpp
core/shader/recompiler/Translation/src/InstructionTranslator.cpp
PR 5021 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/shader/recompiler/Recompiler.cpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
docs/dev/debt/shader.md
PR 5371 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
docs/dev/debt/shader.md
PR 5431 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 5609 core/shader/recompiler/Recompiler.cpp
core/shader/recompiler/ShaderDiskCache.cpp
PR 5925 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/shader/recompiler/CMakeLists.txt
core/shader/recompiler/ShaderDiskCache.cpp
PR 6044 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6187 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6188 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6192 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6209 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6235 docs/dev/debt/shader.md
PR 6280 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/ShaderDiskCache.cpp
docs/dev/debt/shader.md
PR 6292 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6300 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6412 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/Recompiler.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/SpirvBackend/src/SpirvRuntimeBuffer.cpp
docs/dev/debt/shader.md
PR 6481 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6488 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/Recompiler.cpp
core/shader/recompiler/ShaderDiskCache.cpp
docs/dev/debt/shader.md
PR 6501 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6539 core/shader/recompiler/Recompiler.cpp
core/shader/recompiler/ShaderDiskCache.cpp
PR 6615 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6642 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6788 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6808 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6868 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6879 core/shader/recompiler/CMakeLists.txt
core/shader/recompiler/Recompiler.cpp
core/shader/recompiler/ShaderDiskCache.cpp
docs/dev/debt/shader.md
PR 6924 core/shader/recompiler/Recompiler.cpp
core/shader/recompiler/ShaderDiskCache.cpp
docs/dev/debt/shader.md
PR 7201 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/shader/recompiler/CMakeLists.txt
core/shader/recompiler/Recompiler.cpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
PR 7275 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7457 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7550 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/ShaderDiskCache.cpp
PR 7604 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7622 core/shader/recompiler/CMakeLists.txt
core/shader/recompiler/ShaderDiskCache.cpp
PR 7642 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/shader/recompiler/CMakeLists.txt
core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/Recompiler.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
core/shader/recompiler/SpirvBackend/src/SpirvRuntimeBuffer.cpp
PR 7684 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/ShaderDiskCache.cpp
docs/dev/debt/shader.md
PR 7689 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/SpirvBackend/src/SpirvRuntimeBuffer.cpp
PR 7705 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 8014 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 8077 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
core/shader/recompiler/RdnaDecoder/include/RdnaDecoder/RdnaDescriptorFormat.hpp
core/shader/recompiler/RdnaDecoder/src/RdnaDescriptorFormat.cpp
core/shader/recompiler/ShaderDiskCache.cpp
docs/dev/debt/shader.md
PR 8246 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 8484 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 8527 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 8552 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 8592 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 8625 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp
docs/dev/debt/shader.md
PR 8672 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 9356 core/shader/recompiler/CMakeLists.txt
core/shader/recompiler/Recompiler.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
PR 9387 core/shader/recompiler/CMakeLists.txt
core/shader/recompiler/Recompiler.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6328125874 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9430#issuecomment-6328125874). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-21T22:39:15Z. --- <!-- pr-overlap --> 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 5941](https://www.github.com/boykopovar/AnyPS5/pull/5941) | `core/shader/recompiler/Translation/include/Translation/InstructionTranslator.hpp` [L38](https://github.com/boykopovar/AnyPS5/blob/4777caca343bf09a3fe245830acd9e9f433e8e18/core/shader/recompiler/Translation/include/Translation/InstructionTranslator.hpp#L38) | | | | [PR 6009](https://www.github.com/boykopovar/AnyPS5/pull/6009) | `core/shader/recompiler/Translation/include/Translation/InstructionTranslator.hpp` [L38](https://github.com/boykopovar/AnyPS5/blob/4777caca343bf09a3fe245830acd9e9f433e8e18/core/shader/recompiler/Translation/include/Translation/InstructionTranslator.hpp#L38) | | | | [PR 6010](https://www.github.com/boykopovar/AnyPS5/pull/6010) | `core/shader/recompiler/Translation/include/Translation/InstructionTranslator.hpp` [L38](https://github.com/boykopovar/AnyPS5/blob/4777caca343bf09a3fe245830acd9e9f433e8e18/core/shader/recompiler/Translation/include/Translation/InstructionTranslator.hpp#L38) | | | | [PR 7803](https://www.github.com/boykopovar/AnyPS5/pull/7803) | `core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp` [L120](https://github.com/boykopovar/AnyPS5/blob/4777caca343bf09a3fe245830acd9e9f433e8e18/core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp#L120) | | | | [PR 8026](https://www.github.com/boykopovar/AnyPS5/pull/8026) | `core/libs/prx/libSceAgcDriver/tests/TextureFormat.cpp` [L270](https://github.com/boykopovar/AnyPS5/blob/4777caca343bf09a3fe245830acd9e9f433e8e18/core/libs/prx/libSceAgcDriver/tests/TextureFormat.cpp#L270) | | | | [PR 8429](https://www.github.com/boykopovar/AnyPS5/pull/8429) | `core/shader/recompiler/RdnaDecoder/include/RdnaDecoder/RdnaDescriptorFormat.hpp` [L4-5](https://github.com/boykopovar/AnyPS5/blob/4777caca343bf09a3fe245830acd9e9f433e8e18/core/shader/recompiler/RdnaDecoder/include/RdnaDecoder/RdnaDescriptorFormat.hpp#L4-L5) | | | | [PR 8564](https://www.github.com/boykopovar/AnyPS5/pull/8564) | `docs/dev/debt/shader.md` [L24](https://github.com/boykopovar/AnyPS5/blob/4777caca343bf09a3fe245830acd9e9f433e8e18/docs/dev/debt/shader.md#L24) | | | | [PR 9020](https://www.github.com/boykopovar/AnyPS5/pull/9020) | `docs/dev/debt/shader.md` [L24](https://github.com/boykopovar/AnyPS5/blob/4777caca343bf09a3fe245830acd9e9f433e8e18/docs/dev/debt/shader.md#L24) | | | | [PR 9335](https://www.github.com/boykopovar/AnyPS5/pull/9335) | `docs/dev/debt/shader.md` [L24](https://github.com/boykopovar/AnyPS5/blob/4777caca343bf09a3fe245830acd9e9f433e8e18/docs/dev/debt/shader.md#L24) | | | 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 907](https://www.github.com/boykopovar/AnyPS5/pull/907) | `core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp` | | [PR 1368](https://www.github.com/boykopovar/AnyPS5/pull/1368) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 1395](https://www.github.com/boykopovar/AnyPS5/pull/1395) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 2434](https://www.github.com/boykopovar/AnyPS5/pull/2434) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 4072](https://www.github.com/boykopovar/AnyPS5/pull/4072) | `core/shader/recompiler/Recompiler.cpp`<br>`core/shader/recompiler/Translation/include/Translation/InstructionTranslator.hpp`<br>`core/shader/recompiler/Translation/src/InstructionTranslator.cpp` | | [PR 5021](https://www.github.com/boykopovar/AnyPS5/pull/5021) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt`<br>`core/shader/recompiler/Recompiler.cpp`<br>`core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp`<br>`docs/dev/debt/shader.md` | | [PR 5371](https://www.github.com/boykopovar/AnyPS5/pull/5371) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt`<br>`core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp`<br>`docs/dev/debt/shader.md` | | [PR 5431](https://www.github.com/boykopovar/AnyPS5/pull/5431) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 5609](https://www.github.com/boykopovar/AnyPS5/pull/5609) | `core/shader/recompiler/Recompiler.cpp`<br>`core/shader/recompiler/ShaderDiskCache.cpp` | | [PR 5925](https://www.github.com/boykopovar/AnyPS5/pull/5925) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt`<br>`core/shader/recompiler/CMakeLists.txt`<br>`core/shader/recompiler/ShaderDiskCache.cpp` | | [PR 6044](https://www.github.com/boykopovar/AnyPS5/pull/6044) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 6187](https://www.github.com/boykopovar/AnyPS5/pull/6187) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 6188](https://www.github.com/boykopovar/AnyPS5/pull/6188) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 6192](https://www.github.com/boykopovar/AnyPS5/pull/6192) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 6209](https://www.github.com/boykopovar/AnyPS5/pull/6209) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 6235](https://www.github.com/boykopovar/AnyPS5/pull/6235) | `docs/dev/debt/shader.md` | | [PR 6280](https://www.github.com/boykopovar/AnyPS5/pull/6280) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt`<br>`core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp`<br>`core/shader/recompiler/ShaderDiskCache.cpp`<br>`docs/dev/debt/shader.md` | | [PR 6292](https://www.github.com/boykopovar/AnyPS5/pull/6292) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 6300](https://www.github.com/boykopovar/AnyPS5/pull/6300) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 6412](https://www.github.com/boykopovar/AnyPS5/pull/6412) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt`<br>`core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp`<br>`core/shader/recompiler/Recompiler.cpp`<br>`core/shader/recompiler/ShaderDiskCache.cpp`<br>`core/shader/recompiler/SpirvBackend/src/SpirvRuntimeBuffer.cpp`<br>`docs/dev/debt/shader.md` | | [PR 6481](https://www.github.com/boykopovar/AnyPS5/pull/6481) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 6488](https://www.github.com/boykopovar/AnyPS5/pull/6488) | `core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp`<br>`core/shader/recompiler/Recompiler.cpp`<br>`core/shader/recompiler/ShaderDiskCache.cpp`<br>`docs/dev/debt/shader.md` | | [PR 6501](https://www.github.com/boykopovar/AnyPS5/pull/6501) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 6539](https://www.github.com/boykopovar/AnyPS5/pull/6539) | `core/shader/recompiler/Recompiler.cpp`<br>`core/shader/recompiler/ShaderDiskCache.cpp` | | [PR 6615](https://www.github.com/boykopovar/AnyPS5/pull/6615) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 6642](https://www.github.com/boykopovar/AnyPS5/pull/6642) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 6788](https://www.github.com/boykopovar/AnyPS5/pull/6788) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 6808](https://www.github.com/boykopovar/AnyPS5/pull/6808) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 6868](https://www.github.com/boykopovar/AnyPS5/pull/6868) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 6879](https://www.github.com/boykopovar/AnyPS5/pull/6879) | `core/shader/recompiler/CMakeLists.txt`<br>`core/shader/recompiler/Recompiler.cpp`<br>`core/shader/recompiler/ShaderDiskCache.cpp`<br>`docs/dev/debt/shader.md` | | [PR 6924](https://www.github.com/boykopovar/AnyPS5/pull/6924) | `core/shader/recompiler/Recompiler.cpp`<br>`core/shader/recompiler/ShaderDiskCache.cpp`<br>`docs/dev/debt/shader.md` | | [PR 7201](https://www.github.com/boykopovar/AnyPS5/pull/7201) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt`<br>`core/shader/recompiler/CMakeLists.txt`<br>`core/shader/recompiler/Recompiler.cpp`<br>`core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp` | | [PR 7275](https://www.github.com/boykopovar/AnyPS5/pull/7275) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 7457](https://www.github.com/boykopovar/AnyPS5/pull/7457) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 7550](https://www.github.com/boykopovar/AnyPS5/pull/7550) | `core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp`<br>`core/shader/recompiler/ShaderDiskCache.cpp` | | [PR 7604](https://www.github.com/boykopovar/AnyPS5/pull/7604) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 7622](https://www.github.com/boykopovar/AnyPS5/pull/7622) | `core/shader/recompiler/CMakeLists.txt`<br>`core/shader/recompiler/ShaderDiskCache.cpp` | | [PR 7642](https://www.github.com/boykopovar/AnyPS5/pull/7642) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt`<br>`core/shader/recompiler/CMakeLists.txt`<br>`core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp`<br>`core/shader/recompiler/Recompiler.cpp`<br>`core/shader/recompiler/ShaderDiskCache.cpp`<br>`core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp`<br>`core/shader/recompiler/SpirvBackend/src/SpirvRuntimeBuffer.cpp` | | [PR 7684](https://www.github.com/boykopovar/AnyPS5/pull/7684) | `core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp`<br>`core/shader/recompiler/ShaderDiskCache.cpp`<br>`docs/dev/debt/shader.md` | | [PR 7689](https://www.github.com/boykopovar/AnyPS5/pull/7689) | `core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp`<br>`core/shader/recompiler/ShaderDiskCache.cpp`<br>`core/shader/recompiler/SpirvBackend/src/SpirvRuntimeBuffer.cpp` | | [PR 7705](https://www.github.com/boykopovar/AnyPS5/pull/7705) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 8014](https://www.github.com/boykopovar/AnyPS5/pull/8014) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 8077](https://www.github.com/boykopovar/AnyPS5/pull/8077) | `core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp`<br>`core/shader/recompiler/RdnaDecoder/include/RdnaDecoder/RdnaDescriptorFormat.hpp`<br>`core/shader/recompiler/RdnaDecoder/src/RdnaDescriptorFormat.cpp`<br>`core/shader/recompiler/ShaderDiskCache.cpp`<br>`docs/dev/debt/shader.md` | | [PR 8246](https://www.github.com/boykopovar/AnyPS5/pull/8246) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 8484](https://www.github.com/boykopovar/AnyPS5/pull/8484) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 8527](https://www.github.com/boykopovar/AnyPS5/pull/8527) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 8552](https://www.github.com/boykopovar/AnyPS5/pull/8552) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 8592](https://www.github.com/boykopovar/AnyPS5/pull/8592) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 8625](https://www.github.com/boykopovar/AnyPS5/pull/8625) | `core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp`<br>`docs/dev/debt/shader.md` | | [PR 8672](https://www.github.com/boykopovar/AnyPS5/pull/8672) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 9356](https://www.github.com/boykopovar/AnyPS5/pull/9356) | `core/shader/recompiler/CMakeLists.txt`<br>`core/shader/recompiler/Recompiler.cpp`<br>`core/shader/recompiler/ShaderDiskCache.cpp`<br>`core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp` | | [PR 9387](https://www.github.com/boykopovar/AnyPS5/pull/9387) | `core/shader/recompiler/CMakeLists.txt`<br>`core/shader/recompiler/Recompiler.cpp`<br>`core/shader/recompiler/ShaderDiskCache.cpp`<br>`core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp` |
oneandonlydean commented 2026-10-22 04:18:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-22T04:18:10Z.


@Get-fix thanks for splitting the stack. I've been through #9430, and nearly everything is behind GcnGuestShaders() as the commit message says: the decode dispatch, the descriptor rewriting, the buffer masks, the legacy vertex inputs and the fetch-call rules. One change isn't, and it alters how PS5 (RDNA) shaders are analysed:

// GraphBuilder.cpp, unchangedUntil()
if (index == reader || !writesScalar(program.instructions[index], reg, waveSize)) continue;
if (index < reader) return false;

On main, a write at the reader counts as a change. With this, it's skipped. The caller at :1533 asks whether a descriptor pointer stays unchanged up to the s_load that reads it. So an RDNA load that overwrites its own address pair (s_load_dwordx2 s[0:1], s[0:1], ...) is now taken as a user-data pointer load where main refused it. That's arguably more correct, since the load reads before it writes, but it's an RDNA behaviour change inside a PS4-decoding PR, and no RDNA test covers it.

Could you either put it behind GcnGuestShaders() like the rest, or move it into its own small PR with an RDNA case in the scalar-call tests? With the first option, #9430 changes nothing for PS5 titles. The rest reads well to me, and the merged files compile against current main.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6332578992 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9430#issuecomment-6332578992). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-22T04:18:10Z. --- @Get-fix thanks for splitting the stack. I've been through #9430, and nearly everything is behind `GcnGuestShaders()` as the commit message says: the decode dispatch, the descriptor rewriting, the buffer masks, the legacy vertex inputs and the fetch-call rules. One change isn't, and it alters how PS5 (RDNA) shaders are analysed: ```cpp // GraphBuilder.cpp, unchangedUntil() if (index == reader || !writesScalar(program.instructions[index], reg, waveSize)) continue; if (index < reader) return false; ``` On main, a write *at* the reader counts as a change. With this, it's skipped. The caller at `:1533` asks whether a descriptor pointer stays unchanged up to the `s_load` that reads it. So an RDNA load that overwrites its own address pair (`s_load_dwordx2 s[0:1], s[0:1], ...`) is now taken as a user-data pointer load where main refused it. That's arguably more correct, since the load reads before it writes, but it's an RDNA behaviour change inside a PS4-decoding PR, and no RDNA test covers it. Could you either put it behind `GcnGuestShaders()` like the rest, or move it into its own small PR with an RDNA case in the scalar-call tests? With the first option, #9430 changes nothing for PS5 titles. The rest reads well to me, and the merged files compile against current main.
MarcZX10 commented 2026-10-22 04:50:47 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T04:50:47Z.

Review: CHANGES_REQUESTED


The PR reports a useful real Limbo shader stream regression test, format-table coverage, a full Limbo run, and paired Vulkan validation on the same GPU. The current branch still needs repository follow-up before merge:

  1. The PR is 534 commits behind current main; all reported tests and validation comparisons use cecb540a6. Please rebase this shader/recompiler change and its dependent stack onto current main, then rerun focused shader/AGC tests and the required paired validation-layer run against the new base.

  2. The overlap report still lists open PRs touching shared locations, including #7803 (ResourceMaterializer.cpp), #7622 (ShaderDiskCache.cpp), #8429 (the descriptor-format header), and #8564/#9020/#9335 (docs/dev/debt/shader.md). Some are insertion-point-only overlaps, but the repository rules still require confirming the actual overlap/order with their authors and recording any required Depends on order. Please refresh the overlap report after rebasing and resolve the surviving entries; the current checklist says Depends on: none while the report names these open changes.

The current automated eligibility, conventions, intake, labels, and report checks pass; Linux/Windows and relinker product jobs are skipped. I did not run the Windows/NVIDIA validation locally because no checkout/build matching this PR head is available in the workspace. The PR's paired test logs are author-reported and apply to the older cecb540a6 baseline.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5609404140 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9430#pullrequestreview-5609404140). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-22T04:50:47Z. **Review:** CHANGES_REQUESTED --- The PR reports a useful real Limbo shader stream regression test, format-table coverage, a full Limbo run, and paired Vulkan validation on the same GPU. The current branch still needs repository follow-up before merge: 1. The PR is 534 commits behind current `main`; all reported tests and validation comparisons use `cecb540a6`. Please rebase this shader/recompiler change and its dependent stack onto current `main`, then rerun focused shader/AGC tests and the required paired validation-layer run against the new base. 2. The overlap report still lists open PRs touching shared locations, including #7803 (`ResourceMaterializer.cpp`), #7622 (`ShaderDiskCache.cpp`), #8429 (the descriptor-format header), and #8564/#9020/#9335 (`docs/dev/debt/shader.md`). Some are insertion-point-only overlaps, but the repository rules still require confirming the actual overlap/order with their authors and recording any required `Depends on` order. Please refresh the overlap report after rebasing and resolve the surviving entries; the current checklist says `Depends on: none` while the report names these open changes. The current automated eligibility, conventions, intake, labels, and report checks pass; Linux/Windows and relinker product jobs are skipped. I did not run the Windows/NVIDIA validation locally because no checkout/build matching this PR head is available in the workspace. The PR's paired test logs are author-reported and apply to the older `cecb540a6` baseline.
Get-fix commented 2026-10-22 11:06:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Get-fix on 2026-10-22T11:06:50Z.


@oneandonlydean thanks, you were right: that line changed how RDNA shaders are analysed. It is now behind GcnGuestShaders() in its own commit (a13d01bcc), so for PS5 shaders unchangedUntil behaves exactly as on main:

const bool readerWritesAfterReading = index == reader && GcnGuestShaders();
if (readerWritesAfterReading || !writesScalar(program.instructions[index], reg, waveSize)) continue;
if (index <= reader) return false;

With this, #9430 changes nothing for PS5 titles. If the RDNA case (an s_load that overwrites its own address pair) should be accepted too, I'll send it as its own PR with a scalar-call test, as you suggested.

@MarcZX10 the stack is rebased onto main 7e2ba73e4, and the tests, the paired validation-layer runs and a Limbo run were redone on that base (see the description). The refreshed overlap report:

  • #5941, #6009 and #6010 (@zmeizy) add a field next to the one this PR adds in TranslateOptions (InstructionTranslator.hpp L38). #7803 (@thuanquang) adds a function where this PR adds imageCoordinates (ResourceMaterializer.cpp L120). #8026 (@NFSS10) calls its new test after packedFloatDccClearTests(), where this PR calls gcnBufferFormatTests() (TextureFormat.cpp L270). #8429 (@milescoviello) adds an include and declarations where this PR adds the GCN descriptor declarations (RdnaDescriptorFormat.hpp). #8564 (@JAB-dev), #9020 and #9335 (@frankea) add their own docs/dev/debt/shader.md entry after the same line.
  • None of these changes a line this PR changes, and neither side uses what the other adds, so no order is needed. Whichever of them lands first, I rebase this stack on it; their authors don't need to change anything. That is why Depends on stays none.
  • #9431 and #9432 are the rest of this stack and #6977 is its draft integration branch. #9671 to #9676 are @ntamas94's follow-ups, built on this stack; they contain these commits and land after them.
  • The PRs the report could not compare already conflict with main.

AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6339233881 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9430#issuecomment-6339233881). Originally posted by [Get-fix](https://github.com/Get-fix) on 2026-10-22T11:06:50Z. --- @oneandonlydean thanks, you were right: that line changed how RDNA shaders are analysed. It is now behind `GcnGuestShaders()` in its own commit (a13d01bcc), so for PS5 shaders `unchangedUntil` behaves exactly as on `main`: ```cpp const bool readerWritesAfterReading = index == reader && GcnGuestShaders(); if (readerWritesAfterReading || !writesScalar(program.instructions[index], reg, waveSize)) continue; if (index <= reader) return false; ``` With this, #9430 changes nothing for PS5 titles. If the RDNA case (an `s_load` that overwrites its own address pair) should be accepted too, I'll send it as its own PR with a scalar-call test, as you suggested. @MarcZX10 the stack is rebased onto `main` 7e2ba73e4, and the tests, the paired validation-layer runs and a Limbo run were redone on that base (see the description). The refreshed overlap report: - #5941, #6009 and #6010 (@zmeizy) add a field next to the one this PR adds in `TranslateOptions` (`InstructionTranslator.hpp` L38). #7803 (@thuanquang) adds a function where this PR adds `imageCoordinates` (`ResourceMaterializer.cpp` L120). #8026 (@NFSS10) calls its new test after `packedFloatDccClearTests()`, where this PR calls `gcnBufferFormatTests()` (`TextureFormat.cpp` L270). #8429 (@milescoviello) adds an include and declarations where this PR adds the GCN descriptor declarations (`RdnaDescriptorFormat.hpp`). #8564 (@JAB-dev), #9020 and #9335 (@frankea) add their own `docs/dev/debt/shader.md` entry after the same line. - None of these changes a line this PR changes, and neither side uses what the other adds, so no order is needed. Whichever of them lands first, I rebase this stack on it; their authors don't need to change anything. That is why `Depends on` stays `none`. - #9431 and #9432 are the rest of this stack and #6977 is its draft integration branch. #9671 to #9676 are @ntamas94's follow-ups, built on this stack; they contain these commits and land after them. - The PRs the report could not compare already conflict with `main`. AI-assisted: yes (Claude Code) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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!9430
No description provided.