Skip to content

feat(agc): add fragment-preserving R_X and Z_X layouts - #6588

Merged
1 commit merged into
boykopovar:mainfrom
Amoenus:codex/feat-msaa-texture-layout
Oct 21, 2026
Merged

1 commit merged into
boykopovar:mainfrom
Amoenus:codex/feat-msaa-texture-layout

Conversation

@Amoenus

@Amoenus Amoenus commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

What

Shared CPU layout foundation requested in #6570 for sample-preserving native depth publication. Adds MultisampleTextureLayout, including byte addresses, tile/detile and inverse block equations for single-mip 2D arrays with 2/4/8 fragments. R_X supports 1/2/4/8/16-byte elements; Z_X supports 1/2/4-byte elements. Fragment, layer and pipe/bank XOR contributions are retained. Transfers preserve element bytes and leave padding untouched; invalid shapes, unsupported modes and overlapping/short transfer buffers throw.

The equations come from AMD Addrlib at c5e80007, GFX10_SW_64K_{R,Z}_X_{2,4,8}xaa_PATINFO, row 20 + log2(elementBytes): non-RB+ 16-pipe GFX10, 256-byte interleave. Pattern selection follows GetSwizzlePatternInfo; the implementation uses the documented X/Y/layer/fragment bit masks. Technical debt records the configuration and lack of PS5 hardware measurement.

@simonbronk reports Onimusha: Way of the Sword (PPSA27836), after #6557, stopping at AGC graphics: sample-preserving guest publication of native multisample depth is not implemented. This PR supplies the shared layout primitive for that work; it does not remove the refusal, read back native depth, implement HTILE publication, or claim a title unblock. Depth publication and the color readback/publication consumer remain separate follow-ups coordinated in #6570.

Six files, one topic. Extracted from the retained experimental fork, adapted to current main. Reviewed related #6297 (uniform undrawn surfaces), #6146 (single-sample DB expand), #6444/#6445 (footprints), and open/merged searches for the new helper names; no equivalent shared fragment-aware address/transfer implementation found.

Tested

Source refresh — 2026-10-21

Head b8297adab9, based on main 745b3946294a9d79e1177a289482768d6ab88c9a. This supersedes the previous current-head labels in the historical qualification below.

  • Selected affected-library and native-fixture targets build on Windows 11 Enterprise 26200, WinLibs GCC 15.2 r7/UCRT Release, SPIRV-Tools ON. This refresh does not claim a new full-default build or full-suite result.
  • Exact-head agc_driver_msaa_layout passes three fresh processes. The two helper headers, implementation and fixture are byte-identical to the previous published head; CMake/debt context is refreshed. Earlier GPU-consumer evidence keeps its original pins.
  • Current-main conventions and patch whitespace pass. Newer reviewed main 2c4b116da9 merges cleanly; this is source review, not a runtime result at that newer pin. Earlier Linux, full-build, hardware-reference and negative-control results retain their original pins. No new title or speed result.
Earlier qualification at its recorded pins Windows 11 Enterprise 10.0.26200; required WinLibs GCC 15.2.0 r7, Release, BUILD_TESTING=ON. Base `31cbb55d755585e3e87052f793dc3faccea4ecae`, submission `f506edb26f19cc668e1996752f554a28ee69de75`.
  • Exact submission sources: 5 fresh runs, each matching pinned Addrlib on 288 geometry cases and 6,477,984 exact byte addresses, including the reported 128x64 shape. R_X/Z_X, supported element sizes, 2/4/8 fragments, 1/2/17 layers, small/asymmetric/3840x2160 extents, five nonzero pipe/bank XOR values. The 42 reference source files were verified against recorded Git blob/SHA-256 identities and the reference library rebuilt before comparison. Synthetic Navi1x configuration GB_ADDR_CONFIG=196; this is a source oracle, not a console measurement.
  • CPU fixture: all 24 fixed reference cases, tile/detile byte preservation, non-overlapping addresses, layer/fragment identity, inverse equations, untouched tile padding and buffer sentinels, unsupported inputs and refused short/overlapping transfers. Five fresh standalone passes and the registered CTest passes. Five separate external fault controls are caught: fragment zero, removed layer stride, wrong block aspect, overwritten padding, ignored pipe/bank XOR. Fault variants and investigation artifacts are excluded from the repository.
  • Full Windows app and libs builds, conventions and registration pass at validation composition 2edc249f8: submission plus only test(agc): align the indirect arguments block at run time #6452's independent Windows test-storage alignment correction. The current-main indirect fixture otherwise exceeds WinLibs' object-file alignment limit. No foreign dependency commit is bundled in this PR.
  • That composition passes 15 groups x 5 fresh repetitions per GPU selector, plus five further agc_driver_graphics runs per selector. Covers the new CPU layout test, existing sampled/native MSAA, depth clear/HTILE/storage/retirement, sample masks, staged reads and the alignment-dependent indirect fixture. No CTest failures, skips or timeouts; maximum 12.09 s. Physical GPU selection is verified in 13 NVIDIA and 13 AMD groups; CPU/mock groups are selector runs, not hardware coverage. Vulkan required, shader cache disabled, serial processes; no cold-driver-cache claim.
  • Cppcheck 2.20.0 then clang-tidy 23.1.3 on both added translation units with actual Windows compilation commands: no selected clang-tidy diagnostics; one Cppcheck containerOutOfBounds advisory at the inverse pivot swap. The short-circuit loop bounds the lookup, and Require(pivot < 16u) throws before the swaps; the invalid-equation fault control reaches that guard. Inspected and recorded as a control-flow false positive; no suppression, auto-fix or formatting changes. Analyzer time 6.46 s (26.304 s including scanning).

No fresh title launch, startup/FPS improvement or PS5 address-equivalence result is claimed. Selected Linux fixture coverage is recorded below; no full Linux application/suite claim. Maintainer-dispatched CI remains needed for other platforms.

Combined foundation refresh on main5d

Consumer foundation pin 82155cf97, handoff in #6570: main 5d9dcc42d + this layout helper + #6601 sampled reader + #6452's separate Windows test-build correction. This PR's layout header, implementation and fixture blobs are identical to the submitted head. Relative to the earlier 6f91c1b6 combined pin, only #6601's unsupported-count fixture handling changes; production code is unchanged.

  • Full Windows app/libs, conventions and registration pass. Five CPU layout processes plus 60 reader processes (six modes x five repetitions on each physical NVIDIA/AMD GPU), all pass; maximum 0.44 s. Hardware identities, drivers and OS are as above. CPU tests are not GPU evidence.
  • Ubuntu 24.04 WSL2, GCC 13.3, Release, bundled dependencies/SPIRV-Tools ON: build both fixture targets and dependencies; five CPU layout processes plus 30 reader processes all pass, maximum 0.15 s. Reader processes verify Mesa 25.2.8 lavapipe / llvmpipe (LLVM 20.1.2, 256 bits), running 4x and reporting unavailable 2x/8x; no whole CTest skips. Conventions and the Linux skip-policy check pass. This is selected-target coverage, not a full Linux app/suite build.

The fixtures exercise the helpers separately, not a connected depth/HTILE publication path or a title. Historical Addrlib comparisons above retain their original source pin; the CPU layout fixture was rerun here.

Refreshed combined handoff

Combined checkpoint 185ef412f includes main 896e1b2b7 with both shared foundations and the separate #6452 Windows test correction. The helper and fixture sources are unchanged from their submitted PR heads. The maintained #6570 handoff records fresh selected builds, 54 reader runs on NVIDIA/AMD/llvmpipe plus six CPU-layout runs, unsupported subcases, exact tested pins and the later CI-only main update. This is composition validation; the submitted head and its earlier full-build evidence remain separately pinned. Native depth/stencil publication, HTILE and title validation remain follow-up work.

Checklist

  • Based on current main d047690c63; no other open PR implements the same functions; historical results retain their original source pins
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw; no silent stubs
  • No notes, investigation files, images or generated build artifacts added to the repository
  • New third-party code is a submodule built from source: n/a; no library vendored
  • Generic behaviour, not specific to one title
  • Depends on: none (test(agc): align the indirect arguments block at run time #6452, the former full Windows test-build prerequisite, is merged)
  • Fixes: none
  • Unblocks: none by itself; shared foundation requested for PPSA27836 in AGC: compute buffer read of a native 4-sample D32 depth target needs sample-preserving publication (Onimusha: Way of the Sword, PPSA27836) #6570
  • GPUs tested: NVIDIA GeForce RTX 5080 (10de:2c02), driver 610.62 / 32.0.16.1062; AMD Radeon(TM) Graphics (1002:13c0), driver 32.0.21036.18; both Windows 11 Enterprise 26200. The added layout fixture is CPU-only
  • AI-assisted: yes, Codex; author responsible for every line

@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 1368 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 1395 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 2434 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/libSceAgcDriver.md
PR 4448 docs/dev/debt/libSceAgcDriver.md
PR 4449 docs/dev/debt/libSceAgcDriver.md
PR 5021 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 5058 docs/dev/debt/libSceAgcDriver.md
PR 5371 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 5372 docs/dev/debt/libSceAgcDriver.md
PR 5431 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 5499 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/libSceAgcDriver.md
PR 5925 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/libSceAgcDriver.md
PR 6044 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6186 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6187 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6188 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6192 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6194 docs/dev/debt/libSceAgcDriver.md
PR 6209 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6223 docs/dev/debt/libSceAgcDriver.md
PR 6280 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/libSceAgcDriver.md
PR 6300 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/libSceAgcDriver.md
PR 6412 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/libSceAgcDriver.md
PR 6481 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/libSceAgcDriver.md
PR 6501 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6548 docs/dev/debt/libSceAgcDriver.md
PR 6549 docs/dev/debt/libSceAgcDriver.md
PR 6747 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6788 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6808 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/libSceAgcDriver.md
PR 6867 docs/dev/debt/libSceAgcDriver.md
PR 6868 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/libSceAgcDriver.md
PR 6946 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/libSceAgcDriver.md
PR 6947 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/libSceAgcDriver.md
PR 6977 docs/dev/debt/libSceAgcDriver.md
PR 7048 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7201 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7256 docs/dev/debt/libSceAgcDriver.md
PR 7275 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7449 docs/dev/debt/libSceAgcDriver.md
PR 7505 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/libSceAgcDriver.md
PR 7514 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7604 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/libSceAgcDriver.md
PR 7642 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/libSceAgcDriver.md
PR 7800 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/libSceAgcDriver.md
PR 7910 docs/dev/debt/libSceAgcDriver.md
PR 8014 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/libSceAgcDriver.md
PR 8070 docs/dev/debt/libSceAgcDriver.md
PR 8395 docs/dev/debt/libSceAgcDriver.md
PR 8424 docs/dev/debt/libSceAgcDriver.md
PR 8484 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 8552 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 8564 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/libSceAgcDriver.md
PR 8592 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/libSceAgcDriver.md
PR 9020 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/libSceAgcDriver.md
PR 9077 docs/dev/debt/libSceAgcDriver.md

@Amoenus
Amoenus force-pushed the codex/feat-msaa-texture-layout branch from f506edb to f1a733d Compare October 16, 2026 16:25
@github-actions github-actions Bot added the unblocks title Names a title ID on the Unblocks line label Oct 18, 2026
@adriadam10 adriadam10 self-assigned this Oct 19, 2026
@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 19, 2026
@Amoenus
Amoenus force-pushed the codex/feat-msaa-texture-layout branch from f1a733d to 1ae663a Compare October 19, 2026 07:24
@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed and removed needs rebase Conflicts with main, rebase needed labels Oct 19, 2026
@Amoenus
Amoenus force-pushed the codex/feat-msaa-texture-layout branch from 1ae663a to 945b29a Compare October 19, 2026 15:51
@github-actions github-actions Bot removed needs rebase Conflicts with main, rebase needed unblocks title Names a title ID on the Unblocks line labels Oct 19, 2026
@Amoenus
Amoenus force-pushed the codex/feat-msaa-texture-layout branch from 945b29a to b8297ad Compare October 21, 2026 14:12
@oneandonlydean oneandonlydean closed this pull request by merging all changes into boykopovar:main in 4ec064d Oct 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants