fix(recompiler): read image address components the instruction omits as 0 #1379

Merged
gjonn merged 1 commit from upstream-pr/1379 into main 2026-10-08 12:42:11 +00:00
gjonn commented 2026-10-08 01:11:56 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by gjonn on 2026-10-08T01:11:56Z.


What

An image load or store whose DIM field encodes fewer coordinates than the bound resource was refused at SPIR-V emission ("has an image address with too few coordinate components"). A title runs a compute shader during start-up that does image_load with a 2D address on a 3D texture.

  • CoordU32 takes the coordinates the instruction provides (as many as both the instruction's DIM and the resource have) and fills the rest with 0, so such a load reads the first slice (or face or layer).
  • The reverse case (more coordinates than the resource) is unchanged. A malformed address with fewer VGPRs than its DIM still throws, and so does a sampled access with too few coordinates (CoordF32).
  • The ISA does not document what the hardware reads for address components that the instruction does not provide. 0 is the natural choice and is exact for a single-slice volume.

Tested

  • Windows 11, MinGW-w64 GCC 15.2.0, RTX 5090: agc_driver_image_address_dimension passes with a new case: image_load 2d on a two-slice linear 3D texture returns slice 0's texels for 32 threads. The existing refusal of image_sample_l 1d on a 2D texture still holds.
  • A title that runs this shader no longer aborts on it and continues to the next start-up issue.

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 in TechnicalDebt
  • 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
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4780424854 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1379). Originally posted by [gjonn](https://github.com/gjonn) on 2026-10-08T01:11:56Z. --- ### What An image load or store whose `DIM` field encodes fewer coordinates than the bound resource was refused at SPIR-V emission ("has an image address with too few coordinate components"). A title runs a compute shader during start-up that does `image_load` with a 2D address on a 3D texture. - `CoordU32` takes the coordinates the instruction provides (as many as both the instruction's `DIM` and the resource have) and fills the rest with 0, so such a load reads the first slice (or face or layer). - The reverse case (more coordinates than the resource) is unchanged. A malformed address with fewer VGPRs than its `DIM` still throws, and so does a sampled access with too few coordinates (`CoordF32`). - The ISA does not document what the hardware reads for address components that the instruction does not provide. 0 is the natural choice and is exact for a single-slice volume. ### Tested - Windows 11, MinGW-w64 GCC 15.2.0, RTX 5090: `agc_driver_image_address_dimension` passes with a new case: `image_load` 2d on a two-slice linear 3D texture returns slice 0's texels for 32 threads. The existing refusal of `image_sample_l` 1d on a 2D texture still holds. - A title that runs this shader no longer aborts on it and continues to the next start-up issue. ### 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) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [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] AI-assisted: yes
adriadam10 commented 2026-10-08 12:42:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-08T12:42:07Z.


Checked on the HW oracle (gfx1035): with fewer address components than the T# (image_load/image_store dim 2D/1D on a 3D T#, dim 2D on 2D-array/cube, dim 1D on 1D-array), the hardware uses 0 for the missing ones (3D: slice 0, BASE_ARRAY ignored; arrays/cube: layer BASE_ARRAY, same as an explicit layer 0), and ignores the next VGPR. That matches what CoordU32 now emits. Build + ctest green on RADV, and the new case fails with the fix reverted. Merging.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6060102741 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1379#issuecomment-6060102741). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-08T12:42:07Z. --- Checked on the HW oracle (gfx1035): with fewer address components than the T# (`image_load`/`image_store` dim 2D/1D on a 3D T#, dim 2D on 2D-array/cube, dim 1D on 1D-array), the hardware uses 0 for the missing ones (3D: slice 0, BASE_ARRAY ignored; arrays/cube: layer BASE_ARRAY, same as an explicit layer 0), and ignores the next VGPR. That matches what `CoordU32` now emits. Build + ctest green on RADV, and the new case fails with the fix reverted. Merging.
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!1379
No description provided.