fix(shader): read 1D T#s through 3D image_sample and image_load accesses #5375

Merged
billythemenace2 merged 2 commits from upstream-pr/5375 into main 2026-10-14 19:40:54 +00:00
billythemenace2 commented 2026-10-13 18:19:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by billythemenace2 on 2026-10-13T18:19:28Z.


What

A 3D image access bound to a 1D T# matched no runtime image mode and threw "image descriptor is incompatible with the static runtime image interface". SONIC SUPERSTARS (PPSA06888) reads a 1x1 1D T# (type 8, format 7) as 3D.

This adds a 1D mode for 3D accesses whose only uses are image_sample_lz, plain image_sample or mip-less image_load, as measured on RDNA1 (RX 5700 XT, gfx1010) with the [hardware oracle](docs/dev/HW_ORACLE.md):

  • image_sample_lz reads the texel u selects and ignores v and r, with wrap, clamp-last-texel and border addressing.
  • A plain image_sample takes its texel and LOD from u alone.
  • image_load reads the x texel for any y when z is 0 and returns zero for any other z, as the 3D-on-2D load measured in #2023 does.

Every other 3D access of such an image keeps throwing, including comparison samples (image_sample_c*), explicit LOD, bias, derivatives, offsets, gathers, queries and stores. The raw measurement is attached.
measurement-results-3d-on-1d.md

This completes the set after #2237 (2D on 1D) and #2023 (3D on 2D). The measured GPU is RDNA1, the same family as the PS5's gfx1013; the earlier two cases were measured on RDNA2.

Tested

  • Linux (Ubuntu), RX 5700 XT (gfx1010): hardware oracle measurement above; the new agc_driver_image_volume_address_on_line execution test passes.
  • Windows 11 (10.0.26200), RX 5700 XT (AMD driver 32.0.21045.5002), WinLibs GCC 15.2.0: agc_driver_image_volume_address_on_line and agc_shader_disk_cache pass. On this Windows driver, agc_driver_image_plane_address_on_line, ..._on_line_implicit_lod, agc_driver_image_volume_address_on_plane and ..._planar_texture fail with zero texels on plain main too, without this change.
  • Game: SONIC SUPERSTARS (PPSA06888) on main + this PR + #4474. The 3D-on-1D sample and load accesses no longer refuse; the title still stops at a 3D comparison sample on the same kind of 1D T#, which this PR leaves refused because it is not measured.

Checklist

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4847573226 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5375). Originally posted by [billythemenace2](https://github.com/billythemenace2) on 2026-10-13T18:19:28Z. --- ### What A 3D image access bound to a 1D T# matched no runtime image mode and threw "image descriptor is incompatible with the static runtime image interface". SONIC SUPERSTARS (PPSA06888) reads a 1x1 1D T# (type 8, format 7) as 3D. This adds a 1D mode for 3D accesses whose only uses are `image_sample_lz`, plain `image_sample` or mip-less `image_load`, as measured on RDNA1 (RX 5700 XT, gfx1010) with the [[hardware oracle](https://claude.ai/epitaxy/project/docs/dev/HW_ORACLE.md)](docs/dev/HW_ORACLE.md): - `image_sample_lz` reads the texel u selects and ignores v and r, with wrap, clamp-last-texel and border addressing. - A plain `image_sample` takes its texel and LOD from u alone. - `image_load` reads the x texel for any y when z is 0 and returns zero for any other z, as the 3D-on-2D load measured in #2023 does. Every other 3D access of such an image keeps throwing, including comparison samples (`image_sample_c*`), explicit LOD, bias, derivatives, offsets, gathers, queries and stores. The raw measurement is attached. [measurement-results-3d-on-1d.md](https://github.com/user-attachments/files/33398319/measurement-results-3d-on-1d.md) This completes the set after #2237 (2D on 1D) and #2023 (3D on 2D). The measured GPU is RDNA1, the same family as the PS5's gfx1013; the earlier two cases were measured on RDNA2. ### Tested - Linux (Ubuntu), RX 5700 XT (gfx1010): hardware oracle measurement above; the new `agc_driver_image_volume_address_on_line` execution test passes. - Windows 11 (10.0.26200), RX 5700 XT (AMD driver 32.0.21045.5002), WinLibs GCC 15.2.0: `agc_driver_image_volume_address_on_line` and `agc_shader_disk_cache` pass. On this Windows driver, `agc_driver_image_plane_address_on_line`, `..._on_line_implicit_lod`, `agc_driver_image_volume_address_on_plane` and `..._planar_texture` fail with zero texels on plain `main` too, without this change. - Game: SONIC SUPERSTARS (PPSA06888) on `main` + this PR + #4474. The 3D-on-1D sample and load accesses no longer refuse; the title still stops at a 3D comparison sample on the same kind of 1D T#, which this PR leaves refused because it is not measured. ### 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)](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)](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] Unblocks: none yet; SONIC SUPERSTARS (PPSA06888) next stops at a 3D comparison sample on a 1D T# - [x] AI-assisted: yes (Claude) 🤖 Generated with [[Claude Code](https://claude.com/claude-code)](https://claude.com/claude-code)
mrfelek commented 2026-10-14 12:50:22 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mrfelek on 2026-10-14T12:50:22Z.


Correction to this comment

I misread the dimension in my first version of this report. In RdnaImageDimension, dim 3 is Dim2D (Dim3D is 4), so the Castlevania: Belmont's Curse (PPSA35399) stop was a DIM 2D depth-compare sample (depthCompare=1) on a 1x1 1D T# (type 8, format 7), not a 3D comparison.

That is the case #5456 covers, with the same error text in its description. #5456 is merged, and on main 8f9240f06 (with #5375 and #5456 both in, no other changes) the title gets past it and reaches gameplay (screenshot and details in discussion #5832).

What I wrote before about this PR leaving "the 3D comparison" refused, and about no open PR covering it, does not apply to Castlevania. Sorry for the noise.

AI-assisted; the runs are from my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6168739213 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5375#issuecomment-6168739213). Originally posted by [mrfelek](https://github.com/mrfelek) on 2026-10-14T12:50:22Z. --- ## Correction to this comment I misread the dimension in my first version of this report. In `RdnaImageDimension`, `dim 3` is `Dim2D` (`Dim3D` is 4), so the Castlevania: Belmont's Curse (PPSA35399) stop was a **DIM 2D** depth-compare sample (`depthCompare=1`) on a 1x1 1D T# (type 8, format 7), not a 3D comparison. That is the case #5456 covers, with the same error text in its description. #5456 is merged, and on `main` 8f9240f06 (with #5375 and #5456 both in, no other changes) the title gets past it and reaches gameplay (screenshot and details in discussion #5832). What I wrote before about this PR leaving "the 3D comparison" refused, and about no open PR covering it, does not apply to Castlevania. Sorry for the noise. AI-assisted; the runs are from my machine.
KauaSantos702 commented 2026-10-14 13:45:33 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by KauaSantos702 on 2026-10-14T13:45:33Z.


NVIDIA run at this head (0bcc6b4e1), adding a vendor to the AMD results in the body: no agc_* test fails.

  • NVIDIA GeForce RTX 5070 (Blackwell), driver 32.0.16.1714, Windows 11
  • WinLibs GCC 15.2.0 r7, Release, BUILD_TESTING=ON
  • ctest -R '^agc_' -j2: 484 tests, 483 passed, 0 failed, 1 skipped. The skipped test is agc_driver_stencil_ref_export, because the device lacks VK_EXT_shader_stencil_export; it is also skipped on main.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6169831039 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5375#issuecomment-6169831039). Originally posted by [KauaSantos702](https://github.com/KauaSantos702) on 2026-10-14T13:45:33Z. --- NVIDIA run at this head (`0bcc6b4e1`), adding a vendor to the AMD results in the body: no `agc_*` test fails. - NVIDIA GeForce RTX 5070 (Blackwell), driver 32.0.16.1714, Windows 11 - WinLibs GCC 15.2.0 r7, Release, `BUILD_TESTING=ON` - `ctest -R '^agc_' -j2`: 484 tests, 483 passed, 0 failed, 1 skipped. The skipped test is `agc_driver_stencil_ref_export`, because the device lacks `VK_EXT_shader_stencil_export`; it is also skipped on `main`.
billythemenace2 commented 2026-10-14 15:51:43 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by billythemenace2 on 2026-10-14T15:51:43Z.


@mrfelek Thanks for the second title.

Rebase: done in deb60d761, on main 066b58fa1. fieldCount<ImageResource>() is 38, the minimum image record is 76 bytes, and FormatVersion is 32, since this PR changes the encoded info. agc_driver_image_volume_address_on_line, agc_shader_disk_cache and agc_shader_memory pass on an RX 5700 XT.

DIM 3D comparison on a 1D T#: right, this PR adds only the plain sample and the load, and keeps image_sample_c* through DIM 3D refused. That access needs its own hardware measurement before it can be modeled, the way #5456 measured the DIM 2D comparison, so it belongs in a separate PR rather than in this one.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6172408228 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5375#issuecomment-6172408228). Originally posted by [billythemenace2](https://github.com/billythemenace2) on 2026-10-14T15:51:43Z. --- @mrfelek Thanks for the second title. **Rebase:** done in `deb60d761`, on `main` `066b58fa1`. `fieldCount<ImageResource>()` is 38, the minimum image record is 76 bytes, and `FormatVersion` is 32, since this PR changes the encoded info. `agc_driver_image_volume_address_on_line`, `agc_shader_disk_cache` and `agc_shader_memory` pass on an RX 5700 XT. **DIM 3D comparison on a 1D T#:** right, this PR adds only the plain sample and the load, and keeps `image_sample_c*` through DIM 3D refused. That access needs its own hardware measurement before it can be modeled, the way #5456 measured the DIM 2D comparison, so it belongs in a separate PR rather than in this one. AI-assisted (Claude Code).
github-actions[bot] commented 2026-10-14 18:37:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-14T18:37:10Z.


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
#5583 core/shader/recompiler/Optimization/src/ResourceTracker.cpp L1510
docs/dev/debt/shader.md L70
#5841 core/shader/recompiler/Optimization/src/ResourceTracker.cpp L1510
docs/dev/debt/shader.md L70
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6175588880 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5375#issuecomment-6175588880). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-14T18:37:10Z. --- <!-- 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 | |---|---|---|---| | #5583 | `core/shader/recompiler/Optimization/src/ResourceTracker.cpp` [L1510](https://github.com/boykopovar/AnyPS5/blob/9a22507ef9fd7b315217db20269dcb46671af16f/core/shader/recompiler/Optimization/src/ResourceTracker.cpp#L1510)<br>`docs/dev/debt/shader.md` [L70](https://github.com/boykopovar/AnyPS5/blob/9a22507ef9fd7b315217db20269dcb46671af16f/docs/dev/debt/shader.md#L70) | | | | #5841 | `core/shader/recompiler/Optimization/src/ResourceTracker.cpp` [L1510](https://github.com/boykopovar/AnyPS5/blob/9a22507ef9fd7b315217db20269dcb46671af16f/core/shader/recompiler/Optimization/src/ResourceTracker.cpp#L1510)<br>`docs/dev/debt/shader.md` [L70](https://github.com/boykopovar/AnyPS5/blob/9a22507ef9fd7b315217db20269dcb46671af16f/docs/dev/debt/shader.md#L70) | | |
adriadam10 commented 2026-10-14 19:16:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-14T19:16:08Z.


Checked the 3D-on-1D forms on the HW oracle (gfx1035): image_sample_lz with v and r ignored under clamp, wrap and border, image_load returning zero for z ≠ 0 and for x past the width, and an implicit-LOD image_sample whose LOD comes from u alone. All of them match DIM 1D bit for bit, as you measured on gfx1010. Full ctest passes, the new test also passes on CI's lavapipe, and it fails without the change, including when only the emitter's z check is removed. Merging.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6176338299 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5375#issuecomment-6176338299). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-14T19:16:08Z. --- Checked the 3D-on-1D forms on the HW oracle (gfx1035): `image_sample_lz` with v and r ignored under clamp, wrap and border, `image_load` returning zero for z ≠ 0 and for x past the width, and an implicit-LOD `image_sample` whose LOD comes from u alone. All of them match DIM 1D bit for bit, as you measured on gfx1010. Full ctest passes, the new test also passes on CI's lavapipe, and it fails without the change, including when only the emitter's z check is removed. 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!5375
No description provided.