Skip to content

feat(agc): render into SW_64KB_Z_X color targets - #5506

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
codingreapermaps:feat/agc-z64kbx-color-targets
Oct 14, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
codingreapermaps:feat/agc-z64kbx-color-targets

Conversation

@codingreapermaps

Copy link
Copy Markdown
Contributor

What

Color targets with the SW_64KB_Z_X swizzle mode (0x18) stopped with AGC graphics: unsupported color tile mode. PPSA12361 (Transport Fever 2: Console Edition) renders into one in every frame of a map: the single-sample R32 float target its DB depth copy writes (CB_COLOR_ATTRIB3 = 0x4dc60000, 2688x1512), which its ambient occlusion pass then samples.

  • ColorTileMode::Z64KBX maps to TextureTileMode::kZ64KBX and uses that mode's texture equations and 64 KiB block geometry, as feat(agc): support 64 KiB display XOR color targets #4318 did for SW_64KB_D_X. It gets its own equation-cache slot.
  • Like SW_64KB_R_X, the Z_X equation has bits above the 64 KiB block (the inter-block pipe/bank swizzle), so the layout applies the equation to the block coordinates as it does for R_X targets. Without that, offsets outside the first block of a row differ from the texture equation.
  • Any 256-byte pipe/bank XOR below the block size is accepted, as for R_X targets and Z_X textures. Which of those bits the console honours is not measured; this is recorded in docs/dev/debt/libSceAgcDriver.md.

The equations themselves are unchanged: the texture tiling tests already check SW_64KB_Z_X addresses against AMD addrlib GFX10, and the new color tests check the color layout against those equations.

Tested

Windows 11, MinGW-w64 GCC 15.2.0, NVIDIA GeForce MX450 (driver 581.83).

  • agc_driver_graphics_tests: the observed descriptor decodes as Z64KBX, maps to kZ64KBX, keeps the 64 KiB alignment and XOR flag, and an FMASK swizzle mode of another family is refused. The 64 KiB layout loop now covers Z_X: for 1 to 16 bytes per element and a 0x4600 XOR, offsets across block boundaries match the Z_X equation, the size matches the texture geometry, and tiling round-trips. DecodeState splits a Z_X color base into its block address and pipe/bank XOR for 0, 0x4600 and 0xff00. All graphics tests pass.
  • agc_driver_uint8x4_color_target_tests: a UINT16_ABGR export into a Z_X target, without and with a 0x4600 XOR, lands at the right guest bytes, with resident targets and with APS5_NO_RESIDENT_TARGETS=1.
  • PPSA12361: with the depth copy of feat(agc): run DB depth copies into a single-sample R32 float target #5499 and the other local changes the title still needs, the R32 float target renders and the map shows. The first version of this change, without the bits above the block, passed the in-game frame but failed the layout test.
  • Built and tested on main at 8d98e8851.

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
  • Unblocks: PPSA12361 together with feat(agc): run DB depth copies into a single-sample R32 float target #5499 (no Game bring-up discussion yet)
  • GPUs tested: NVIDIA GeForce MX450, driver 581.83, Windows 11
  • AI-assisted: yes

SW_64KB_Z_X (0x18) color targets use the texture equations and 64 KiB
block geometry of that swizzle mode, including the equation bits above
the block that R_X targets already apply. PPSA12361 renders the R32
float copy of its depth into one.

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

github-actions Bot commented Oct 13, 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
#1186 docs/dev/debt/libSceAgcDriver.md L36

@github-actions github-actions Bot added docs agc libSceAgc* labels Oct 13, 2026
@oneandonlydean oneandonlydean self-assigned this Oct 14, 2026
@oneandonlydean

Copy link
Copy Markdown
Collaborator

The full build is green on this head. Before it goes in it needs one run by someone other than the author on the title this is for (title ID, GPU/OS, before/after on current main); could someone who has it post one?

@oneandonlydean
oneandonlydean merged commit 5744094 into boykopovar:main Oct 14, 2026
9 checks passed
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.

2 participants