Skip to content

feat(agc): accept 8_8_8_8 UINT color targets - #1736

Merged
adriadam10 merged 2 commits into
boykopovar:mainfrom
TheAggie:feat/agc-color-8888-uint
Oct 10, 2026
Merged

adriadam10 merged 2 commits into
boykopovar:mainfrom
TheAggie:feat/agc-color-8888-uint

Conversation

@TheAggie

@TheAggie TheAggie commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

What

COLOR_8_8_8_8 with number type UINT threw unsupported color format 10 number type 4 component swap 0. RADV renders into R8G8B8A8_UINT images through it. With #1073, ccleste (PPSA59322) writes such a target with a UINT16_ABGR export, and it was the last draw ccleste dropped.

This builds on #1073, which accepts that export and validates the uvec4 output. Its first commit is #1073's and drops out once that merges.

  • COLOR_8_8_8_8 UINT decodes to VK_FORMAT_R8G8B8A8_UINT for component swaps 0, 2 and 3, with the same reversed export mappings as the other 8_8_8_8 types.
  • The alternate swap (1) still throws. It would need B8G8R8A8_UINT, which Vulkan does not require as a color attachment, unlike R8G8B8A8_UINT.
  • Tests:
    • agc_driver_graphics (uint8x4TargetTests): the target decodes as R8G8B8A8_UINT with uintExport set, swaps 2 and 3 decode, and swap 1 throws.
    • New GPU test agc_driver_uint8x4_color_target draws a compressed UINT16_ABGR export into a linear 256x64 8_8_8_8_UINT target. It requires every channel's byte inside the scissor and the untouched bytes outside it. It fails with unsupported color format 10 number type 4 component swap 0 without this change.

Tested

Windows 11 Pro (26200), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release, NVIDIA GeForce RTX 5070 Ti.

Not tested on AMD, Intel or Linux.

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: feat(agc): accept UINT16_ABGR color exports into unsigned integer targets #1073
  • AI-assisted: yes

🤖 Generated with Claude Code

alfalfa-star and others added 2 commits October 8, 2026 18:46
…gets

SPI_SHADER_COL_FORMAT 7 (UINT16_ABGR) was rejected by DecodeState,
though the recompiler already handles it: a pixel shader's MRT output
under mode 7 is a uvec4, and a compressed export's 16-bit halves are
taken with OpBitFieldUExtract. The format is now accepted when the
target's CB_COLOR_INFO number type is UINT; into any other target it
still throws, as does SINT16_ABGR (8), whose halves would need sign
extension.

The target records the export (ColorTarget::uintExport). Shader
validation then requires a uint4 output at its location instead of a
float4 one, and blending into it is refused (Vulkan has no blending of
integer attachments).

PPSA14632 (LEGO Horizon Adventures) writes a 2848x1600 R8_UINT target
this way; those draws were dropped.

agc_driver_pixel_uint16_export draws compressed MRT0 exports under mode
7 into a linear 16_16_16_16 UINT target, one row per pair of packed
words (0x0000ffff/0xffff0000, 0x00010002/0xffffffff and four distinct
halves), and reads every 16-bit component back under the identity,
STD_REV and ALT_REV export mappings. agc_driver_graphics covers the
decode and the blend refusal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@johnmaia

johnmaia commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Linux run, since the description lists AMD and Linux as not tested: Ubuntu 24.04.5 (kernel 6.8), GCC 13.3, Release, AMD Radeon RX 7600 (RADV NAVI33, Mesa 25.2.8). This PR's head 0b9b70fa (including #1073's commit), merged onto main 6b56175a.

Full ctest: 481/481 pass, with the GPU tests running on the RX 7600 (none skipped). That includes the new agc_driver_uint8x4_color_target, #1073's agc_driver_pixel_uint16_export, and agc_driver_graphics with uint8x4TargetTests.

@adriadam10

Copy link
Copy Markdown
Collaborator

Checked on RADV (Radeon 660M): agc_driver_graphics and agc_driver_uint8x4_color_target pass, and both fail without the State.cpp change. The GPU test pins every channel byte and the untouched bytes outside the scissor. The existing UINT16_ABGR TechnicalDebt entry already covers out-of-range values into a narrower target. Also confirmed by @johnmaia on RX 7600 (481/481). Merging.

@adriadam10
adriadam10 merged commit 6f51afa into boykopovar:main Oct 10, 2026
6 checks passed
SleglJan pushed a commit to SleglJan/AnyPS5 that referenced this pull request Oct 10, 2026
…uint

feat(agc): accept 8_8_8_8 UINT color targets
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* docs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants