fix(shader): address swizzled buffers like RDNA2 #21970

Open
AlfaRojo wants to merge 7 commits from upstream-pr/21970 into main
AlfaRojo commented 2026-11-16 23:44:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by AlfaRojo on 2026-11-16T23:44:38Z.


What

The recompiler's swizzled buffer addressing (V# word 1 bit 31 with a nonzero stride) differed from RDNA2 hardware in three ways:

  • it swizzled an access that had neither IDXEN nor ADD_TID, where the hardware addresses it linearly;
  • it added the lane to the index when IDXEN was set, where the hardware ignores ADD_TID;
  • it swizzled each dword of a vector access separately, where an IDXEN access is contiguous from the swizzled address of its first dword.

QA found a fourth case in the formatted-load path: buffer_load_format_x with OFFEN only and bit 31 set was still swizzled, because the specialization-constant branch rebuilt the swizzle from the stride and bit 31 alone. That case is fixed too.

Measured rule, which reproduces every row (about 12,000 single-dword and 4,600 multi-dword rows, wave32 and wave64):

  • step = 8 << INDEX_STRIDE
  • address = ((index / step) * stride + (offset & ~3)) * step + (index % step) * 4 + (offset & 3) + soffset, where offset is the VGPR offset plus the instruction offset
  • ELEMENT_SIZE has no effect; the element is 4 bytes
  • the swizzle applies only with IDXEN, or with ADD_TID and no IDXEN; otherwise the access is linear
  • ADD_TID makes the index the lane only when IDXEN is 0
  • a multi-dword access with IDXEN is contiguous from its first dword's swizzled address; without IDXEN (ADD_TID) each dword is swizzled at offset + 4k
  • stores use the same address rules

Measurement: AMD Radeon Graphics (Ryzen iGPU, PCI 1002:13c0), AMD Windows driver 32.0.21043.5001, tools/hw-oracle through HIP, assembly target gfx1036. Float controls on every run: IEEE 0, DX10 clamp 1, denorm32 0, denorm16 3, round32 and round16 0, FP16 overflow 0. The source buffer holds a distinct value in every byte, so each result identifies the byte it came from. The address rule is set by the buffer swizzle fields, not by the alignment mode. The driver here runs alignment mode UNALIGNED and the console runs DWORD (docs/dev/debt/shader.md, V# bases off a DWORD boundary), so the (offset & 3) term of an unaligned access is measured only in UNALIGNED mode.

The new execution test BufferSwizzledAddress (wave32 and wave64) checks the measured formula. Its load expectations were compared directly with the hardware in 88 cases. Its store expectations rest on single-lane hardware measurements, because multi-lane stores overlap. The swizzled case in RuntimeBufferSpans expected an index-0 swizzle of offset * 8, which was a model, not a measurement; the hardware addresses that access linearly. The case is renamed "swizzle bit without index" and now expects the linear access.

Not fixed, recorded in the debt fragment: in 38 of 256 measured bound cases (NUM_RECORDS 4 or 16, stride 16), the hardware returns data where the recompiler returns 0. The recompiler's range test passes in those cases, but the bound storage buffer ends at NUM_RECORDS * stride, before the address the hardware reads. Two things cause this: a swizzled index group spans 8 << INDEX_STRIDE records, and a linear V# with OOB_SELECT 2 or 3 does not compare the index with NUM_RECORDS. tbuffer_*, typed stores, atomics, SOFFSET, graphics stages and gfx1013 are not measured.

Tested

Windows 11 Pro 10.0.26200, WinLibs GCC 15.2.0 r7 UCRT, Ninja, Release, head 507ee5621a on main bc84729655.

  • ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1: BufferSwizzledAddress and RuntimeBufferSpans pass in 3/3 runs on each GPU; Selected GPU name= names the requested GPU. The new test fails on main on both GPUs. Without the formatted-load fix, the four buffer_load_format_x cases fail.
  • Validation layer (Khronos 1.4.363.0, LunarG SDK), the same 23 buffer tests on main bc84729655 and on this branch, same machine, 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 '<buffer tests>' -V:
GPU side result layer inserted was not found VUID-
RTX 4070 main 22/23 (only the new test fails) 23 0 0
RTX 4070 branch 23/23 23 0 0
Radeon 1002:13c0 main 22/23 (only the new test fails) 23 0 0
Radeon 1002:13c0 branch 23/23 23 0 0

No new VUID- errors. agc_formatted_buffer_once and agc_formatted_buffer_byte_stores could not be built here, because Windows Defender quarantines their executables (Trojan:Win64/ShellCode.MKA!MTB, a heuristic detection on the generated test binaries; see BUILD.md on antivirus).

  • check_conventions.py --base upstream/main, check_test_registration.py and debt_fold.py --check pass.
  • Related open PRs: #21924 (structured stride range) conflicts in one line of RuntimeBufferSpans.cpp, the in-bounds model. The resolution keeps #21924's offset + 4u <= stride and this PR's removal of the swizzle clause. SpirvRuntimeBuffer.cpp merges cleanly, and swizzled accesses pass offset + tail to the per-dword range check, so the two rules compose. #21925 merges cleanly. pr_overlap.py also reports #16415 (raw dword alignment for the console's DWORD mode) at SpirvRuntimeBuffer.cpp lines 196-197. Those are textual neighbours: #16415 adds AlignsRawDwordAddress after descriptor and masks the final byte address after the swizzle/linear select, so the two compose. The eight PRs it could not compare (#6412, #7642, #7689, #10193, #13928, #13929, #18515, #20248) touch V# type checks, image and sampler tables, profiling and native descriptor tables. I read their hunks. None of them changes the swizzle address or the IDXEN/ADD_TID index, with one exception: #20248's opt-in native descriptor tables build their own swizzle flag from the stride and bit 31. If both PRs land, that path would also need the IDXEN/ADD_TID condition.

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: none
  • GPUs tested: NVIDIA GeForce RTX 4070 (driver 32.0.16.2124) and AMD Radeon Graphics Ryzen iGPU 1002:13c0 (driver 32.0.21043.5001), Windows 11 Pro 10.0.26200
  • AI-assisted: yes

Summary by CodeRabbit

  • Bug Fixes
    • Improved shader handling of swizzled buffer addresses, including indexed and vector accesses, for more reliable buffer reads and writes.
    • Updated runtime buffer behavior for swizzle cases to better match expected address calculations.
  • Compatibility
    • Updated the shader cache format version. Existing cached shaders may need to be regenerated.
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5347330600 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/21970). Originally posted by [AlfaRojo](https://github.com/AlfaRojo) on 2026-11-16T23:44:38Z. --- ### What The recompiler's swizzled buffer addressing (V# word 1 bit 31 with a nonzero stride) differed from RDNA2 hardware in three ways: - it swizzled an access that had neither IDXEN nor ADD_TID, where the hardware addresses it linearly; - it added the lane to the index when IDXEN was set, where the hardware ignores ADD_TID; - it swizzled each dword of a vector access separately, where an IDXEN access is contiguous from the swizzled address of its first dword. QA found a fourth case in the formatted-load path: `buffer_load_format_x` with OFFEN only and bit 31 set was still swizzled, because the specialization-constant branch rebuilt the swizzle from the stride and bit 31 alone. That case is fixed too. Measured rule, which reproduces every row (about 12,000 single-dword and 4,600 multi-dword rows, wave32 and wave64): - `step = 8 << INDEX_STRIDE` - `address = ((index / step) * stride + (offset & ~3)) * step + (index % step) * 4 + (offset & 3) + soffset`, where `offset` is the VGPR offset plus the instruction offset - `ELEMENT_SIZE` has no effect; the element is 4 bytes - the swizzle applies only with IDXEN, or with ADD_TID and no IDXEN; otherwise the access is linear - ADD_TID makes the index the lane only when IDXEN is 0 - a multi-dword access with IDXEN is contiguous from its first dword's swizzled address; without IDXEN (ADD_TID) each dword is swizzled at `offset + 4k` - stores use the same address rules Measurement: AMD Radeon Graphics (Ryzen iGPU, PCI 1002:13c0), AMD Windows driver 32.0.21043.5001, `tools/hw-oracle` through HIP, assembly target gfx1036. Float controls on every run: IEEE 0, DX10 clamp 1, denorm32 0, denorm16 3, round32 and round16 0, FP16 overflow 0. The source buffer holds a distinct value in every byte, so each result identifies the byte it came from. The address rule is set by the buffer swizzle fields, not by the alignment mode. The driver here runs alignment mode UNALIGNED and the console runs DWORD (`docs/dev/debt/shader.md`, V# bases off a DWORD boundary), so the `(offset & 3)` term of an unaligned access is measured only in UNALIGNED mode. The new execution test `BufferSwizzledAddress` (wave32 and wave64) checks the measured formula. Its load expectations were compared directly with the hardware in 88 cases. Its store expectations rest on single-lane hardware measurements, because multi-lane stores overlap. The `swizzled` case in `RuntimeBufferSpans` expected an index-0 swizzle of `offset * 8`, which was a model, not a measurement; the hardware addresses that access linearly. The case is renamed "swizzle bit without index" and now expects the linear access. Not fixed, recorded in the debt fragment: in 38 of 256 measured bound cases (`NUM_RECORDS` 4 or 16, stride 16), the hardware returns data where the recompiler returns 0. The recompiler's range test passes in those cases, but the bound storage buffer ends at `NUM_RECORDS * stride`, before the address the hardware reads. Two things cause this: a swizzled index group spans `8 << INDEX_STRIDE` records, and a linear V# with `OOB_SELECT` 2 or 3 does not compare the index with `NUM_RECORDS`. `tbuffer_*`, typed stores, atomics, SOFFSET, graphics stages and gfx1013 are not measured. ### Tested Windows 11 Pro 10.0.26200, WinLibs GCC 15.2.0 r7 UCRT, Ninja, Release, head `507ee5621a` on `main` `bc84729655`. - `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1`: `BufferSwizzledAddress` and `RuntimeBufferSpans` pass in 3/3 runs on each GPU; `Selected GPU name=` names the requested GPU. The new test fails on `main` on both GPUs. Without the formatted-load fix, the four `buffer_load_format_x` cases fail. - Validation layer (Khronos 1.4.363.0, LunarG SDK), the same 23 buffer tests on `main` `bc84729655` and on this branch, same machine, `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 '<buffer tests>' -V`: | GPU | side | result | layer inserted | `was not found` | `VUID-` | |---|---|---|---|---|---| | RTX 4070 | main | 22/23 (only the new test fails) | 23 | 0 | 0 | | RTX 4070 | branch | 23/23 | 23 | 0 | 0 | | Radeon 1002:13c0 | main | 22/23 (only the new test fails) | 23 | 0 | 0 | | Radeon 1002:13c0 | branch | 23/23 | 23 | 0 | 0 | No new `VUID-` errors. `agc_formatted_buffer_once` and `agc_formatted_buffer_byte_stores` could not be built here, because Windows Defender quarantines their executables (`Trojan:Win64/ShellCode.MKA!MTB`, a heuristic detection on the generated test binaries; see BUILD.md on antivirus). - `check_conventions.py --base upstream/main`, `check_test_registration.py` and `debt_fold.py --check` pass. - Related open PRs: #21924 (structured stride range) conflicts in one line of `RuntimeBufferSpans.cpp`, the in-bounds model. The resolution keeps #21924's `offset + 4u <= stride` and this PR's removal of the swizzle clause. `SpirvRuntimeBuffer.cpp` merges cleanly, and swizzled accesses pass `offset + tail` to the per-dword range check, so the two rules compose. #21925 merges cleanly. `pr_overlap.py` also reports #16415 (raw dword alignment for the console's DWORD mode) at `SpirvRuntimeBuffer.cpp` lines 196-197. Those are textual neighbours: #16415 adds `AlignsRawDwordAddress` after `descriptor` and masks the final byte address after the swizzle/linear select, so the two compose. The eight PRs it could not compare (#6412, #7642, #7689, #10193, #13928, #13929, #18515, #20248) touch V# type checks, image and sampler tables, profiling and native descriptor tables. I read their hunks. None of them changes the swizzle address or the IDXEN/ADD_TID index, with one exception: #20248's opt-in native descriptor tables build their own swizzle flag from the stride and bit 31. If both PRs land, that path would also need the IDXEN/ADD_TID condition. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [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: none - [x] GPUs tested: NVIDIA GeForce RTX 4070 (driver 32.0.16.2124) and AMD Radeon Graphics Ryzen iGPU 1002:13c0 (driver 32.0.21043.5001), Windows 11 Pro 10.0.26200 - [x] AI-assisted: yes <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Bug Fixes** * Improved shader handling of swizzled buffer addresses, including indexed and vector accesses, for more reliable buffer reads and writes. * Updated runtime buffer behavior for swizzle cases to better match expected address calculations. * **Compatibility** * Updated the shader cache format version. Existing cached shaders may need to be regenerated. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
MarcZX10 commented 2026-11-17 00:19:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-17T00:19:07Z.

Review: COMMENTED


Reviewed — no blocking findings

Nothing blocks this change; the points below are optional.

What I ran

Reviewed head ea6589ad0f099626620b3b2939e907290d9b0585. No commands or tests were run; this review used the prepared diff and targeted reads at the pinned head.

Results

Check Result Note
Diff and changed code passed Relevant changes and callers inspected
Tests not run No local test execution available
Negative control not run Not independently verified

Findings

Blocking

None.

Non-blocking

  • The new execution test and its address model cover representative cases, while the description notes unmeasured paths such as graphics stages, atomics, and stores without IDXEN. Consider extending coverage when those paths are measured.

Sources

Not verified

No tests, builds, or hardware checks were run independently. Read the prepared description, commits, manifest, and diff; inspected relevant portions of all five changed files listed in the manifest. No changed files were excluded by the manifest. Full-file contents were not read for the larger changed files.

To get this to a good state

Nothing is required. Optional: add measured cases for the paths listed above when hardware data is available.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5930361040 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/21970#pullrequestreview-5930361040). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-17T00:19:07Z. **Review:** COMMENTED --- # Reviewed — no blocking findings Nothing blocks this change; the points below are optional. ## What I ran Reviewed head `ea6589ad0f099626620b3b2939e907290d9b0585`. No commands or tests were run; this review used the prepared diff and targeted reads at the pinned head. ## Results | Check | Result | Note | |---|---|---| | Diff and changed code | passed | Relevant changes and callers inspected | | Tests | not run | No local test execution available | | Negative control | not run | Not independently verified | ## Findings ### Blocking None. ### Non-blocking - The new execution test and its address model cover representative cases, while the description notes unmeasured paths such as graphics stages, atomics, and stores without IDXEN. Consider extending coverage when those paths are measured. ## Sources - [Swizzled address generation at the reviewed head](https://github.com/boykopovar/AnyPS5/blob/ea6589ad0f099626620b3b2939e907290d9b0585/core/shader/recompiler/SpirvBackend/src/SpirvRuntimeBuffer.cpp#L175-L239) - [New swizzled buffer execution cases at the reviewed head](https://github.com/boykopovar/AnyPS5/blob/ea6589ad0f099626620b3b2939e907290d9b0585/core/libs/prx/libSceAgcDriver/tests/execution/BufferSwizzledAddress.cpp) ## Not verified No tests, builds, or hardware checks were run independently. Read the prepared description, commits, manifest, and diff; inspected relevant portions of all five changed files listed in the manifest. No changed files were excluded by the manifest. Full-file contents were not read for the larger changed files. ## To get this to a good state Nothing is required. Optional: add measured cases for the paths listed above when hardware data is available.
MarcZX10 commented 2026-11-20 16:59:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T16:59:13Z.

Review: APPROVED


Reviewed — looks good

Nothing blocks this change; the address changes are covered by the added execution test, and the reported hardware and validation runs support the stated behavior.

What I ran

Reviewed head 89b1f8f3fdf370f789120600c432e954e571d2ab using the prepared diff and pinned reader. No commands or tests were run in this review.

Results

Check Result Note
Changed-line review passed All changed lines reviewed
Tests in this review not run Author-reported results only
Hardware behavior not run Author-reported measurements only

Findings

Blocking

None.

Non-blocking

None.

Not verified

Tests and hardware runs were not performed for this review. The description reports Windows 11 test runs and AMD RDNA2 measurements, and identifies unmeasured paths including gfx1013, graphics stages, atomics, SOFFSET, typed stores, and tbuffer_*.

Files read: description.md, commits.md, manifest.json, diff.patch, README.md, and all five changed repository files: BufferSwizzledAddress.cpp, RuntimeBufferSpans.cpp, ShaderDiskCache.hpp, SpirvRuntimeBuffer.cpp, and fix-shader-swizzled-buffer-address.md. No changed files were excluded.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5996381858 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/21970#pullrequestreview-5996381858). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-20T16:59:13Z. **Review:** APPROVED --- # Reviewed — looks good Nothing blocks this change; the address changes are covered by the added execution test, and the reported hardware and validation runs support the stated behavior. ## What I ran Reviewed head `89b1f8f3fdf370f789120600c432e954e571d2ab` using the prepared diff and pinned reader. No commands or tests were run in this review. ## Results | Check | Result | Note | |---|---|---| | Changed-line review | passed | All changed lines reviewed | | Tests in this review | not run | Author-reported results only | | Hardware behavior | not run | Author-reported measurements only | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified Tests and hardware runs were not performed for this review. The description reports Windows 11 test runs and AMD RDNA2 measurements, and identifies unmeasured paths including gfx1013, graphics stages, atomics, SOFFSET, typed stores, and `tbuffer_*`. Files read: `description.md`, `commits.md`, `manifest.json`, `diff.patch`, `README.md`, and all five changed repository files: `BufferSwizzledAddress.cpp`, `RuntimeBufferSpans.cpp`, `ShaderDiskCache.hpp`, `SpirvRuntimeBuffer.cpp`, and `fix-shader-swizzled-buffer-address.md`. No changed files were excluded. ## To get this to a good state Nothing is required.
MarcZX10 commented 2026-11-22 10:35:56 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T10:35:56Z.

Review: APPROVED


Reviewed — looks good

The change implements the described swizzled buffer address rules and adds execution coverage; no verified blocking defect was found in the reviewed changes.

What I ran

Reviewed head 27268840280119efa477604b98b23c97619c563c using repo_read.py access to the prepared review bundle and pinned repository. No commands or tests were run by me; test results below are author-reported.

Read all five changed files: BufferSwizzledAddress.cpp, RuntimeBufferSpans.cpp, ShaderDiskCache.hpp, SpirvRuntimeBuffer.cpp, and fix-shader-swizzled-buffer-address.md. No files were excluded by the manifest.

Results

Check Result Note
Changed-line review passed All five changed files read
Tests not run Hardware and CI results are author-reported
Runtime behavior not run No local build or execution

Findings

Blocking

None.

Non-blocking

None.

Not verified

I did not run the tests, build, or confirm console behavior. Author-reported hardware measurements and Windows test results were not independently verified. The debt note records measured buffer-bound cases that remain unresolved, as well as unmeasured paths including tbuffer_*, typed stores, atomics, SOFFSET, graphics stages, and gfx1013.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6011778594 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/21970#pullrequestreview-6011778594). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-22T10:35:56Z. **Review:** APPROVED --- # Reviewed — looks good The change implements the described swizzled buffer address rules and adds execution coverage; no verified blocking defect was found in the reviewed changes. ## What I ran Reviewed head `27268840280119efa477604b98b23c97619c563c` using `repo_read.py` access to the prepared review bundle and pinned repository. No commands or tests were run by me; test results below are author-reported. Read all five changed files: `BufferSwizzledAddress.cpp`, `RuntimeBufferSpans.cpp`, `ShaderDiskCache.hpp`, `SpirvRuntimeBuffer.cpp`, and `fix-shader-swizzled-buffer-address.md`. No files were excluded by the manifest. ## Results | Check | Result | Note | |---|---|---| | Changed-line review | passed | All five changed files read | | Tests | not run | Hardware and CI results are author-reported | | Runtime behavior | not run | No local build or execution | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified I did not run the tests, build, or confirm console behavior. Author-reported hardware measurements and Windows test results were not independently verified. The debt note records measured buffer-bound cases that remain unresolved, as well as unmeasured paths including `tbuffer_*`, typed stores, atomics, SOFFSET, graphics stages, and gfx1013. ## To get this to a good state Nothing is required.
ligmaSec commented 2026-12-03 22:13:46 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T22:13:46Z.

Review: COMMENTED


The trial merge onto a1b75b0947 conflicts in ShaderDiskCache.hpp. The new wave32 and wave64 cases cover the swizzled addressing rule across lanes and interleaved components. Please preserve the version bump after rebasing the generated code and run those cases together with RuntimeBufferSpans, which also covers the interaction with range checks. #24781 touches the same address lowering, so the order these land can affect the merged coverage.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6179530225 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/21970#pullrequestreview-6179530225). Originally posted by [ligmaSec](https://github.com/ligmaSec) on 2026-12-03T22:13:46Z. **Review:** COMMENTED --- The trial merge onto `a1b75b0947` conflicts in `ShaderDiskCache.hpp`. The new wave32 and wave64 cases cover the swizzled addressing rule across lanes and interleaved components. Please preserve the version bump after rebasing the generated code and run those cases together with `RuntimeBufferSpans`, which also covers the interaction with range checks. #24781 touches the same address lowering, so the order these land can affect the merged coverage. AI-assisted: yes.
MarcZX10 commented 2026-12-04 16:50:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-12-04T16:50:39Z.

Review: APPROVED


Reviewed — looks good

The changed addressing logic matches the stated IDXEN, ADD_TID, and vector-access rules, with no blocking defects found in the reviewed changes.

What I ran

Reviewed head e459e25001f3073968f32ef337bdc38ca205153f. I inspected the prepared diff and manifest, then read the changed code and relevant source ranges with repo_read.py. No tests or builds were run.

python3 repo_read.py cat core/shader/recompiler/SpirvBackend/src/SpirvRuntimeBuffer.cpp 130 245
python3 repo_read.py cat core/shader/recompiler/SpirvBackend/src/SpirvRuntimeBuffer.cpp 920 990
python3 repo_read.py cat core/shader/recompiler/SpirvBackend/src/SpirvRuntimeBuffer.cpp 1035 1215

Results

Check Result Note
Changed files passed All 5 reviewed; none excluded
Tests and build not run No independent execution

Negative control

Not run; no tests were run.

Findings

Blocking

None.

Non-blocking

None.

Sources

Not verified

The author-reported hardware measurements and test runs were not independently reproduced. No files were excluded; the review covered the changed hunks in core/libs/prx/libSceAgcDriver/tests/execution/BufferSwizzledAddress.cpp, core/libs/prx/libSceAgcDriver/tests/execution/RuntimeBufferSpans.cpp, core/shader/recompiler/ShaderDiskCache.hpp, core/shader/recompiler/SpirvBackend/src/SpirvRuntimeBuffer.cpp, and docs/dev/debt/changes/fix-shader-swizzled-buffer-address.md.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6193007288 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/21970#pullrequestreview-6193007288). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-12-04T16:50:39Z. **Review:** APPROVED --- # Reviewed — looks good The changed addressing logic matches the stated IDXEN, ADD_TID, and vector-access rules, with no blocking defects found in the reviewed changes. ## What I ran Reviewed head `e459e25001f3073968f32ef337bdc38ca205153f`. I inspected the prepared diff and manifest, then read the changed code and relevant source ranges with `repo_read.py`. No tests or builds were run. ```text python3 repo_read.py cat core/shader/recompiler/SpirvBackend/src/SpirvRuntimeBuffer.cpp 130 245 python3 repo_read.py cat core/shader/recompiler/SpirvBackend/src/SpirvRuntimeBuffer.cpp 920 990 python3 repo_read.py cat core/shader/recompiler/SpirvBackend/src/SpirvRuntimeBuffer.cpp 1035 1215 ``` ## Results | Check | Result | Note | |---|---|---| | Changed files | passed | All 5 reviewed; none excluded | | Tests and build | not run | No independent execution | ## Negative control Not run; no tests were run. ## Findings ### Blocking None. ### Non-blocking None. ## Sources - [Runtime buffer addressing at the reviewed head](https://github.com/boykopovar/AnyPS5/blob/e459e25001f3073968f32ef337bdc38ca205153f/core/shader/recompiler/SpirvBackend/src/SpirvRuntimeBuffer.cpp#L165) - [Swizzled address execution cases](https://github.com/boykopovar/AnyPS5/blob/e459e25001f3073968f32ef337bdc38ca205153f/core/libs/prx/libSceAgcDriver/tests/execution/BufferSwizzledAddress.cpp#L1) ## Not verified The author-reported hardware measurements and test runs were not independently reproduced. No files were excluded; the review covered the changed hunks in `core/libs/prx/libSceAgcDriver/tests/execution/BufferSwizzledAddress.cpp`, `core/libs/prx/libSceAgcDriver/tests/execution/RuntimeBufferSpans.cpp`, `core/shader/recompiler/ShaderDiskCache.hpp`, `core/shader/recompiler/SpirvBackend/src/SpirvRuntimeBuffer.cpp`, and `docs/dev/debt/changes/fix-shader-swizzled-buffer-address.md`. ## To get this to a good state Nothing is required.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/21970:upstream-pr/21970'
git switch 'upstream-pr/21970'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/21970'
git switch 'upstream-pr/21970'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/21970'
git switch 'upstream-pr/21970'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/21970'
git switch 'main'
git merge --squash 'upstream-pr/21970'
git switch 'main'
git merge --ff-only 'upstream-pr/21970'
git switch 'main'
git merge 'upstream-pr/21970'
git push origin 'main'
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!21970
No description provided.