Repository navigation
fix(agc): rotate the bank of PS4 array layers like addrlib - #12998
Conversation
The reference address of a PS4 macro-tiled surface now takes the array layer and rotates the bank by (banks / 2 - 1) times the layer for the non-PRT modes, as the AMD addrlib does. The tiling test compares the layers of an array with it, and the GPU detile test writes layers 1, 2, 3 and 5 with that rotation. Both fail on main for the non-PRT modes from layer 1. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The layers of a PS4 macro-tiled array were placed by a plain offset. For the non-PRT modes the hardware model also rotates the bank by (banks / 2 - 1) times the layer index, which is not linear in the layer bits, so the detiler gets it as one XOR constant per layer through the existing bank/pipe XOR of its push constants. PRT modes, micro-tiled mips and bankSwizzle (0) are unchanged. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
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.
|
✅ NVIDIA GPU test: passedPR head
Unstable on main (1, these also failed in recent main runs on this machine; not counted against this PR)Failing on main too (5, not counted against this PR)Passed on retry (1, failed in the parallel run, passed when re-run with a 360 s timeout; not counted against this PR)Validation IDs already present on main (4 IDs in 397 tests)Skipped (40)ReproduceAutomated build and test on a contributor's NVIDIA machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs. |
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — looks good
The array-layer bank rotation matches the cited address-library rule and is covered by tiling and GPU detile tests; I found no blocking issue in the exact head reviewed.
What I ran
- PR head:
c7a3fff5445fae8de8497a87fdabc25c30b0677f. - Base:
upstream/mainatd820fef1827f27247cd28da7b4eec7891904bae5; current-main merge preview was clean (3056b89e4d4bd99822a2c30c5dd18cd415163ca6). The changed tiling, detiler, shader, and test paths have not changed on currentmainsince the PR's reportedbb04a4f1eacomparison base. - Environment: Linux x86_64; no local build or GPU tests run.
git diff --check upstream/main...refs/review/pr-12998-head
git merge-tree --write-tree upstream/main refs/review/pr-12998-head
python tools/check_conventions.py --base upstream/main --head refs/review/pr-12998-head
git diff --name-only bb04a4f1ea...upstream/main -- core/libs/prx/libSceAgcDriver/Graphics/include/TextureTiling.hpp core/libs/prx/libSceAgcDriver/Graphics/src/TextureTiling.cpp core/libs/prx/libSceAgcDriver/Graphics/src/TextureDetiler.cpp core/libs/prx/libSceAgcDriver/Graphics/shaders/TextureDetile.comp core/libs/prx/libSceAgcDriver/tests/TextureTiling.cpp core/libs/prx/libSceAgcDriver/tests/execution/GcnDetile.cppResults
| Check | Result |
|---|---|
| Patch whitespace | Pass; command exited 0 with no output. |
| Current-main merge preview | Pass; clean tree 3056b89e4d4bd99822a2c30c5dd18cd415163ca6. |
| Repository conventions | Pass. |
| Source review | Pass; the layer contribution is rotated in the bank bits for non-PRT macro-tiled modes, while layer 0, PRT, and micro-tiled mips remain unchanged. |
| Hosted CI | Windows product, eligibility, conventions, intake, labels, and report checks passed; Linux and specialized jobs were skipped. |
| GPU tests | The PR reports Windows tests on RTX 4080 SUPER and RX 6400, including failing controls on the test-only commit and passing results with the fix. An external report also records a GPU run on RTX 2000 Ada with no new failures or validation IDs. These were not run locally. |
Unedited local command output
python tools/check_conventions.py --base upstream/main --head refs/review/pr-12998-head
All conventions checks passed.
git merge-tree --write-tree upstream/main refs/review/pr-12998-head
3056b89e4d4bd99822a2c30c5dd18cd415163ca6
git diff --check upstream/main...refs/review/pr-12998-head exited 0 with no output. The current-main changed-path comparison also produced no output.
Sources
- PR-pinned texture tiling implementation
- AMD addrlib reference pinned to commit
393bf0d1467c4a7e208fd0d36b05b99438926079
Not verified
- I did not build or run GPU tests locally. Linux product CI was skipped, and no title or physical console was tested.
|
Checked the rotation against addrlib's non-PRT bank rule ( |
|
Fail-old/pass-new on RDNA 4, to add to the RX 6400 and RTX 4080 SUPER runs: AMD Radeon RX 9070 XT, AMD's Windows driver 32.0.32015.7029, Windows 11 Pro 22631, MSYS2 UCRT64 GCC 16.1, Release,
The failures match yours: AI-assisted: yes (Claude Code) |
What
The layers of a PS4 macro-tiled array were placed by a plain offset, with the same bank bits in every layer. For the non-PRT modes the AMD address library also rotates the bank by
(banks / 2 - 1)times the layer index, and applies it to the bank as one XOR of the sum with the bank swizzle (egbaddrlib.cppL3002-L3049). That is the XOR form shadPS4 uses; fpPS4 adds the rotation after the XOR instead.This adds
GcnLayerBankXor, the rotation of one layer as a constant in the bank bits of the address (shift taken from the tile geometry, bit 11 for the 8-pipe modes modelled here), and the detiler passes it with its existing bank/pipe XOR, so the shader is unchanged. The product(banks / 2 - 1) * layeris taken modulo the bank count; it is not a bitwise function of the layer index, so it cannot be folded into the swizzle equation. It applies to the non-PRT modes (Display2D,Thin2D,Depth2D*) from layer 1 and only to mips that are macro-tiled; PRT modes and the micro-tiled small mips are unchanged. The bank swizzle of the surface is taken as 0, as before.Only surfaces with a
gcnPitch(PS4 GCN) are affected; PS5 modes are not. A PS4 color target view of an array slice is rejected onmain(DecodeGcnColorBufferthrows for a slice other than 0), so no color-target path addresses PS4 array layers yet; a change that allows such a view with a plain slice offset would need this rotation as well. The rotation rests on the address library and the two emulators; it is not measured on a console, and no title that reaches it has been run.Commits: the test commit comes first and fails on
mainfor the non-PRT modes from layer 1; the fix commit makes it pass.Overlap
Open PRs that change
TextureTiling.hpp,TextureTiling.cpp,TextureDetiler.cpp,TextureDetile.compor the two teststests/TextureTiling.cppandtests/execution/GcnDetile.cpp(file sets fromgit diff --name-onlyagainst each PR head's merge base, all 1470 open pull requests as of 2026-10-29 19:20, mainbb04a4f1ea): 26 touch these files or are ours.git merge-treeof this branch against each of them gives the same result with and without these commits, so none of them gets a new conflict from this PR. #9674 (tile mode 19) edits the same files and merges without a text conflict; a trial merge of both builds, and the tests below pass on it. The 16 pull requests opened since then (#12979 to #12994, checked 2026-10-29 20:25 against main58b2753d74, which did not change these files) touch none of them. No open PR adds a bank rotation for array layers. Re-checked when opening against the 14 pull requests opened since 19:20 and main420b6a064e(which has not changed these files): none of them touches them.Tested
Windows 10 Pro 10.0.19045.
agc_driver_gcn_detile_tests(GPU) andagc_driver_graphics_tests(the CPU tiling tests among them), with 1 and 2 mip levels and array layers 0 to 5:a12f933bb8alone, on top of mainbb04a4f1ea: the GPU test fails on an NVIDIA GeForce RTX 4080 SUPER and on an AMD Radeon RX 6400 at array layer 1 (detiled as 204, expected 0), and the tiling test fails withis at 524288, addrlib places it at 538624.c7a3fff544: all three pass, the GPU test on both GPUs (RTX 4080 SUPER, driver package 32.0.16.1074; RX 6400, 32.0.21033.3005, as reported by Windows).356cb639ef): the same three runs pass.tools/check_conventions.py --base upstream/mainpasses. No title was run.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)AI-assisted (Claude Code).
🤖 Generated with Claude Code