Skip to content

fix(shader): give an emulated comparison of a 2D-array access a plain 2D mode - #2936

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
oneandonlydean:up3/emulated-compare-array-on-2d
Oct 10, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
oneandonlydean:up3/emulated-compare-array-on-2d

Conversation

@oneandonlydean

Copy link
Copy Markdown
Collaborator

What

Fixes #2712.

RuntimeImageModes gives the native modes of a 2D-array access a plain Dim2D variant (the plain mode in append), so a 2D-array instruction bound to a 2D T# finds a mode. The emulated comparison block adds only Dim2DArray and its cube variant. A comparison sample with a 2D-array address on a plain 2D color T# (format 56) takes the emulated comparison and finds no mode, and materialization throws:

compute shader 0x50059eb00: image descriptor is incompatible with the static runtime image interface

A title stops on this line on main, as reported in #2712 and #2871.

  • The emulated comparison of a 2D-array access now also gets a Dim2D mode, as its native modes already do.
  • EmitEmulatedCompareSample takes arrayed from the mode's dimension, so the 2D mode queries a 2D size and fetches with two coordinates and no layer.
  • TechnicalDebt: the slice is ignored, following the T# type as the native modes do; not measured on hardware for comparison samples.

This is the three-line change @EdouardSence tried in #2712 and @Kikoarl described there.

Tested

Linux (CachyOS, GCC 16.2, RTX 4090, NVIDIA 610.57), Release, on main 9c5d67f:

  • agc_driver_emulated_color_compare: new case, a bilinear comparison with a 2D-array instruction on a 2D 8_8_8_8 UNORM texture, matches the reference. On main it throws the line above.
  • Full ctest (701 tests) passes, except agc_driver_dcc_keys_first_write, which fails on main too.
  • tools/check_conventions.py passes.

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

🤖 Generated with Claude Code

… 2D mode

A comparison sample with a 2D-array address on a plain 2D color T# takes the emulated comparison, whose runtime modes were only the 2D-array and cube ones. No mode matched, and materialization threw that the image descriptor was incompatible with the static runtime image interface. The emulated comparison now also gets a 2D mode, as the native modes of a 2D-array access already have; the slice is ignored.
@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

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
#1190 docs/dev/TechnicalDebt.md L365

@github-actions github-actions Bot added shader core/shader docs agc libSceAgc* labels Oct 10, 2026
@fma-rc

fma-rc commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

Tested on NVIDIA and on RADV: the new test case fails without the ResourceMaterializer.cpp change and passes with it, and Astro Bot PPSA21564 gets past this stop.

Setup: Arch Linux 7.2.9, GCC 16.2.1, Release. RTX 5080 (NVIDIA 615.78.08) and Radeon 610M (RADV, gfx1036). PR head 27353e1 merged onto main 4a747c4.

The test (agc_driver_emulated_color_compare_tests, ANYPS5_REQUIRE_VULKAN=1):

RTX 5080 Radeon 610M
PR as is passes passes
PR with ResourceMaterializer.cpp reverted to main fails fails

Both failures are the line the PR describes: ShaderRecompiler::Recompile: image descriptor is incompatible with the static runtime image interface.

The title (Astro Bot PPSA21564 v01.007.000, RTX 5080, APS5_HOST_IMPORT_MIB=12288, one run each; relinked with main 57f96fd, libraries built from 4a747c4 plus the PRs named):

Libraries Result
main + #2653 stops after GAME: Level has started: title_controller_ship on compute shader 0x500599900: image descriptor is incompatible with the static runtime image interface
main + #2653 + this PR that stop is gone; goes on to LevelDocument Loaded: worldmap and stops later on compute shader 0x5006cdc00: AGC graphics: storage image access to depth/stencil surface 0x53a500000 is not implemented

Not established: whether the picture is right; I did not look at it. The rest of the test suite was not run with this PR.

@oneandonlydean
oneandonlydean merged commit b8284f6 into boykopovar:main Oct 10, 2026
14 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* docs shader core/shader

Projects

None yet

2 participants