feat(agc): render layered draws into a depth view of several slices #24083
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/24083"
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 sherySJ on 2026-11-20T05:42:19Z.
What
Carries #7256 by @gjonn:
feat(agc): render layered draws into a depth view of several slices. gjonn's commits and authorship are kept unchanged on top of his head6ceaa3963c; this branch adds a plain merge of currentmain(no rebase, no history rewrite) and two small commits. #7256 stays open, so gjonn can take this branch back or close #7256 in its favour. An ask on #7256 on 2026-11-18 got no reply in 48 hours.Without it a layered draw with a depth target throws
layered rendering with a depth target is unsupported. With it theDB_DEPTH_VIEWslice range is decoded as many layers as the colour views (or the depth view's own slices without a colour target), the slices share one single-sample 2D array image, each slice keeps its own Z, stencil and HTILE address, plane ownership, clears and copies, and a 2D array view of the image is attached. Multisampled layered depth and a layered target without a depth plane still throw.What the merge resolved (one conflicted file,
DepthSurface.cpp, six hunks, plus one hunk inDraw.cpp):findClearedHtile) kept, the PR'stakeClearedHtilesrebuilt on itdrawnDepths;RepeatDepthSurfaceViewandDepthTargetObligationusedrawnDepthsand decline a layered targetsameSurfacethensameLayoutWithinorder, after the PR's owner lookuprequireNativePlanesFreestays and its threeRequireNoResidentDepthReadcalls takestd::nullopt, true, DepthReadCause::ReuseXairRrR's review points of 29 Oct, re-checked against today's code: the layer index in the depth plane fill and its two discard barriers, the
AllocateImageMemorypath forarray != nullptr, and theusageargument of the depthTextureconstructor are right;Sampled()passed the slice's layer as the base layer even when the view sits on the multisample sample shadow image, fixed in its own commit. XairRrR also asked for a direct copy fill of a non-zero slice in the test:LayeredDepthTarget.cppnow stores a ramp into depth slices 1 and 4 through a pending storage image write, draws six layers with a depth target without HTILE (so each surface takes its plane by the direct copy into its own layer), and checks every slice by the depth test and by reading the depth back as a 2D array texture.Commits: gjonn's, then
Merge branch 'main' into feat/agc-layered-depth-targets,fix(agc): sample a depth slice through the multisample shadow from its first layer,test(agc): cover a direct-copy fill of a non-zero depth slice in the layered depth target test.Tested
Linux only, Intel HD Graphics 520 (Mesa 26.2.5 ANV) and llvmpipe, Release build, Khronos validation layer loaded (
VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,VK_LOADER_DEBUG=layershows the loader inserting it),ANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1. Windows not tested. Gran Turismo 7 and My First Gran Turismo not run (no dumps here).agc_driver_layered_depth_target,agc_driver_graphics,agc_driver_layered_array_color_draw,agc_driver_array_layer_target, 3 runs eachVUID-VUID-agc_driver_depth_*,agc_driver_layered_*,agc_driver_native_multisample_depth*,agc_driver_native_depth_*,agc_driver_sample_mask_depth_stencil,agc_driver_stencil_*, once, onmain(passes counted per run, the three focused tests that exist on main ran three times)The skips are
agc_driver_layered_volume_mesh(no mesh shader compile on these devices) and, on llvmpipe,agc_driver_stencil_copy_draw. The failure sets (empty) and theVUID-sets (onlyVUID-VkImageCreateInfo-samples-02258inagc_driver_stencil_copy_drawon llvmpipe, onmainas well) are identical; the three extra passes on this branch areagc_driver_layered_depth_target, whichmaindoes not have.agc_driver_graphicsmakes no Vulkan instance here, so it has no loader line.Negative control 1: keeping the tests and putting back
main'sDepthSurface.cpp,Draw.cppandState.cpp,agc_driver_graphicsfails withlayered rendering with a depth target is unsupportedandagc_driver_layered_depth_targetfails on both devices (HD 520:a layered draw after a draw into depth slice 2 alone: slice 2 texel (12, 0) is 0.750000, expected 0.250000andVUID-VkRenderingInfo-viewMask-10860; llvmpipe:slice 1 texel (0, 0) is 0.250000, expected 0.750000).Negative control 2: with the plane fill's direct copy and its two discard barriers pinned to layer 0, only the new case fails, on both devices:
slice 0 texel (0, 0) is 0.250000, expected 0.750000.python3 tools/check_conventions.py --base origin/main: 0 errors; the 2debt-lengthwarnings are on entries already onmainindocs/dev/debt/libSceAgcDriver.md. The debt changes are a fragment,docs/dev/debt/changes/feat-agc-layered-depth-targets.md, andtools/debt_fold.py --checkpasses.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)c4209d7275by @4le22io, focused set and full^agcset with the validation layer, no regressions; AMD RX 9070 XT (RADV, Mesa 26.2.6, Linux) atc4209d7275by @blawesom, includingagc_driver_layered_depth_target(PitchedSlices) and the mip decode case, with the validation layer gate, no new diagnostics; three AMD GPUs at35f303624d(before the mip stride fix) by @tablefrogpillowSummary by CodeRabbit
New Features
Bug Fixes
Documentation
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T06:07:13Z.
Review: COMMENTED
Reviewed — comments
No blocking defect was identified in the inspected code, but I could not run checks or verify the full changed test file.
What I ran
Reviewed head
35f303624d4da3df4e26c92f595032eb668698d0using the pinnedrepo_read.pyreader; no shell commands were run.Results
Negative control
The description reports two negative controls, but neither could be run in this review.
Findings
Blocking
None.
Non-blocking
None.
Sources
Not verified
The full
tests/Graphics.cpptext was excluded from the prepared review folder; I inspected its changed hunks through the reader. I also inspected the changed hunks, not every line, ofDepthSurface.cpp,State.cpp,Draw.cpp, andLayeredDepthTarget.cpp. The prepared description's build, test, validation-layer, negative-control, and conventions-check results are author-reported and were not run here. Windows and physical-console behavior were not verified.Files inspected:
review/description.md,review/commits.md,review/manifest.json,review/diff.patch,State.hpp, changed hunks inDepthSurface.cpp,State.cpp,Draw.cpp, andtests/Graphics.cpp, plus the addedtests/execution/LayeredDepthTarget.cppfrom the diff.docs/dev/debt/libSceAgcDriver.mdwas inspected in the diff only. The fulltests/Graphics.cppwas not included in the prepared folder.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T07:20:28Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the review found no verified defect in the inspected layered depth paths.
What I ran
Reviewed head
c4209d72753cd310d9736f22f3415df91669b054. Read the prepared description, commits, manifest, diff, and included changed files. ReadGraphics.cpponly around the changed test lines through the pinned reader. No commands or tests were run.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
The changed
Graphics.cppfile was too large to include in the review bundle; only its relevant changed test region was read from the pinned repository. No test execution, build, hardware run, or independent verification of the author-reported results was performed. The review-folder file listing showed all changed files as included exceptGraphics.cpp; all other changed files were read in targeted ranges.files.jsonwas not available through the reader, so its reviewed/excluded lists were not independently inspected.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-25T05:15:19Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the review evidence supports merging.
What I ran
Reviewed head
df5230ee4da7955c1435d4413211d3edfcff112b. No commands or tests were run in this review;description.mdreports author-run tests.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
I read
State.hpp,DepthSurface.cpp,Draw.cpp,PipelineJournal.cpp,State.cpp,tests/execution/LayeredDepthTarget.cpp, and the debt fragment in full through the available review tools.tests/Graphics.cppwas excluded from the review folder because it was too large, and I did not read it through the repository reader. I read the prepared description, commits, manifest, and diff. Tests, builds, Windows behavior, and physical console behavior were not independently verified.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-30T05:33:00Z.
Review: COMMENTED
Actionable comments posted: 4
Architecture findings (3)
Advisory architecture findings (3)
749246d2-0e58-42e3-91d1-4fdfe7200362Reviewing files that changed from the base of the PR and between
589da0b514andf75570b904.core/libs/prx/libSceAgcDriver/Graphics/include/State.hppcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/src/PipelineJournal.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/execution/LayeredDepthTarget.cppdocs/dev/debt/changes/feat-agc-layered-depth-targets.mdIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-30T05:55:42Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; I inspected all review-included files and the changed lines in
Graphics.cppthat the manifest marks as excluded, but did not run checks myself.What I ran
No build or tests were run during this review. The change is pinned to
f75570b9040c1d67abc23ad964ba8659efef2b71; the description reports Linux graphics tests and convention checks, which I did not independently run.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
Builds, tests, and console behavior were not independently verified.
repo_read.pylisted all eight changed files as included; I read the seven included source/document files and the added lines inGraphics.cpp, which is marked included in the manifest despite being too large for the review folder. Files listed as excluded by rule: none.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T19:05:18Z.
Review: COMMENTED
The depth-upload workaround needs two subresource ranges for a layered destination. In the
throughUploadbranch,planeRegionsnow carries the destination layer and is also passed tovkCmdCopyBufferToImagefor the one-layer staging image. For a destination layer greater than zero, that writes outside the staging image's array range, and the next image copy also reads the same out-of-range layer. Use layer zero for the staging write and for the source of the final image copy, while retaining the selected layer on the real destination. A layered depth restore with the upload workaround forced would cover this path.Source inspection at
f75570b904. This head also conflicts with main inDepthSurface.cpp.AI-assisted: yes.
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.