fix(agc): give a layered depth storage view only its viewed slices #23880
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/23880"
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 milescoviello on 2026-11-19T20:37:14Z.
What
A storage view of a 2D array over a depth surface (
DepthSurfaceStorage→layeredDepthStorage) built its layered storage image from the view as given: every slice from the array's first slice up to the view's last, whichever slices the view uses. A view of the last slice of a large array therefore got an image of the whole array. The sampled path already narrows such views to their slice window withViewedArrayWindow(ShaderResources.cpp); the storage path did not.Crimson Desert (PPSA25286) was the reason I looked here: with #22534, #22609 and #22778 its log has a 2306x10113 array view at slice 416 and, soon after, a 39,397,711,872-byte storage texture placed in host memory. Correction: a later Crimson Desert run with this change (on
main0626a8334with #22534, #22609, #22778, #22690, #22703, #22692 and #23864) still makes that 39 GB allocation, three times, so it does not come from this path, and this PR does not address it. This PR stands on its own test: a storage view of one slice of a layered depth array now gets an image of that slice instead of the whole array.The change:
DepthSurfaceStoragepassesViewedArrayWindow(resource, true)tolayeredDepthStorageinstead of the view itself, so a view starting at slice N gets an image that starts at the first slice of its window (slice N for a linear or slice-free swizzle).layeredDepthStorageaddresses its slice lookup from the window's base (a copy of the depth surface's target with the window's address), solayeredSlicesstill finds the depth surface of each viewed slice.A view from slice 0 is unchanged.
Tested
Linux (Ubuntu 26.04.1, kernel 7.0), GCC 15.2, Ninja, Release,
-DBUILD_TESTING=ON, RTX 4070 Ti on NVIDIA 615.71:agc_driver_depth_storage(tests/execution/DepthStorage.cpp): its existing 2D array view from layer 1 of a two-layer array over the depth plane now also checks that its storage image has one layer (two onmain).agc_driver_depth_storagepasses 3 runs on3f2f9e09bc.main'sDepthSurface.cppand the new check,agc_driver_depth_storagefails.3f2f9e09bc(Mesa 26.2.6 RADV, Khronos validation layer 1.4.363):agc_driver_depth_storagewith the new check passes 3 of 3 on an RX 7900 GRE (gfx1100), a Ryzen 7800X3D iGPU (gfx1036) and an RX Vega 56 (gfx900), with the layer inserted and noVUID-lines;main's test passes the same way on each.ANYPS5_REQUIRE_VULKAN=1):agc_driver_depth_storagepasses 3 runs on3f2f9e09bc.git merge-treeagainstmainis clean, andgit apply -3of this diff ontomainwith #23864 or #22778 merged is clean. #22778 does the same narrowing for the sampled path's depth plane copies; this PR is the storage-view side.tools/check_conventions.pypasses on the branch and this body.3f2f9e09bcmerged ontomain42f6354612:agc_driver_depth_storagepasses with noVUID-lines, and withmain'sDepthSurface.cppand this PR's test it fails 3 of 3.3f2f9e09bc, applied with 28 other PRs ontomainfd4aeed483(one combined tree, not this PR alone), Windows 11, WinLibs GCC 15.2.0 r7, Release, no validation layer: the 6agc_driver_depth_storage*tests pass on an NVIDIA GeForce RTX 3080 (driver 621.24) and on the AMD Radeon iGPU of a Ryzen 7 9800X3D (gfx1036).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 MarcZX10 on 2026-11-20T12:06:54Z.
Review: APPROVED
Reviewed — looks good
The depth storage path now limits the image to the viewed array window and aligns depth-slice lookup with that window; I found no verified blocking defects.
What I ran
Reviewed head
3f2f9e09bcfd3887f34b40511ae4bb7e233cd45c. I read the prepared description, commit list, manifest, diff, both changed files at the relevant ranges, and theViewedArrayWindowimplementation. I did not run commands or tests.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
I did not independently run the execution test or validate the author-reported GPU, OS, merge, and convention-check results. No changed files were excluded by the prepared manifest.
To get this to a good state
Nothing is required.