feat(agc): render layered draws into a depth view of several slices #7256
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/7256"
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 gjonn on 2026-10-17T19:56:10Z.
What
Depends on: #7254. The first four commits of this branch are #7254's (its two changes, the review follow-up fix and its
agc_driver_layered_array_color_drawtest); this PR's own change is the last commit,feat(agc): render layered draws into a depth view of several slices.With #7254, PPSA01317 gets through the color side of a 512x512 cube map pass and then aborts with
layered rendering with a depth target is unsupported. The draw exports the render target array index into a six-slice color view, with aDB_DEPTH_VIEWof slices 0 to 5.DepthSliceBytesand oneHtileMetadataBytesfurther per slice). Each slice also keeps its own plane ownership, HTILE clears and plane copies. A later draw into one slice binds that slice's layer. Another layered view over some of the same slices (another first slice or slice count) is a separate array image that takes each slice by a whole-slice copy when it is bound.Behaviour change on an existing path: a depth-only layered draw into a multisampled or stencil-only depth view of several slices used to render silently into the first slice. It now throws.
Open debt:
SLICE_MAX. That clamp is not modelled; such a layer is undefined in Vulkan.#7194 changes the same HTILE slice-clear function in
DepthSurface.cpp(taking a later slice's clear when every word has ZMask 0). It works per slice and composes with the per-slice HTILE addresses here; the two branches merge without conflicts.Tested
Windows 11, NVIDIA GeForce RTX 5090 Laptop GPU, driver 616.92. Ninja/MinGW Release with
BUILD_TESTING=ON, on top of #7254 rebased onmain922dc8999.agc_driver_layered_depth_targetcovers a six-layer depth-tested draw:agc_driver_graphics_tests: new decode cases for depth-only layered views, color plus depth views of matching, shifted and mismatched slice counts, and views without the layer export staying single-layer.agc_driver_stencil_ref_exportis skipped because the device does not support it. The set is the layered depth target, graphics and decode state tests, every depth/HTILE/stencil execution test (agc_driver_depth_*,agc_driver_native_multisample_depth,agc_driver_sample_mask_depth_stencil,agc_driver_stencil_*), the array layer target test and the layered volume and vertex layer export tests.tools/check_conventions.py --base origin/mainandtools/check_test_registration.pypass.mainwith #7254 (checked in boots).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)Imported from boykopovar/AnyPS5. Originally posted by gjonn on 2026-10-17T21:27:12Z.
Rebased onto main
5f8d2a252via the rebased #7254 (force-push, head558975214). One conflict, in DepthSurface.cpp DepthSurfaceView: #7131 changed the inline bind code to use NoteHtileClear() instead of OR-ing pendingClear, and this PR had moved that code into bindSurface(). I kept bindSurface() and applied the NoteHtileClear() calls inside it, so the HTILE clears drop a pending plane fill for both single and per-slice binds. Each slice keeps its own depthFill/stencilFill, and RecordClear clears only its own layer. Rebuilt; all 666 agc_* tests pass, including agc_driver_layered_depth_target, agc_driver_depth_, agc_driver_stencil_, agc_driver_native_multisample_depth, agc_driver_sample_mask_depth_stencil, agc_driver_layered_array_color_draw and the new agc_driver_depth_plane_fill. check_conventions.py and check_test_registration.py are clean.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by frankea on 2026-10-18T04:15:20Z.
RTX 4090 data point on PPSA01317, on top of my #7254 run (same stack, same box). Short version: with this PR the cube map pass gets through its depth side as well, 3 of 3 runs, and the next stop is the sample of the cube it just rendered:
samples a converted float image that is not a 2D or 2D array view, which is #5958's own cube-view rejection and the case #7271 says it handles for format 43.Setup. Gran Turismo 7 PPSA01317 01.000.001 (base package), Windows 11 (26200), RTX 4090 (NVIDIA 616.92), AMD Ryzen 7 5800X, MinGW-w64 GCC 15.2.0 r7 (UCRT), Release
libstarget only (no tests built).app.exeis the relink frommain31cbb55d7(--windows --registry --module-dir .); onlylibs/is swapped between runs. Tree: the #7254 stack (main5f8d2a252+ #71372aa6bfca6+ #7207 ec28b6be8 + #7175 555b7e824 + #5958 87a9b8d28 + #7243da158d61f+ #72384aaf27699+ #72407c19c66de+ #7254ebe289bdc, 9ea37b61b, see the #7254 comment for the oneState.cppconflict) merged with this PR's head558975214(clean, b81f69024). ThelibSceSsl.prxis the one from #7319 (1f267559e). No controller, no input, nobody at the keyboard; one-shot interactive task per run, 600 s cap, box otherwise idle.Result. All three runs get past
layered rendering with a depth target is unsupported: splash, the black loading screen with the GT spinner (title-bar counter 29 FPS, 1,150 frames at the last capture of run 3), save data mounted, threesceNetResolverStartNtoa -> host DNS lookup failed, 392 further shaders registered, and then, identically every time:That message is #5958's
ResourceMaterializer.cppreject of a cube or non-2D view on a converted float image, so the pixel shader is now sampling the 10_11_11 float cube map that this PR and #7254 let the title render. No depth-side refusal of any other wording, nodepth view whose slice count differs, no device loss.layered rendering with a depth target is unsupportedshader 0x1258d31800 stage 5: samples a converted float image that is not a 2D or 2D array viewThe chain on this box so far, all on a
libsbuilt from the stack above: #6350 crash (#7137) ->sceSslConnect(#7319) -> 11_11_10 blend (#7243) -> dynamic-mip storage image (#7238) -> unnormalized sampler (#7240) -> layered colour view (#7254) -> layered depth view (this PR) -> converted float cube sample.stderr of run 3 (warm, box idle) from the second 10 s summary to the abort, the 392 per-shader
ShaderRegistrylines removedAI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-10-29T05:10:40Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
The layered depth path builds and its tests pass at the PR head. But the branch no longer merges into current
main, and a rebase has to rework the code it touches, so the change needs a rebase and a fresh test run.What I ran
5589752147fe73b1487bce01b985b83e70f42b15main:52c09d567d2fa453494dd720fcf53a98149468e45f8d2a252437a8dc607f0f52239946bb3f9b22a2All commands ran in a clean worktree on Arch Linux 7.2.11-zen, GCC 16.2.1, Intel Core i9-14900KF, NVIDIA GeForce RTX 4070 Ti SUPER (driver 615.78.08), with a Release, Ninja,
BUILD_TESTING=ONbuild.Results
main52c09d567git diff --checktools/check_conventions.py --base origin/mainAll conventions checks passed.libs)agc_driver_stencil_ref_exportskipped (this device does not support it)agc_driver_layered_depth_target5f8d2a252VUID-lines, PR head vs merge baseVUID-vkBeginCommandBuffer-commandBuffer-00050fromagc_driver_depth_storageandagc_driver_native_multisample_depth; none come from the changed tests, and the PR adds nonewas not found but was requested by env var VK_INSTANCE_LAYERSVK_LAYER_KHRONOS_validationin every testI compared validation against the PR's merge base, not against
main. The merged tree does not exist, and 11,535 commits separate the base frommain, so amainrun would not isolate this change.Merge conflicts
ctest at PR head (excerpt)
Validation messages (same in both runs)
20 lines from
agc_driver_depth_storageand 20 fromagc_driver_native_multisample_depth, at both the PR head and the merge base.Negative control
At the PR head I restored
DepthSurface.cpp,Draw.cpp,State.cpp,Texture.cppandTexture.hppfromebe289bdc7, the PR's last commit before its own change. I keptState.hpp(the newDepthTarget::layersfield) and the tests, then rebuilt. Both tests fail:After the run I restored the PR's files.
Findings
Blocking
The branch conflicts with
main. This confirms the conflict list in the earlier comment from oneandonlydean: the same six files, 20 hunks. The conflicts touch the code this PR changes. A rebase has to reapply the per-layer logic to code thatmainhas since rewritten:main, the direct image copy and theUNDEFINED -> TRANSFER_DST_OPTIMALdiscard barriers hard-code array layer 0 (DepthSurface.cpp#L735-L780 on main). That was correct for a one-layer image. On the shared array image this PR introduces, a fill of slice k would discard and overwrite layer 0, slice 0's contents. All four depth-image subresources there needlayer:depthRegion, the destination ofcopy, and bothdiscard.subresourceRange. The new test should also cover a direct-copy fill of a non-zero slice.mainallocates throughAllocateImageMemory(L316). Thearray != nullptrbranch has to keep that path.Textureconstructor onmaingained aVkImageUsageFlags usageparameter beforelayerCount. This PR'sSampled()call passes..., layer, owned, 1u. Rebased as is, that1uwould becomeusagerather thanlayerCount.Sampled()onmainnow goes through the multisample sample shadow (around L481). Thelayer,1uarguments must be carried into that call.Because the resolved code will differ from what was tested, the GPU results here and in the description need rerunning after the rebase.
Non-blocking
decodeDepthdoes not add the slice offset tohtileAddress, so all slices share slice 0's HTILE. ButdecodeDepthalready adds it (State.cpp:310 at the PR head, since8fec47a4b2). The new "Layered depth targets" entry (line 144) relies on that per-slice HTILE address. The stale entry predates this PR, but this PR now documents the opposite behaviour. Please remove or rewrite it while resolving the debt-file conflict.deb0ba305. This branch still carries its four pre-merge commits. After rebasing, those commits should go,Depends onshould readnone, and the description should drop "the first four commits of this branch are #7254's".I found no correctness problem in the PR's own logic at its base.
layerTargetsteps Z, stencil and HTILE by one slice from the decoded first slice, which matchesdecodeDepth. The layered image's view is torn down before the surfaces that share itsOwnedImage. The unimplemented cases (multisampled, stencil-only, mismatched slice counts) throw.Not verified
agc_driver_stencil_ref_export, which also skips on this device.To get this to a good state
main, dropping the pre-merge #7254 commits. Then carrylayerthroughmain's direct depth copy, discard barriers,AllocateImageMemorypath and sample-shadowTextureconstruction.agc_driver_layered_depth_targetthat fills a non-zero slice through the direct depth copy and then reads slice 0 back unchanged.mainand on the change. UpdateDepends ontonone.Imported from boykopovar/AnyPS5. Originally posted by CnRJay on 2026-11-01T19:52:37Z.
Review: COMMENTED
Points on 7256:
Comments in code.
Draw.cpp("DecodeColorBuffer offsets slice s by s times this size; every slice the image stores...") andtests/execution/LayeredArrayColorDraw.cpp(a four-line header comment) add comments. The rule is no comments except#endifand namespace ends.Graphics test protocol. This is an AGC change, so the same focused tests need to be run on main and on the change with
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, same machine and GPU, with a statement that no newVUID-lines appear. Please fillGPUs testedwith that result.Negative control. Does the new layered-array test fail on main for case (a) (slices 1..3 of a four-slice array) and case (b) (slices 0..2 of a one-slice surface)? Please paste the failing main output.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-16T20:27:11Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this change; the points below are optional.
What I ran
Reviewed head
6ceaa3963ca2c9ac5a2e362b6ea6b3f4e7dbc3adusing the prepared diff andrepo_read.pyat the pinned head. No commands or tests were run. The PR description reports GPU and related test runs; those were not performed as part of this review.Results
Findings
Blocking
None found in the code inspected.
Non-blocking
None.
Not verified
core/libs/prx/libSceAgcDriver/tests/Graphics.cppwas excluded from the review folder for size and was not read. All other changed files listed in the manifest were read, including the fullLayeredDepthTarget.cppdiff. No tests were run, and the author-reported hardware behavior and test results were not independently confirmed.To get this to a good state
Nothing is required.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.