fix(shader): answer image_get_resinfo on 2D MSAA T#s #19682

Merged
c1b3r-p3d1a merged 3 commits from upstream-pr/19682 into main 2026-11-21 20:59:57 +00:00
c1b3r-p3d1a commented 2026-11-13 19:48:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by c1b3r-p3d1a on 2026-11-13T19:48:16Z.


What

image_get_resinfo on a 2D MSAA T# with 2, 4 or 8 fragments returned 0 levels under DIM 2D_MSAA and threw image address has too few coordinate components under DIM 1D. It now returns (width, height, 0, 1), the level component measured on RDNA2 with the hardware oracle in #18467 (recorded in docs/dev/debt/shader.md).

  • SpirvImageEmitter.cpp: the level component of a multisampled dimension query starts at 1 instead of 0 (SPIR-V has no level query on multisampled images).
  • ResourceMaterializer.cpp: a query-only DIM 1D image also gets a 2D MSAA view, gated like the existing query-only 2D/2D-array/3D/cube views (plain, non-depth, no conversion or packing), so read modes are unchanged.

Still throwing, as the debt entry now says: DIM 2D on a 2D MSAA T# (its views are shared with 2D reads), 2D MSAA-array T#s (the driver binds no type-15 texture) and 16-fragment T#s (refused as invalid descriptors). Not measured on the PS5's gfx1013.

Tested

Windows 11, WinLibs GCC 15.2.0 (x86_64-ucrt-posix-seh r7), Release, rebased on main 135da47a9c.

  • agc_driver_image_resinfo_dimension now also checks 2D MSAA T#s (SW_MODE 64KB_S, 2/4/8 fragments) under DIM 2D_MSAA and DIM 1D against (8, 8, 0, 1). It fails with each fix reverted: levels 0, and image address has too few coordinate components.
  • ctest -R "agc_driver|shader|recompiler": 1258/1267 pass. The 9 failures (agc_driver_f16_conversion_float_mode, float16_misc, float16_modifiers, float16_rounding, fp16_overflow, ldexp_f16_inline_constants, sdwa_ldexp_f16, vop2_modifier_forms, sample_order_grid_reference) were already failing on main on this machine in an earlier run today and do not involve image queries.
  • python tools/check_conventions.py --base origin/main: 0 errors; one warning that the existing debt entry is over 1000 characters (it already was on main).
  • Not run: Linux, a title.

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
  • Fixes: none
  • Unblocks: none
  • GPUs tested: AMD Radeon RX 7700 XT (RDNA3), driver 32.0.32015.7029, Windows 11
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5301845594 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/19682). Originally posted by [c1b3r-p3d1a](https://github.com/c1b3r-p3d1a) on 2026-11-13T19:48:16Z. --- ### What `image_get_resinfo` on a 2D MSAA T# with 2, 4 or 8 fragments returned 0 levels under DIM 2D_MSAA and threw `image address has too few coordinate components` under DIM 1D. It now returns (width, height, 0, 1), the level component measured on RDNA2 with the hardware oracle in #18467 (recorded in `docs/dev/debt/shader.md`). - `SpirvImageEmitter.cpp`: the level component of a multisampled dimension query starts at 1 instead of 0 (SPIR-V has no level query on multisampled images). - `ResourceMaterializer.cpp`: a query-only DIM 1D image also gets a 2D MSAA view, gated like the existing query-only 2D/2D-array/3D/cube views (plain, non-depth, no conversion or packing), so read modes are unchanged. Still throwing, as the debt entry now says: DIM 2D on a 2D MSAA T# (its views are shared with 2D reads), 2D MSAA-array T#s (the driver binds no type-15 texture) and 16-fragment T#s (refused as invalid descriptors). Not measured on the PS5's gfx1013. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> Windows 11, WinLibs GCC 15.2.0 (x86_64-ucrt-posix-seh r7), Release, rebased on `main` 135da47a9c. - `agc_driver_image_resinfo_dimension` now also checks 2D MSAA T#s (SW_MODE 64KB_S, 2/4/8 fragments) under DIM 2D_MSAA and DIM 1D against (8, 8, 0, 1). It fails with each fix reverted: levels 0, and `image address has too few coordinate components`. - `ctest -R "agc_driver|shader|recompiler"`: 1258/1267 pass. The 9 failures (`agc_driver_f16_conversion_float_mode`, `float16_misc`, `float16_modifiers`, `float16_rounding`, `fp16_overflow`, `ldexp_f16_inline_constants`, `sdwa_ldexp_f16`, `vop2_modifier_forms`, `sample_order_grid_reference`) were already failing on `main` on this machine in an earlier run today and do not involve image queries. - `python tools/check_conventions.py --base origin/main`: 0 errors; one warning that the existing debt entry is over 1000 characters (it already was on `main`). - Not run: Linux, a title. ### 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 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: <!-- #PR, or none --> none - [x] Fixes: <!-- issue it closes as Fixes #N, or none --> none - [x] Unblocks: <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> none - [x] GPUs tested: <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a --> AMD Radeon RX 7700 XT (RDNA3), driver 32.0.32015.7029, Windows 11 - [x] AI-assisted: <!-- yes / no --> yes
MarcZX10 commented 2026-11-21 03:48:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T03:48:00Z.

Review: APPROVED


Reviewed — looks good

Nothing blocks this change; the read code and supplied checks support merging.

What I ran

Reviewed head 5c9cc0632165d052c989ee24bc80270e2e7a8bbc using the pinned repo_read.py reader. No commands or tests were run by me; the environment and toolchain were not independently verified.

Results

Check Result Note
Changed code review passed Four changed files read
Automated tests not run Results below are author-reported
Negative control not run Not independently reproduced

Findings

Blocking

None.

Non-blocking

None.

Not verified

The author reports the execution check on RDNA3 and the hardware behavior measurement on RDNA2; neither was run by me. Linux and PS5 gfx1013 behavior were not verified. The review bundle contained no excluded changed files; all four files listed in the manifest as reviewed were read: ImageResinfoDimension.cpp, ResourceMaterializer.cpp, SpirvImageEmitter.cpp, and shader.md.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6002646354 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/19682#pullrequestreview-6002646354). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-21T03:48:00Z. **Review:** APPROVED --- # Reviewed — looks good Nothing blocks this change; the read code and supplied checks support merging. ## What I ran Reviewed head `5c9cc0632165d052c989ee24bc80270e2e7a8bbc` using the pinned `repo_read.py` reader. No commands or tests were run by me; the environment and toolchain were not independently verified. ## Results | Check | Result | Note | |---|---|---| | Changed code review | passed | Four changed files read | | Automated tests | not run | Results below are author-reported | | Negative control | not run | Not independently reproduced | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified The author reports the execution check on RDNA3 and the hardware behavior measurement on RDNA2; neither was run by me. Linux and PS5 gfx1013 behavior were not verified. The review bundle contained no excluded changed files; all four files listed in the manifest as reviewed were read: `ImageResinfoDimension.cpp`, `ResourceMaterializer.cpp`, `SpirvImageEmitter.cpp`, and `shader.md`. ## To get this to a good state Nothing is required.
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!19682
No description provided.