Skip to content

feat(agc): implement image atomics on 32_SINT and 32_FLOAT surfaces - #659

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
Celegans12:feat/agc-image-atomics-32bit-formats
Oct 5, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
Celegans12:feat/agc-image-atomics-32bit-formats

Conversation

@Celegans12

@Celegans12 Celegans12 commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

What

Recompiling a shader with an image atomic on any surface but 32_UINT throws (atomic image descriptor uses an unsupported format).

  • 32_SINT and 32_FLOAT surfaces are accepted with the Uint numeric class: a 32-bit image atomic takes one data dword and only the T# holds the format (LLVM GFX10 MIMG operands), so it is taken to act on the raw dword. The integer atomics and feat(shader): implement image_atomic_fmin, fmax and fcmpswap #562's compare-exchange loops (image_atomic_fmin/fmax/fcmpswap) are reused.
  • The driver binds these elements through a cached R32_UINT view of the R32_SINT or R32_SFLOAT storage image, which is already mutable-format. DescriptorBinding gains imageAtomic, stored in the shader disk cache (format version 4) and the resource content key.
  • Native OpAtomicFMinEXT/OpAtomicFMaxEXT is not used: its -0/+0 and sNaN results may differ from RDNA2, and NVIDIA 610.62 lacks shaderImageFloat32AtomicMinMax.
  • Other formats still throw, and the message now names the format. TechnicalDebt records that float results on 32_SINT and 32_FLOAT are assumed to match those measured on 32_UINT.
  • PPSA26344 v1.008: the wave64 compute shader at 0x80003e5e00 issues two image_atomic_fmax on a 960x540 32_FLOAT surface.
  • perf(agc): baseline shader recompilation on registration #639 also rewrites the storage image descriptor write in ShaderResources.cpp, the disk cache size asserts and FormatVersion (to 6); whichever merges second keeps both and takes a higher version. feat(agc): multisampled color and depth targets with CB resolves #419 and GTA V: the prologue plays (testing branch of the PRs it needs) #426 add a function directly above StorageTexture::createView, a context-only conflict.

Tested

  • Windows 11, MinGW-w64 GCC 15.2.0, based on main 53dc19c: configure -DBUILD_TESTING=ON, full build, --target libs, ctest:
  • 284/284 tests pass (ctest --output-on-failure)
  • agc_driver_image_atomics and agc_driver_image_atomics_float repeat every case on 32_SINT and 32_FLOAT surfaces, and the float test requires 16_16 float (format 29) to throw; on main both fail at the first 32_SINT case.
  • agc_shader_disk_cache round-trips imageAtomic; it does not build on main.
  • agc_driver_recorder_tests atomicViewTests (run by hand, not part of ctest): the view is reused for each format, and 8_8_8_8 throws.
  • PPSA26344 v1.008: agc_shader_replay of that shader's dumped request throws the message above on main; with this change it recompiles to an R32ui image with compare-exchange loops.
  • Not tested: a PPSA26344 run past this shader, PPSA21564 and Dreaming Sarah (expect a PPSA21564 gate), Linux (CI), console behaviour.

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

@github-actions

github-actions Bot commented Oct 5, 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
#419 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp L944-945

The resource materializer refused every atomic image descriptor whose
format was not 32_UINT. RDNA2 image atomics act on the raw dword and
the numeric format only affects addressing, so 32_SINT and 32_FLOAT
surfaces are now accepted with the Uint numeric class and run through
the existing integer atomics and float compare-exchange loops. Other
formats still throw, and the message now names the format.

DescriptorBinding gains imageAtomic, carried through the shader disk
cache (format version 4) and the resource content key. The driver
binds those elements through a cached R32_UINT view of R32_SINT and
R32_SFLOAT storage images.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Celegans12
Celegans12 force-pushed the feat/agc-image-atomics-32bit-formats branch from a453de4 to 73c68c0 Compare October 5, 2026 15:51
@github-actions github-actions Bot added shader core/shader docs agc libSceAgc* labels Oct 5, 2026
@oneandonlydean
oneandonlydean merged commit 7df0923 into boykopovar:main Oct 5, 2026
3 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

Development

Successfully merging this pull request may close these issues.

2 participants