fix(agc): give each slice of a depth array its own HTILE #5111
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/5111"
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 XairRrR on 2026-10-13T12:00:20Z.
What
A slice of a depth array target (
DB_DEPTH_VIEWSLICE_START) offsets its depth and stencil addresses, but it kept the array'sDB_HTILE_DATA_BASEas its HTILE. Every slice then shared slice 0's metadata:Changes:
sliceSize * sliceinGfx10Lib::HwlComputeHtileAddrFromCoord;HtileMetadataBytesis that slice size.global_store_dwordx4at the thread index << 4. A surface takes the clear when that range covers its HTILE, as with aDMA_DATAfill. A clear over a whole array still clears every slice.Tests:
tests/Graphics.cpp: slice 2 decodes the base plus two slices of HTILE. This fails onmain.tests/DepthSurfaceReuse.cpp: two slices with adjacent HTILE ranges. A clear of the first range clears only the first slice, and a clear of both ranges clears both. The second check fails with exact-address matching.Uncharted: Legacy of Thieves Collection (PPSA05684) renders its sun shadow cascades into the four slices of a 2048x2048 D16 array. Each slice's HTILE lies 256 KiB after the previous one, and decoding a slice's words at that offset gives that cascade's footprint.
Tested
BUILD_TESTING=ON.ff8fe4dbc. Full ctest: 1041/1041. One run hit an unrelated failure inguest_kernel_fcntl, which passed when rerun. Conventions check passed.maindoes not run it yet.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by kr4y4 on 2026-10-13T14:58:55Z.
First Windows and Intel run.
Setup: Windows 11 (26200), WinLibs GCC 15.2.0 r7, Release, CI configure flags, an RTX 4070 Laptop GPU (NVIDIA 595.97) and an Intel Raptor Lake-S iGPU (32.0.101.6790). The head 5ea6a253f merged into
main0f2683cb7, which passes 1069 of 1069 on both GPUs.--repeat until-fail:3:agc_driver_graphics(which includesDepthSurfaceReuse.cpp),agc_sparse_buffer_holes,agc_descriptor_pool_reset_failureandagc_compute_descriptor_layout_flags. All pass on both GPUs.tests/DepthSurfaceReuse.cppcalls the new two-argumentNoteHtileDepthClear, so it doesn't build againstmain.Written with AI assistance.
Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-10-13T16:55:46Z.
@kr4y4 thanks for the Windows and Intel run. Here is a negative control that builds. I merged 5ea6a253f into
main0214069e3and reverted each half of the fix on its own, keeping the two-argumentNoteHtileDepthClear:State.cppkeepsdepth.htileAddress = base(0x005, 0x01e).agc_driver_graphicsfails withslice 2 of a depth array must use the third slice of its HTILE.NoteHtileDepthClearandtakeClearedHtilematch the exact HTILE address again instead ofHtileFillCoversover the reported range.agc_driver_graphicsfails inDepthSurfaceReusewithan HTILE clear over both slices must clear both.agc_driver_graphicspasses, and so do all 487 agc tests on the merge (Linux, RTX GPU, NVIDIA driver, Release;agc_driver_stencil_ref_exportis skipped).AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by Amoenus on 2026-10-13T23:46:52Z.
@XairRrR Our focused native-depth clear follow-up #5554 declares #5111 as a prerequisite, alongside #5524. Your range/slice routing goes first; our addition uses a separate strict native extent and requires complete tracked stores, settled GPU work, no CPU/depth race, and exact zero/one HTILE words before clearing a held image.
The actual-head validation composition includes your exact
5ea6a253head. Full build/libs and seven groups ×5 on both RTX5080 and AMD integrated graphics pass without skips, including a real BDA mask-kernel producer and partial-store refusal. Your slice/range implementation remains in the validation composition; the focused follow-up carries our integration with that API. I will resolve the shared interface context after #5111 merges. Synthetic results; no new title replay. AI-assisted: Codex.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-14T17:57:47Z.
Rebased onto current
main(conflicts inDepthSurface.cppandDepthSurfaceReuse.cppwith the plane-owner and image-copy changes; resolved additively,takeClearedHtilenow feeds the newDepthSurfaceView). Checked on the rebased tree: the HTILE slice offset follows addrlib'ssliceSize * slice, the clear kernel range (16 bytes per thread,global_store_dwordx4at thread index << 4) matches the kernel, and both new tests fail to build/pass without the change. Scoped build + ctest pass exceptagc_driver_tessellation, which segfaults on a local RADV without this change too; Windows/Intel/NVIDIA runs by @kr4y4 and @XairRrR cover the rest. Merging once the full Build is green.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-14T18:02:29Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)core/libs/prx/libSceAgcDriver/tests/DepthSurfaceReuse.cppL41