feat(agc): draw into later slices of 2D-tiled PS4 color target arrays #18721
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/18721"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by puridanish284 on 2026-11-12T04:31:41Z.
What
A
CB_COLOR_VIEWof slice 1 or later of a PS4 (GCN) color target in a 2D-tiled mode (GcnDisplay2D,GcnThin2D) throwsGCN color views of a later slice of a 2D-tiled array, whose banks rotate per slice, are not implemented. #9675 made one-slice views render (Gang Beasts, CUSA04865, renders into single slices of a layered target) and left this case refused, because the texture path rotates the bank of each layer of a 2D-tiled array (c7a3fff544, #12998) and a color target was not placed that way (debt entry "PS4 color array slices"). A title that renders cube faces or texture-array slices one at a time into a 2D-tiled surface stops there.Such a slice now carries its layer's rotation as its bank XOR, the way a sliced PS5 color target folds its slice into
pipeBankXor:DecodeGcnColorBuffersetspipeBankXortoGcnLayerBankXor(GcnTiling(mode, element size), slice), the XOR the texture path applies to that array layer: (banks / 2 - 1) times the slice on the bank bits, as addrlib'sComputeBankFromCoorddoes forADDR_TM_2D_TILED_THIN1. The slice address stays the base plus the slice times the slice size.pipeBankXorinto the offset inside each macro tile (TextureDetile.comp, equation family), and each of their calls inTexture.cpppassesdescriptor.pipeBankXor, so the target's storage image is imported and written back at the rotated offsets with no other change.ColorTargetLayout, the CPU layout ofReadColorTargetandWriteColorTarget, now applies the XOR in the 2D-tiled GCN modes too, and refuses one outside their bank bits; the 1D-tiled and linear GCN modes take none.Unchanged: a view of several slices still throws. Slice 0 has no XOR, so every target
mainaccepts decodes as before. A later slice's CMASK base is not offset by the slice: single-sample GCN targets take no CMASK onmain, and multisampled later slices of the 2D-tiled modes throw.Debt: the "PS4 color array slices" entry now says how a later slice of the 2D-tiled modes is placed, and that a multisampled one throws.
Overlap:
tools/pr_overlap.py --branch claude/ps4-color-array-slicesagainstmainand the 1931 open pull requests reports no conflict among those it could merge, and fails closed on 48 that conflict withmainand shareState.cppor the debt file. None of the 48 changesDecodeGcnColorBufferor the "PS4 color array slices" entry; #9748's hunk next to the function addsArraySurfaceForTargetafter it, whichmainalready has. The branch merges cleanly with #18176, #18177 and #18207.Tested
Windows 11 with WSL2 Ubuntu 24.04.5 LTS (kernel 6.18.54.1-microsoft-standard-WSL2), gcc 13.3.0,
-DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON, test targets only, onmain177495a68f. No title or console.agc_driver_graphics: a new case checks, for both 2D-tiled color modes at 1 to 16 bytes per element and array slices 0 to 5, thatColorTargetLayoutwith the slice'sGcnLayerBankXorplaces every element of a surface two macro tiles wide where the test's addrlib referencereferenceGcnAddressplaces it for that slice, and that a XOR outside the bank bits, on a 1D-tiled mode or on a linear mode is refused.agc_gcn_color_target: slice 3 of a 32-bit Thin2D array decodes at the base plus three slices with XOR0x2800(5 << 11), slice 1 of Display2D with0x3800(7 << 11), slice 0 with none, slice 2 of Thin1D at the base plus two slices with none; slice 1 of a 4x Thin2D array is refused.agc_driver_gcn_color_array_slices(lavapipe): six-slice 128x64 RGBA8 Thin2D and Display2D arrays are filled with a position-coded background placed by the texture path's model (DescribeSurfaceof the 2D array,GcnTilingandGcnLayerBankXor). A triangle whose color encodes each pixel's position and slice is drawn into slices 0, 1, 2 and 5 through decodedCB_COLOR_VIEWs. After the flush, every texel at the texture path's offset holds its drawn color or its own background (3306 drawn texels per drawn slice), and slices 3 and 4 keep their background.DecodeGcnColorBuffer,agc_gcn_color_targetandagc_driver_gcn_color_array_slicesfail. With the XOR kept on the target but dropped from the surface the GPU tiles (SurfaceForTarget), the latter fails atThin2D slice 1: the texel the texture path places at (40, 0) holds 50 30 20 ff, neither its background nor the color drawn for it(the color drawn for (80, 48)). Without the XOR inColorTargetLayout's GCN offset,agc_driver_graphicsfails atPS4 color tile mode 258 at 1 bytes places element 0,0 of array slice 1 at 0, addrlib places it at 14336.ctest -R '^(agc_driver_graphics|agc_gcn_color_target|agc_driver_gcn_.*)$' -V, onmain177495a68f(8 tests) and on this branch (9 tests), withANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1andVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation(Ubuntu's 1.3.275 layer throughVK_LAYER_PATH). All pass on both, neither log containswas not found but was requested by env var VK_INSTANCE_LAYERS, and each GPU test logs onlyVUID-VkDeviceCreateInfo-pNext-pNextonce at device creation on both sides (the old layer does not know the repository's newer structs, #17693). The branch adds noVUID-.python3 tools/check_conventions.py --base upstream/main: all conventions checks passed.tools/check_test_registration.py: no new test left unregistered.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)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-12T04:43:32Z.
Review: COMMENTED
Reviewed — current-base test evidence incomplete
I reviewed all six changed files at head
d7899ab4927ae9db355e5dad88e3f0fe5dba79eeagainst basec85dcfd0056e0e341c3a2f5e285c94602353a7b7; I found no substantiated code blocker, but the reported paired Vulkan run used an older baseline and required hosted checks are still queued.What I ran
Environment: Debian 12 Linux, Python 3.11.2, GCC 12.2.0. No build or C++ test was run locally.
The precheck pinned the exact head and base above and confirmed both remained unchanged through its run. I also read all six changed files, their relevant call paths, and the test registration in the changed head.
Results
Precheck details
Negative control
The author reports mutation checks that remove the XOR at decode, GPU surface mapping, and CPU target offset, with the corresponding tests failing. I did not run these controls myself, so they are author-reported evidence only.
Findings
Blocking
None found in the six changed files reviewed.
Non-blocking
The PR description reports paired focused runs using
177495a68f4b4f16d0baba3ba73c55654e42a386as main. The current review base isc85dcfd0056e0e341c3a2f5e285c94602353a7b7, which contains a later change toTexture.cpp, a path used by the tiled upload/detile flow. The old-baseline run therefore does not verify this PR combined with the current base. Please rerun the same focused main/PR comparison on the current base and report the exact SHAs and validation-layer comparison. This evidence gap is not, by itself, a code defect, so I am not requesting changes.Sources
Not verified
Texture.cppchanges.To get this to a good state
Rerun the same focused Vulkan test on the current
mainand PR head, on the same machine, and include both exact SHAs plus the validation-layer comparison. I will re-check the evidence and the required hosted checks on the resulting head before considering approval.