feat(libSceAgcDriver): render into one array slice of a PS4 color target #9675
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/9675"
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 ntamas94 on 2026-10-22T07:45:10Z.
What
A GCN
CB_COLOR_VIEWthat selects an array slice threw "GCN color array slices are not implemented". Gang Beasts (CUSA04865, Unity) renders into single slices of a layered color target. A view of one slice (slice start equal to slice max) now addresses that slice: the surface base plus the slice index times the slice size. A view of several slices still throws, with its own message. A new debt entry, "PS4 color array slices", says so, and that bits [12:11] and [31:24] of the register are ignored because their behaviour is not measured.This moves the color-slice commit of Get-fix/AnyPS5#3 (opened against
ps4/limbo-gpu) tomain, as Get-fix asked there. It was stacked on #9431, which is merged; the branch now has currentmainmerged in. The Gnm packet and submission commits of that PR go in their own pull request on top of #9432.mainnow rotates the bank of each layer of a 2D-tiled PS4 array in the texture path, as addrlib'sComputeBankFromCoorddoes forADDR_TM_2D_TILED_THIN1(c7a3fff544). A color target of a later slice is not yet placed that way, so a view of slice 1 or later of the two 2D-tiled modes (GcnDisplay2D,GcnThin2D) now throws instead of rendering where the texture path would not read it; the 1D modes have no bank and take any slice. The debt entry says so.Tested
Windows 11 Pro (10.0.26200), WinLibs GCC, NVIDIA GeForce RTX 2080 (driver 617.14), Release build with
BUILD_TESTING=ON, on this branch with currentmain(bf80054e7c) merged in; #9431 is merged, so the branch's diff againstmainis this PR's own change:agc_driver_graphicspasses, with a new case for slices 0 and 2; three runs. A view of several slices still throws, but the test no longer pins that. Earlier, on #9431's head, withState.cppreverted to the base the test failed with "GCN color array slices are not implemented".tools/check_conventions.py --base main(bf80054e7c) with this title and description: no findings.mainbf80054e7c(100% tests passed out of 25, the depth, display-buffer and graphics tests of this stack) and this branch with thatmainmerged in (100% tests passed out of 1) withVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,ANYPS5_NO_SHADER_CACHE=1,ANYPS5_REQUIRE_VULKAN=1andVK_LOADER_DEBUG=warn,error,ctest -V, on the NVIDIA GeForce RTX 2080, driver 617.14, Windows 11 (10.0.26200), Vulkan SDK 1.4.363.0: themainlog carries the loader'sadding layers "VK_LAYER_KHRONOS_validation"line 62 times, this branch's log 0 times, and neither reportswas not found but was requested by env var VK_INSTANCE_LAYERS;VUID-ids onmain: 0, on this branch: 0, new on this branch: 0.agc_driver_graphicsdecodes state on the CPU and opens no Vulkan instance, so the layer has nothing to check in this branch's focused test; themainside covers the GPU tests of the stack.Linux was not run locally.
Checklist
main; no other open PR implements the same functions (currentmainbf80054e7cmerged in; #9431 is merged; searched open boykopovar/AnyPS5 PRs forCB_COLOR_VIEWand color array slices on 2026-10-22; #7668 offsets the CMASK of a PS5 color target slice and does not touch the GCN view)NotImplemented_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)Imported from boykopovar/AnyPS5. Originally posted by fogydes on 2026-10-22T08:54:11Z.
Verified against the branch. The view decode is right for PS4:
slice = view & 0x7ffand the one-slice rule viaRequire(((view >> 13) & 0x7ff) == slice, ...)— readingslice_maxand refusing any view whose start and max differ, plus the exclusive bits staying inside the gate. The slice offset folds intosurfaceAddressbefore anything downstream (base<<8 + slice * layout.Bytes()), with the preceding Require tyinglayout.Bytes()topitch * height * elementBytesso only the five slice-uniform accepted tile modes take that multiplication, and GCN 3D/thick modes throw rather than mis-offset. MSAA (samples == 1strictly) and fast clear (CMASK bit) are both refused up front. The render-target cache keys on the final address, so two slices of one base are distinct images to the cache — no stale-description reuse. Test covers slice 0, slice 2 and the two-slice rejection through the existing graphics test, and the debt row is updated.Two smalls:
RdnaDecoderintegration); reviewers of this PR alone should scope to theDecodeGcnColorBufferaddition and note that the surrounding hunks come from the declared dependencies.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T08:56:35Z.
Review: DISMISSED
The isolated feature commit adds a clear state-decoding test for slice 0, slice 2, and a multi-slice rejection, and the address calculation is consistent with the selected slice size. Current-main conventions and
git diff --checkpass. The PR is currentlyCONFLICTINGwithmain; its declared dependency #9431 is also conflicting, so the final merge result has not been validated against current main.Because this changes the AGC driver, CONTRIBUTING requires the same focused tests on
mainand the change withVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,ANYPS5_NO_SHADER_CACHE=1, andANYPS5_REQUIRE_VULKAN=1, usingctest -Von the same machine/GPU, plus confirmation that the requested validation layer loaded, no newVUID-errors were introduced, and the GPU details on the checklist. The report describesagc_driver_graphicsand title play on Windows/NVIDIA, but does not provide that required paired validation-layer comparison. Please attach both logs or summaries and update the GPU checklist, then rebase/coordinate with #9431 and rerun checks on the current merge commit. The existing hosted checks shown here are conventions/intake/labels only; no product build is reported.Imported from boykopovar/AnyPS5. Originally posted by ntamas94 on 2026-10-22T10:13:55Z.
Thanks. The conflict is #9431's (
Graphics/src/State.cpp); I will rebase once Get-fix has rebased #9431 and rerun the checks. Paired validation-layer run, now in the description:main(100% tests passed, main build7e2ba73e4) and this branch (100% tests passed) withVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,ANYPS5_NO_SHADER_CACHE=1,ANYPS5_REQUIRE_VULKAN=1andVK_LOADER_DEBUG=warn,error,ctest -V, on the NVIDIA GeForce RTX 2080, driver 617.14, Windows 11 (10.0.26200), Vulkan SDK 1.4.363.0: themainlog carries the loader'sadding layers "VK_LAYER_KHRONOS_validation"line 78 times, this branch's log 0 times (see below), and neither reportswas not found but was requested by env var VK_INSTANCE_LAYERS;VUID-ids onmain: 0, on this branch: 0, new on this branch: 0.agc_driver_graphicsdecodes state on the CPU and opens no Vulkan instance, so the layer has nothing to check in this branch's focused test; themainside covers the GPU tests of the stack.On fogydes's first point: the slice rule is now its own debt entry, "PS4 color array slices", which also says that
CB_COLOR_VIEWbits [12:11] and [31:24] are ignored because shadPS4 defines no fields there and the console's behaviour is not measured. It sits away from the "PS4 render targets" line that #9672 extends, so the two merge in either order.AI-assisted: yes (Claude Code)
🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by ntamas94 on 2026-10-22T13:21:58Z.
Rebased onto #9431's new head (
26d651d3e, onmain7e2ba73e4); the commit applied without conflicts, with the "PS4 color array slices" debt entry as posted.agc_driver_graphicspasses. Paired validation-layer run, now in the description:main(100% tests passed, main build7e2ba73e4) and this branch (100% tests passed) withVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,ANYPS5_NO_SHADER_CACHE=1,ANYPS5_REQUIRE_VULKAN=1andVK_LOADER_DEBUG=warn,error,ctest -V, on the NVIDIA GeForce RTX 2080, driver 617.14, Windows 11 (10.0.26200), Vulkan SDK 1.4.363.0: themainlog carries the loader'sadding layers "VK_LAYER_KHRONOS_validation"line 78 times, this branch's log 0 times (see below) and neither reportswas not found but was requested by env var VK_INSTANCE_LAYERS;VUID-ids onmain: 0, on this branch: 0, new on this branch: 0.agc_driver_graphicsdecodes state on the CPU and opens no Vulkan instance, so the layer has nothing to check in this branch's focused test; themainside covers the GPU tests of the stack.AI-assisted: yes (Claude Code)
🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-10-29T04:53:33Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
The slice-offset change does what it says for the tested 1D-tiled case, but the head conflicts with
main, the PR head does not compilelibSceAgcDriver, and for the two 2D-tiled modes the slice layout leaves out the per-slice bank rotation that AddrLib applies.What I ran
f6f04e92a879c92f08c898a6b58623b0c4cf2a9dmain:52c09d567d2fa453494dd720fcf53a98149468e4eefa50841267cd0bd5352af17248139445fb0613BUILD_TESTING=ON, in a clean worktree.Results
mainGraphics/include/GuestTextureResource.hpp,Graphics/include/State.hpp,Graphics/src/DepthSurface.cpp,Graphics/src/State.cpp,tests/Graphics.cppeefa508412)tests/Graphics.cpp(include line), trivialgit diff --checkcheck_conventions.py --base origin/mainagc_driver_graphics_testson the PR headlibson the PR headPipelineJournal.cppstatic_assertslibs+agc_driver_graphics_testson the constructed treeagc_driver_graphicson the constructed tree, validation envagc_driver_graphicsonmain, validation envVUID-lines (constructed tree /main)was not found but was requested by env var VK_INSTANCE_LAYERSVK_LAYER_KHRONOS_validationloader linesPR head
libsbuild failureWhen only the test target is built against the older prx, the test cannot run either:
Include conflict against #9431's current head
Negative control
On the constructed tree I restored only
Graphics/src/State.cppto its main + #9431 version, rebuiltlibsandagc_driver_graphics_tests, and reran the test. It fails as expected:I then put the PR's
State.cppback.Findings
Blocking
Conflicts with
main, including one of its own. This confirms MarcZX10's point with current data. The merge intomainconflicts in five files. Four of them come from the base stack.tests/Graphics.cppcomes from this PR's own commit, and it still conflicts when the commit is applied to #9431's current headeefa508412: the new#include "RdnaDecoder/RdnaInstructionDecoder.hpp"sits where #9431 now adds#include <limits>. An earlier comment said this branch adds no conflict of its own, but that no longer holds. Fix: rebase onto #9431's current head and keep both includes.The PR head does not compile
libSceAgcDriver. Thesizeof(State)andsizeof(ShaderStages)guards inPipelineJournal.cpp:38-39fail (792 vs 784, 116 vs 112). #9431 fixed this in its newer head (eefa508412, "update the pipeline journal layout guards for ShaderStages::legacyVertex"), but this branch is still based on the older26d651d3e0. The same rebase fixes it. Please rerun the focused test on the rebased head.Non-blocking
2D-tiled slices leave out the per-slice bank rotation.
State.cpp:1785moves the base byslice * layout.Bytes()and then lays the slice out like slice 0, for all five accepted tile modes, includingGcnDisplay2D(index 10) andGcnThin2D(index 14) atState.cpp:1778-1779. AddrLib uses the same slice offset (sliceBytes * slice), but forADDR_TM_2D_TILED_THIN1it also XORs the bank with((numBanks / 2) - 1) * slice(egbaddrlib.cppComputeBankFromCoord, lines 3001-3050). The stack's GCN tiler takes the tile-split rotation from that same function (TextureTiling.cpp:549-554) but not the slice rotation. Inside AnyPS5 the layout is self-consistent, because the texture path also places layersats * tiledSizewithout rotation. On the console, though, slices >= 1of a 2D-tiled target has its banks permuted. Data that reaches that memory any other way (pre-tiled assets, CPU or compute access by address) would not match. The new test only covers tile mode 5 (GcnThin1D,tests/Graphics.cpp:3092), which has no rotation. Suggested fix, either of:slice != 0on the 2D modes until the rotation is modelled; orlibSceAgcDriver.md:93) saying that slices of 2D-tiled targets are laid out without AddrLib's per-slice bank rotation.Covering a 2D mode with
slice != 0in the test would also help.On the paired validation run: I agree with the description that
agc_driver_graphicsopens no Vulkan instance. Both my runs show 0 loader lines for the layer, so this comparison carries no validation-layer evidence for this change. Since the change is CPU-side decoding only, I do not consider that blocking.Not verified
main: it conflicts, so I tested this PR's commit on main + #9431's current head instead, resolving the include conflict myself.base + s * sliceBytes.To get this to a good state
#include <limits>and#include "RdnaDecoder/RdnaInstructionDecoder.hpp"intests/Graphics.cpp.libsbuilds and thatagc_driver_graphicspasses on the rebased head.slice != 0onGcnDisplay2D/GcnThin2D, or document the missing per-slice bank rotation in the debt entry.Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-10-29T10:17:17Z.
Review: APPROVED
Re-checked — approved
Since my last review, the branch has current
mainmerged in, the debt entry now records the missing 2D-tiled bank rotation, and the test no longer pins a several-slice view as throwing. The PR now merges cleanly,libsbuilds, the focused test passes, and the negative control fails as it should.What changed since my last review
897e753b4bandb2a01f21fbmergemain(aaccd0ba39, thenf7e84c4cf1) into the branch. #9431 merged on 2026-10-29. The branch's three-dot diff againstmainis now this PR's three files only:Graphics/src/State.cpp,tests/Graphics.cppanddocs/dev/debt/libSceAgcDriver.md.f19fd8627fremoves the several-slicesexpectFailureline fromgcnColorSliceTests, as oneandonlydean asked. It also adds a sentence to the "PS4 color array slices" debt entry about 2D-tiled slices.f7e84c4cf1as themainit was tested against.What I ran
b2a01f21fb731e86329764715ab7fb097609d383main:f99d7fece316e31878f0195f8bbc2ad2fbe635e4b6798281244ffe8589e325626f191c93209cedd2BUILD_TESTING=ON, in a clean worktree.maingit diff --checkcheck_conventions.py --base origin/mainlibs+agc_driver_graphics_testson the merge commitagc_driver_graphics, validation env, merge commitagc_driver_graphics, validation env,mainVUID-lines (merge /main)was not found but was requested by env var VK_INSTANCE_LAYERSVK_LAYER_KHRONOS_validationloader linesState.cppfrommain)Negative control output
Previous findings
main: Resolved. The merge intomainf99d7fece3is clean, and the three-dot diff contains only this PR's three files. The include line intests/Graphics.cppkeeps both<limits>andRdnaDecoder/RdnaInstructionDecoder.hpp; the second is needed forShaderRecompiler::SetGcnGuestShaders.libSceAgcDriverdid not compile (PipelineJournal.cppguards): Resolved.libsbuilds on the merge commit.libSceAgcDriver.md:120now says thatGcnDisplay2DandGcnThin2Dslices are laid out like slice 0, without AddrLib's rotation, and says what that affects. I agree with the author's reasons for not throwing on 2D modes and for not adding a test that would pin the unrotated offset.VUID-on both sides. The change decodes registers on the CPU only.New findings
Blocking
None.
Non-blocking
None. The new commit only removes the
expectFailureline. The slice 0 and slice 2 cases attests/Graphics.cpp:3361-3365still check the address computed atState.cpp:2124. A view of several slices still throws atState.cpp:2107, and the debt entry says so.Not verified
slice != 0, which no test covers. This gap is documented in the debt entry.base + s * sliceBytes.