Skip to content

docs(agc): name what shadPS4, fpPS4 and addrlib do for PS4 layered surfaces and display buffers - #13484

Merged
adriadam10 merged 1 commit into
boykopovar:mainfrom
xXPBSXx:docs-agc-ps4-gcn-sources
Oct 30, 2026
Merged

adriadam10 merged 1 commit into
boykopovar:mainfrom
xXPBSXx:docs-agc-ps4-gcn-sources

Conversation

@xXPBSXx

@xXPBSXx xXPBSXx commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

What

Two existing debt entries in docs/dev/debt/libSceAgcDriver.md get one sentence each about how other PS4 implementations differ from this code. The entries then read:

  • PS4 (GCN) thick and layered surfaces (libSceAgcDriver, PS4) - 3D and thick modes (GB_TILE_MODE 15 and 19 to 26) throw, and so does a storage image or a depth plane of a layered surface with several mip levels. A sampled layered surface with several mip levels is stored level by level, which is not checked on a console; GcnDetile.cpp runs the GPU detiler over every mode that does not throw. The bank of each layer of a tiled 2D array is rotated by (banks / 2 - 1) times the layer index outside the PRT modes, XORed in as AMD's address library and shadPS4 (tiling.comp, 0614ce324be0) do; fpPS4 (ps4_tiling.pas, 04cefd43e6fd) adds it to the bank instead. Not checked on a console.
  • PS4 render targets and display buffers (libSceAgcDriver, PS4) - a tiled PS4 display buffer is read as Display2DThin with rows padded to 128 elements, as shadPS4's image_info.cpp does. A PS4 render target spans its surface padded to whole macro tiles (1920x1080 at 32 bits is 1920x1088), the display buffer is its top-left corner, and a texture over that corner with the same pitch, tiling and texel size is a GPU copy of it. A PS4 DB_Z_INFO names a GB_TILE_MODE index; the depth image stays on the GPU and HTILE is kept, as for the PS5. shadPS4 (image_info.cpp, 0614ce324be0) rounds the width of a tiled display buffer up to a multiple of 128 itself, whereas DisplayBufferSize requires the pitch to be one already.

The new sentence in the first entry only records the comparison: the rotation of the bank per array layer has been implemented here since #12998, and it records that AMD's address library and shadPS4 XOR the rotation into the bank, where fpPS4 adds it. The second says shadPS4 rounds the width of a tiled display buffer up to 128 itself while DisplayBufferSize requires the pitch to be a multiple of 128 already.

Changed: docs/dev/debt/libSceAgcDriver.md, two existing entries. No code change.

Method: the three were read at the linked commits; only their behaviour is described, no code was taken over. shadPS4 tiling.comp L322-L335 and image_info.cpp L54; fpPS4 ps4_tiling.pas L2887-L2912; AMD addrlib egbaddrlib.cpp L3002-L3049. In fpPS4, xor and + have the same precedence in Pascal, so bank xor bank_swizzle + slice_rotation is evaluated left to right. The statements about this code were read in GcnLayerBankXor and TextureDetiler::layerBankXor (rotation, PRT modes get none) and in DisplayBufferSize (DisplayBuffer.cpp). sceVideoOutRegisterBuffers currently rejects a tiled PS4 buffer, so the display sentence is about that function, not about a title. None of this is measured on a console.

Overlap

Open PRs that change docs/dev/debt/libSceAgcDriver.md (file sets from git diff --name-only against each PR head's merge base, all 1422 open pull requests as of 2026-10-30 12:29 UTC, main 42d009f5f3; the 49 pull requests opened up to 13:25 UTC (1465 open, main da026c7065) change other files, and the pairs below were measured again at that time): 131 touch the file or are ours. Of the pull requests opened since 12:29 UTC, only #13373 (a new "Adaptive staging" entry) touches the file; it merges with and without this commit (checked at main ed1e0ed08f). Measured again on 2026-10-30 at 16:15 UTC against main 9304896d89 (1548 open pull requests): of the 46 pull requests opened since 14:15 UTC, only #13471 touches the file, and it merges with and without this commit; the five pairs below give the same result as before. Measured once more on 2026-10-30 at 16:56 UTC against main 556547da71 (1564 open pull requests, the head of each fetched fresh): 134 touch the file or are ours; the only ones that conflict with this commit but not with main are the five below, and #13373, #13471, #13474 and our other PRs (#12797, #12765, #12742) merge with and without it; #13491 and #13492, opened after the fetch, do not touch the file. Five give a new conflict with this change, all on the same lines: #9674 and #9891 rewrite the thick and layered surfaces entry, #9672 and #9895 the render targets and display buffers entry, and #9892 adds an entry next to them. Whichever of these merges second needs a rebase of the added sentence; the texts do not contradict each other. The others give the same merge result with and without this commit. Our other PRs (#12797, #12765, #12742) have no conflict with it.

Tested

Documentation only. tools/check_conventions.py --base upstream/main passes; both entries stay under 1000 characters; based on main da026c7065, and it merges with main 556547da71 without a conflict (checked 2026-10-30 16:56 UTC). Not built, not run.

Checklist

AI-assisted (Claude Code).

🤖 Generated with Claude Code

…rfaces and display buffers

Two sentences in the PS4 layered surfaces and display buffers entries. AMD's address library and shadPS4 XOR the bank rotation of an array layer into the bank, which this code does since the layer rotation change, and fpPS4 adds it. shadPS4 rounds the width of a tiled display buffer up to 128 itself, whereas DisplayBufferSize requires the pitch to be a multiple of 128 already. Nothing is claimed about the console.

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

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — looks good

The documentation-only changes match the pinned comparison sources and the implementation at the reviewed head.

What I ran

Reviewed head cd67746df82be1d967dd3aed81f349b50b48cb1c against base 556547da71c5e25b742f17b1ed9b27253b6e9d4d; the read-only merge preview onto current main at that base was clean. Environment: Linux x86_64, Python 3.11.2, GCC 12.2.0.

git diff --check 556547da71c5e25b742f17b1ed9b27253b6e9d4d...cd67746df82be1d967dd3aed81f349b50b48cb1c
python3 tools/check_conventions.py --base 556547da71c5e25b742f17b1ed9b27253b6e9d4d --head cd67746df82be1d967dd3aed81f349b50b48cb1c
python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 13484

I also inspected the cited external source lines at their pinned commits and the corresponding AnyPS5 implementation at the reviewed head.

Results

Check Result
Diff whitespace check Passed; no output
Conventions and PR template Passed
Current-main/dependency merge previews Clean for #13484 and the four dependencies parsed by the stack helper (#9672, #9674, #9891, #9895); those heads are not included in #13484. #9892 is named in the overlap note and is individually mergeable, but was not part of the parsed chain.
Source comparison Confirmed: AMD addrlib and shadPS4 XOR the layer rotation into the bank; fpPS4 adds it. shadPS4 rounds tiled display width to 128 pixels and DisplayBufferSize requires a pitch divisible by 128.
Aggregate precheck Incomplete: its test-quality helper was unavailable in the isolated checkout; this documentation-only diff has no tests to assess.
Unedited output
All conventions checks passed.

git diff --check produced no output. The precheck output was:

/tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-13484-cd67746df82b/report.md
/tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-13484-cd67746df82b/report.json
Conclusion: checks failed

The failed helper emitted:

/usr/bin/python3: can't open file '/tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-13484-cd67746df82b/head-cd67746df82b-4094f416/tools/pr_test_quality.py': [Errno 2] No such file or directory

Findings

Blocking

None.

Non-blocking

  • The PR description says its latest overlap scan ran at 2026-10-30 17:15 UTC against main 9304896d89. At the live snapshot for this review, it was 16:42 UTC and main was 556547da71c5e25b742f17b1ed9b27253b6e9d4d. Please replace the postdated scan and older Tested base reference with evidence from an actual current-main snapshot.

Sources

Not verified

  • No build or tests were run; the PR changes documentation only.
  • Hosted conventions, intake, labels and eligibility checks were queued at the final check snapshot.

@github-actions

github-actions Bot commented Oct 30, 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
PR 9892 docs/dev/debt/libSceAgcDriver.md L84-85

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 2434 docs/dev/debt/libSceAgcDriver.md
PR 4448 docs/dev/debt/libSceAgcDriver.md
PR 4449 docs/dev/debt/libSceAgcDriver.md
PR 5925 docs/dev/debt/libSceAgcDriver.md
PR 6185 docs/dev/debt/libSceAgcDriver.md
PR 6186 docs/dev/debt/libSceAgcDriver.md
PR 6194 docs/dev/debt/libSceAgcDriver.md
PR 6223 docs/dev/debt/libSceAgcDriver.md
PR 6273 docs/dev/debt/libSceAgcDriver.md
PR 6280 docs/dev/debt/libSceAgcDriver.md
PR 6300 docs/dev/debt/libSceAgcDriver.md
PR 6412 docs/dev/debt/libSceAgcDriver.md
PR 6481 docs/dev/debt/libSceAgcDriver.md
PR 6548 docs/dev/debt/libSceAgcDriver.md
PR 6549 docs/dev/debt/libSceAgcDriver.md
PR 6804 docs/dev/debt/libSceAgcDriver.md
PR 6808 docs/dev/debt/libSceAgcDriver.md
PR 6867 docs/dev/debt/libSceAgcDriver.md
PR 6977 docs/dev/debt/libSceAgcDriver.md
PR 7048 docs/dev/debt/libSceAgcDriver.md
PR 7256 docs/dev/debt/libSceAgcDriver.md
PR 7449 docs/dev/debt/libSceAgcDriver.md
PR 7604 docs/dev/debt/libSceAgcDriver.md
PR 7642 docs/dev/debt/libSceAgcDriver.md
PR 7844 docs/dev/debt/libSceAgcDriver.md
PR 7978 docs/dev/debt/libSceAgcDriver.md
PR 8014 docs/dev/debt/libSceAgcDriver.md
PR 8319 docs/dev/debt/libSceAgcDriver.md
PR 8542 docs/dev/debt/libSceAgcDriver.md
PR 8592 docs/dev/debt/libSceAgcDriver.md
PR 9356 docs/dev/debt/libSceAgcDriver.md
PR 9387 docs/dev/debt/libSceAgcDriver.md
PR 9432 docs/dev/debt/libSceAgcDriver.md
PR 9533 docs/dev/debt/libSceAgcDriver.md
PR 9592 docs/dev/debt/libSceAgcDriver.md
PR 9717 docs/dev/debt/libSceAgcDriver.md
PR 9742 docs/dev/debt/libSceAgcDriver.md
PR 9748 docs/dev/debt/libSceAgcDriver.md
PR 9915 docs/dev/debt/libSceAgcDriver.md
PR 10026 docs/dev/debt/libSceAgcDriver.md
PR 10064 docs/dev/debt/libSceAgcDriver.md
PR 10193 docs/dev/debt/libSceAgcDriver.md
PR 10233 docs/dev/debt/libSceAgcDriver.md
PR 10906 docs/dev/debt/libSceAgcDriver.md
PR 11104 docs/dev/debt/libSceAgcDriver.md
PR 11126 docs/dev/debt/libSceAgcDriver.md
PR 12120 docs/dev/debt/libSceAgcDriver.md
PR 12246 docs/dev/debt/libSceAgcDriver.md
PR 13146 docs/dev/debt/libSceAgcDriver.md

@xXPBSXx

xXPBSXx commented Oct 30, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for checking this. The times in the Overlap paragraph were my local time (UTC+1), not UTC, which is why the 17:15 measurement looked later than your 16:42 UTC snapshot; it was taken at 16:15 UTC. The body now gives every time in UTC (12:29, 13:25, 14:15 and 16:15 UTC).

I measured again on 2026-10-30 at 16:56 UTC against main 556547da71 (1564 open pull requests, the head of each fetched fresh): 134 touch libSceAgcDriver.md or are ours, and the only ones that conflict with this commit but not with main are still #9672, #9674, #9891, #9892 and #9895. #13373, #13471 and #13474 and our other PRs (#12797, #12765, #12742) merge with and without it. The head of this PR, cd67746df8, also merges with the newer main 6a3afa4deb without a conflict.

AI-assisted (Claude Code).

@adriadam10 adriadam10 self-assigned this Oct 30, 2026
@adriadam10
adriadam10 merged commit 7d9a2fc into boykopovar:main Oct 30, 2026
12 checks passed
@adriadam10

Copy link
Copy Markdown
Collaborator

Checked the added sentences against the code (layerBankStep = prt ? 0 : banks / 2 - 1 XORed in GcnLayerBankXor; DisplayBufferSize requires a pitch multiple of 128), conventions green, docs only; merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants