fix(agc): depth fast clears through the HTILE metadata #374
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/374"
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 MichonGoddijn231849 on 2026-10-02T16:15:36Z.
What
A title can fast-clear a depth surface by filling its HTILE metadata instead of drawing a clear. A ZMASK of 0 marks every tile as holding
DB_DEPTH_CLEAR/DB_STENCIL_CLEAR.DB_HTILE_DATA_BASE(0x005, high byte in0x01e). Both registers join the draw key.DMA_DATAimmediate fills and buffer-fill kernels whose ZMASK is 0 and that cover a depth surface's HTILE mark the surface cleared.GTA V clears its G-buffer depth this way every frame:
DMA_DATAfills of 0 over 0x48000 bytes of HTILE. Without this, only the first frame renders. From the second frame on, the G-buffer keeps the first frame's contents and the scene goes black.Tested
Windows 11 Pro, AMD Ryzen 5 7600, NVIDIA GeForce RTX 5080 (driver 32.0.16.1074), 32 GB DDR5-5600, MinGW-w64 GCC 15.2.0.
main.ctest: all tests pass.agc_driver_depth_fast_clear_submitsubmits aDMA_DATAimmediate fill and the fill kernel over the HTILE and checks the next depth-tested draw, and a stencil-tested draw after a depth-only fill. Sampling a surface after an HTILE fill is not covered by a test: the harness has no sampling shader with a depth T# 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🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-04T05:43:22Z.
This looks right for depth-only surfaces. With a stencil plane, though, any fill whose ZMASK is 0 clears both aspects. In the depth plus stencil HTILE layout the stencil state is in its own SR0, SR1 and SMEM fields: radv's
radv_get_htile_mask(radv_meta_clear.c) only touches zmask/zdelta/zbase for a depth clear and only sr0/sr1/smem for a stencil clear. So a fill that clears depth only would also reset the stencil to DB_STENCIL_CLEAR here. Could the stencil aspect be cleared only when the fill's stencil fields say cleared too, and the depth aspect alone otherwise? I'd also only take DB_HTILE_DATA_BASE when TILE_SURFACE_ENABLE is set. A small test forNoteDepthMetadataFill(depth only, depth plus stencil, a fill that doesn't cover the whole HTILE) would pin it down.Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-04T08:36:46Z.
Thanks, both points are fixed in e3848242 (rebased onto
maintoo):DB_STENCIL_INFO.TILE_STENCIL_DISABLEclear), it also clears the stencil when SMem (bits 8..9) is 0. That matches radv's depth plus stencil layout and its fast-clear value (radv_get_htile_fast_clear_value, SMem 0, SR0/SR1 3). A fill that writes an aspect's fields as not cleared cancels that aspect's pending clear, so a depth-only clear no longer resets the stencil.DB_HTILE_DATA_BASEis taken only whenDB_Z_INFO.TILE_SURFACE_ENABLEis set.TILE_SURFACE_ENABLEandTILE_STENCIL_DISABLE, plusHtileFillClearsandHtileFillCovers. The cases are depth only, depth plus stencil, stencil only, an expanded0xfffffffffill, a partial fill, a fill starting past the HTILE base, and no HTILE.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-04T09:51:57Z.
Thanks, that matches radv's depth plus stencil HTILE layout (ZMask in bits 0 to 3, SMem in bits 8 and 9, and
HTILE_ZS_CLEAR_REGwrites SMem 0), and bit 29 of DB_Z_INFO and of DB_STENCIL_INFO are the right TILE_SURFACE_ENABLE and TILE_STENCIL_DISABLE bits. Cancelling an aspect's pending clear when a fill marks it as not cleared is a nice touch. Merged with current main it builds and passes the full ctest here. Since depth fast clears change what PPSA21564 renders, I'll run it there on my integration branch first; after that it's ready to merge from my side.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-07T11:45:38Z.
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/execution/DepthFastClear.cppcore/libs/prx/libSceAgcDriver/tests/execution/DepthFastClearHarness.hppcore/libs/prx/libSceAgcDriver/tests/execution/DepthFastClearSubmit.cppcore/libs/prx/libSceAgcDriver/tests/execution/DepthFastClear.cppcore/libs/prx/libSceAgcDriver/tests/execution/DepthFastClearHarness.hppcore/libs/prx/libSceAgcDriver/tests/execution/DepthFastClearSubmit.cppcore/libs/prx/libSceAgcDriver/tests/execution/DepthFastClear.cppcore/libs/prx/libSceAgcDriver/tests/execution/DepthFastClearHarness.hppcore/libs/prx/libSceAgcDriver/tests/execution/DepthFastClearSubmit.cppcore/libs/prx/libSceAgcDriver/tests/execution/DepthFastClear.cppcore/libs/prx/libSceAgcDriver/tests/execution/DepthFastClearHarness.hppcore/libs/prx/libSceAgcDriver/tests/execution/DepthFastClearSubmit.cppcore/libs/prx/libSceAgcDriver/tests/execution/DepthFastClear.cppcore/libs/prx/libSceAgcDriver/tests/execution/DepthFastClearHarness.hppcore/libs/prx/libSceAgcDriver/tests/execution/DepthFastClearSubmit.cppcore/libs/prx/libSceAgcDriver/tests/execution/DepthFastClear.cppcore/libs/prx/libSceAgcDriver/tests/execution/DepthFastClearHarness.hppcore/libs/prx/libSceAgcDriver/tests/execution/DepthFastClearSubmit.cppcore/libs/prx/libSceAgcDriver/tests/execution/DepthFastClear.cppcore/libs/prx/libSceAgcDriver/tests/execution/DepthFastClearHarness.hppcore/libs/prx/libSceAgcDriver/tests/execution/DepthFastClearSubmit.cppImported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-07T13:57:37Z.
Review: CHANGES_REQUESTED
Built merged onto current
main(e79c971f9): full ctest passes. The new checks cover the register decode and the two pure helpers. A few things before merging:NoteDepthMetadataFill, soApplyFastClearand both triggers, theDMA_DATAimmediate (PacketMemory.cpp:59-63) and the fill kernel (BufferFill.cpp:173), run in no test. Removing them leaves ctest green. Could you add an execution test (theVisual.cppharness can draw with a depth target)? It would cover: aDMA_DATAfill of 0 over the HTILE, then a depth-tested draw that seesDB_DEPTH_CLEAR; a depth-only fill on a depth plus stencil HTILE that keeps the stencil; a fill shorter than the HTILE that clears nothing; and sampling the surface after a fill.HtileFillCoverstreatsceil(w/8) * ceil(h/8) * 4bytes from the HTILE base as the whole surface. The real gfx10 HTILE is pipe-aligned and larger (addrlib), so a fill of only its first part would clear every tile.DB_DEPTH_CLEAR. For a depth-only HTILE, the clear word also carries the value: radv writesminz = maxz = round(depth * 0x3fff)(HTILE_Z_CLEAR_REG,src/amd/common/ac_descriptors.h), and only allows TC-compatible fast clears to 0.0 or 1.0. Which of the two the texture unit returns for a cleared tile wasn't measured.PacketMemory.cpp:60-61repeatsdmaSource/dmaDestinationfromPm4.cpp:82-88. Please expose those (or decode throughPm4) instead of a second copy of the bit layout.@oneandonlydean you planned a PPSA21564 run on your integration branch before calling this ready. Did it go through?
Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-07T17:31:08Z.
Rebased onto current
main(now 0b03ec84), no conflicts. #419 and #425 are restacked on these exact commits. Working on the review points next.Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-07T18:22:23Z.
@adriadam10 changes:
eaecf06b: DMA_DATA's source and destination selectors decode through
Pm4::DmaSource/Pm4::DmaDestination(now public) instead of a second copy of the bit layout. Two TechnicalDebt lines record the inferred parts:HtileFillCovers' surface size, and the value a cleared tile reads as.d948c4ec:
tests/execution/DepthFastClear.cppdraws with a D32 target andDB_DEPTH_CLEAR1.0 and checks that:With
NoteDepthMetadataFillemptied it fails at the first whole-HTILE fill.The test calls
NoteDepthMetadataFilldirectly, which is what both triggers call (the DMA_DATA immediate inPacketMemory.cppand the fill kernel inBufferFill.cpp). Two cases are still covered only by theHtileFillClearschecks, not by a draw: depth plus stencil (a depth-only fill keeping the stencil), and sampling after a fill.Build and ctest pass. #419, #425, #1186 and #1189 are restacked on this.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-07T19:58:58Z.
Review: DISMISSED
Thanks for the changes. The
Pm4reuse and both TechnicalDebt lines look good. Built merged onto currentmain: full ctest passes, andagc_driver_depth_fast_clearruns (not skipped). What's left:DepthFastClear.cpp:135-143callsNoteDepthMetadataFilldirectly, so deleting theDMA_DATAhook (PacketMemory.cpp:59-61) or the fill-kernel hook (BufferFill.cpp:173) still leaves ctest green. Those two lines decide when a clear happens: selectors, address, the& 0x3ffffffcount, the uniform-pattern check.tests/Submit.cppalready submits DCBs, so one test could submit aDMA_DATAimmediate fill of 0 over the HTILE and then check that the next depth-tested draw seesDB_DEPTH_CLEAR. The fill-kernel path needs a case too if it can be reached the same way.HtileFillClears, not throughApplyFastClear's aspect mask. A stencil-tested draw after such a fill would pin it.docs/dev/TechnicalDebt.md:204-205are the last ones in "Unknown function info", where every PR appends. Moving them a few lines up avoids conflicts with the PRs stacked on this one and with others.Sampling after a fill can stay untested if a draw that samples the surface is too much harness work. If so, please say that in the description.
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-07T20:47:33Z.
Not yet, sorry. #374 is in the queue for the regression run, together with #290 and #788, and I haven't got a result for it. I'll run it on the current head (including today's DMA_DATA and test changes) and post the result here.
Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-08T15:43:15Z.
Thanks. Rebased onto main. Added
agc_driver_depth_fast_clear_submit: it submits the two real triggers as DCBs, aDMA_DATAimmediate fill and a dispatch of the fill kernel over the HTILE, and checks the next depth-tested draw seesDB_DEPTH_CLEAR. Removing either hook line (PacketMemory.cpp,BufferFill.cpp) now fails it. A fill one dword short and a ZMask 0xf fill clear nothing. The same test covers depth plus stencil: a depth-only fill (SMem 3) over an HTILE holding stencil 5, then a stencil-tested EQUAL 5 draw still passes everywhere while a LESS draw shows the depth was cleared; widening the aspect mask fails it.While writing it I found that a fill the device could not store (the CPU fallback) never reached the HTILE note; the note now follows that branch too. The TechnicalDebt lines moved up in the section, and one line records the stencil bit mapping the test pins, which is inferred from the HTILE layout. Sampling after a fill is still untested (no sampling shader with a depth T# in the harness); the description says so.
Imported from boykopovar/AnyPS5. Originally posted by orbz22 on 2026-10-08T16:25:53Z.
Test evidence from Astro's Playroom (PPSA01325). The title clears its depth through HTILE every frame, but the clear takes a path the two hooks here do not cover.
Setup: Windows 11 Pro, RTX 3060 Laptop (6 GB), 32 GB RAM, MinGW-w64 GCC 15.2.0. Local branch with this PR's diff ported onto main
73ac9ef7, plus #1395, #757, #758, #759 and #570.What the title does. The main depth surface is 0x517370000, 3840x2160 D32S8, with
DB_Z_INFO0xa0000183 (TILE_SURFACE_ENABLE set) andDB_STENCIL_INFO0x20000181 (TILE_STENCIL_DISABLE set). Its HTILE is at 0x567f88000. The title never sends aDMA_DATAfill and never dispatches the 9-instruction fill kernel over it. Instead it dispatches a different 64-thread compute kernel twice per frame. The kernel ships in the title binary (it ran from a host address in the relinked exe), so it is probably an SDK toolkit kernel rather than one written for this game:The user data, as I decoded it from the code (69 dwords, first dwords
bfa00003 d7460002 04010c0a 7da80408 ..., ending inbuffer_store_format_xwith idxen):BUF_FMT_32_UINT, dst_sel X, num_records = dword countEach thread
i < s8storespattern[i % s9]to dwordi. In this case s9 = 1 and s4 = 0xfffffff0, which is ZMASK 0 with min/max Z 0x3fff, the same value asHTILE_Z_CLEAR_REG(1.0). The same kernel also fills DCC keys (0x00000000, 0xffffffff and 0x40404040 patterns) and the shadow-map HTILEs.Result. With this PR alone,
NoteDepthMetadataFillnever ran, so the depth surface kept every earlier frame's depth. Draws withDB_DEPTH_CONTROL0x007007b2 (LEQUAL, no write) then failed where earlier frames had drawn. On the title screen this showed up as a permanent trail behind the flying 3D letters. I added a hook that matches this kernel and callsNoteDepthMetadataFill(base, count * 4, s4)when s9 is 1. With it the trail is gone in all four runs I made, including one started from a launcher script: the HTILE fill is noted about 2 times per frame (1411 times in about 700 frames), and stderr has no new errors.A second finding, about array slices. The cascaded shadow map uses three 1536x1536 depth slices (0x529430000, 0x529c30000, 0x52a430000). All three draws keep the same
DB_HTILE_DATA_BASE(0x5689a8000), and the title fills three HTILE ranges 0x40000 apart: 0x5689a8000, 0x5689e8000 and 0x568a28000.decodeDepthadds theDB_DEPTH_VIEWslice offset to the Z and stencil addresses but not tohtileAddress. As a result, the first fill marks all three slices cleared, and the fills for slices 1 and 2 match no surface. For this title the outcome is still right, because the three fills come back to back before any slice is drawn. A title that clears one slice between draws to another would lose depth. The per-slice HTILE stride (0x40000 here, for 0x24000 bytes of tiles) is not derived anywhere yet.I can open the kernel hook as a separate PR on top of this one if that helps. It is a few lines in
BufferFill.cppandDispatch.cpp.Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-09T08:33:33Z.
@orbz22 thanks for tracking this down. Yes please, open the fill-kernel hook as a separate PR on top of this one; matching the toolkit kernel and calling
NoteDepthMetadataFillwhen the pattern length is 1 is the right shape. The per-slice HTILE address is a real gap too:decodeDepthshould add the slice's HTILE offset the way it does for Z and stencil, once the stride is derived. I'll note it in TechnicalDebt.md.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-09T22:01:47Z.
Merged onto current
main: build and full ctest pass here (agc_driver_graphics,agc_driver_depth_fast_clear,agc_driver_depth_fast_clear_submitall run, none skipped). Without the change the new tests don't build, and both hooks (PacketMemory.cpp,BufferFill.cpp) are exercised by the submit test. Nothing left to change from our side.linux/windowsjobs fail onspirv/unified1/spirv.hppnot found inVulkanTestDevice.hpp, which every execution test includes; it doesn't come from this diff.@oneandonlydean you said you would run this on PPSA21564 on your integration branch before giving it the go-ahead. Do you have a result on the current head (
7e6f271)? Nine PRs are stacked on this one, so it blocks them.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-10T00:03:53Z.
Ran it on PPSA21564 at
3a99fa1880(7e6f271plus the main merge), with the copy of this change I'd been carrying swapped out for this head. The level loads in all runs with the same frame rate as before, no errors, and the title screen's depth-tested draws are clean (no trails). Dreaming Sarah passes on main + this. Fine by me, so I'll merge it once its full build is green.One thing for a follow-up:
agc_driver_depth_fast_clear_submitis flaky in the compute-fill case, on Linux too (2 failures in about 180 back-to-back runs here; popcoder565 saw 3/60 on Windows), always witha compute fill of 0 over the HTILE did not clear the depth to DB_DEPTH_CLEAR (1.0). The test draws on its own device while the fill-kernel submit creates the driver's device, soRecorder::Active()can switch devices between the fill and the draw. Giving the test one device, or creating the driver's device first, should fix it.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-10T02:16:21Z.
This conflicts with main after today's merges. Could you rebase it along with the test fix? Its gate passed, so it can go in once it builds green.
Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-10T08:10:39Z.
Rebased onto
main(af1a8edf), head28414f92, as two commits.clear_htile_maskkernel, so the two are merged into one path:NoteHtileDepthClearmarks the matching surfaces' depth aspect pending, the same way an HTILE fill does here. A clear for a surface that doesn't exist yet still uses #2229's set, applied when the surface is first bound.DepthSurface::ClearDepthis gone; the pending clear goes throughApplyFastClear, on bind and on sample.agc_driver_depth_fast_clear_submit, fixed in the driver rather than the test, as you described. A depth surface now records its clears into the active recorder only if that recorder belongs to its own device. Otherwise it submits on its own device. Two devices in one process can't put a clear in the wrong command buffer any more.Tested on Windows, RTX 5080:
agc_driver_graphics,agc_driver_depth_fast_clear,agc_driver_depth_fast_clear_submitandagc_driver_dword_pattern_fillpass.check_conventions.pypasses.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-10T09:42:35Z.
Both this and #425 passed testing and are ready to merge, but today's merges conflict with them in
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp. Could you rebase both on main? This one goes in first, then #425.Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-10T09:52:17Z.
Rebased onto
main(be403084), head94d93e00. Thetests/Graphics.cppconflict was the include list. A third commit adapts the new tests to main'sMutation::Addgpuflag.agc_driver_graphics,agc_driver_depth_fast_clear,agc_driver_depth_fast_clear_submit(100 runs in a row) andagc_driver_dword_pattern_fillpass here, and so doescheck_conventions.py. #425 follows on this head.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-10T18:08:35Z.
The manual build of 94d93e00 segfaults in
agc_driver_depth_fast_clear_submiton Linux, with no output before the crash: https://github.com/boykopovar/AnyPS5/actions/runs/38047108506. Could you look at it? (The Windows job skips that test, and itsguest_avplayerfailure isn't from this PR.)Imported from boykopovar/AnyPS5. Originally posted by orishamir on 2026-10-10T18:47:00Z.
On the Linux segfault in the manual run (38047108506): that job's device is llvmpipe (LLVM 20.1.2, ubuntu-24.04) under
ctest --parallel 4, and the test's output stops right after the driver's ownVulkanDevicecomes up, before any[gpu]line, so the crash is in the firstDMA_DATAsubmission or the draw after it, not in the compute-fill case the earlier flake was about.It does not reproduce here on llvmpipe LLVM 21.1.8 (Ubuntu 26.04 in WSL2),
94d93e00merged onto currentmain(57f96fd2):agc_driver_depth_fast_clear_submitpasses 200 serial runs, 8 concurrent instances x 40 runs, 100 runs under CPU load, and the 256-test agc driver set at-j8repeated 4 times.agc_driver_graphics,agc_driver_depth_fast_clearandagc_driver_dword_pattern_fillpass too. On this evidence the difference is the Mesa/LLVM build rather than load. The TechnicalDebt lines sit mid-section (:273-276).AI-assisted: yes (Claude Code Fable 5.1 xhigh)
Imported from boykopovar/AnyPS5. Originally posted by Mouhand-Kaddo on 2026-10-10T21:21:29Z.
Additional current-main platform validation of head
94d93e00fb087f37d0dfc7b6ffa64a552c51ea51, with its three commits cherry-picked onto main262c031692a0ce538707436fa1587b671ace682b(local integration2e2f7243b). No additional behavior changes.agc_driver_graphics,agc_driver_depth_fast_clear, andagc_driver_depth_fast_clear_submitpass 3/3 (3.17 s). The submit test also passes three consecutive verbose repeats, including its compute-fill case.0xc0000005insideamdvlk64.dll+0x1bbfa4. After a fresh rebuild, that submit test passes 23 consecutive verbose repeats (3 followed by 20), including compute fill. The initial crash remains unexplained; these retries do not establish that it is resolved or identify its cause.Release builds; repeats used
ctest -R '^agc_driver_depth_fast_clear_submit$' -V --repeat until-fail:N. The initial run used the three-test selection above.The Arch run uses software Vulkan. WSL asynchronous userfaultfd write protection is unavailable here, so the graphics test reports that its write-watch/import-mirror cases were not exercised. This is additional platform evidence, not a reproduction or resolution of the reported LLVM 20 CI failure.
Imported from boykopovar/AnyPS5. Originally posted by orishamir on 2026-10-10T22:00:40Z.
Follow-up on the manual-build segfault (run 38047108506), since nobody has reproduced it yet: I rebuilt the exact tree that job built,
b5f5362d+94d93e00(merge03038533), in a container matching the runner:ubuntu:24.04,mesa-vulkan-drivers25.2.8-0ubuntu0.24.04.4 = llvmpipe (LLVM 20.1.2), GCC 13.3.0, cmake 3.28.3, the workflow's configure flags withANYPS5_ENABLE_SPIRV_TOOLS=ON,ANYPS5_REQUIRE_VULKAN=1 GALLIUM_OVERRIDE_CPU_CAPS=avx, 4 CPUs,ctest --parallel 4 --timeout 120, and with the userfaultfd write watch active as in the job's output (Docker's default seccomp profile blocksuserfaultfd, so a first set of runs had fallen back to comparing guest memory; the figures below are from runs with it allowed).--parallel 4:agc_driver_depth_fast_clear_submitpasses in all three (699/700 each; the one failure isimport_audit, which stamps its JSON with the source commit through git and gets none under the container's file ownership, nothing to do with this PR). The same three runs without the write watch: 700/700.main262c0316+94d93e00: 713/713 at--parallel 4, 30/30 serial.So the crash does not follow from the job's image, device, compiler, flags, tree, write-watch mode or test parallelism. What is left is the hosted runner itself (CPU, kernel, load; llvmpipe generates code for the host CPU at run time). A re-run of the manual build would show whether it repeats there at all.
AI-assisted: yes (Claude Code Fable 5.1 xhigh)
Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-10T22:17:24Z.
Thanks all for the runs. I can't reproduce it either, and with @orishamir's container rebuild (the job's exact tree, ubuntu:24.04 image, llvmpipe LLVM 20.1.2, GCC 13.3,
ctest --parallel 4, write watch on) passing the full suite three times and the test 30/30 alone, it doesn't follow from the tree, the image or the parallelism. The job log also has no output from the test before the segfault, so there is nothing to locate it by.@oneandonlydean, could you re-run the manual build once? If it crashes again on the hosted runner, I'll add a line per case to the test so the log shows which submission it dies in, and a backtrace step for that test.
@Mouhand-Kaddo the one-off
0xc0000005insideamdvlk64.dllon the first run, gone after a rebuild, I can't explain either; noted in case it shows up again.Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-10T22:38:44Z.
Rebased onto main
379d8b4e(6d0fe18c); the only conflict was an include list inPacketMemory.cppnext to main's14c2eca3b(DMA_DATA copies into host-only memory), which does not touch the fill path this PR hooks. The agc tests pass on Windows (RTX 5080).Imported from boykopovar/AnyPS5. Originally posted by orishamir on 2026-10-10T22:52:15Z.
Replica run of the new head
6d0fe18c(same setup as above: the CI image rebuilt locally, ubuntu:24.04, GCC 13.3, llvmpipe LLVM 20.1.2, SPIRV-Tools on, CI env, userfaultfd write watch active; the tree as pushed onmain379d8b4e).94d93e00(interdiff of added and removed lines empty; 14 files, +488/-15).libsclean. Full suite 729/729 three times at--parallel 4.agc_driver_depth_fast_clear_submit30/30 serial.AI-assisted: yes (Claude Code Fable 5.1 xhigh)
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-11T01:08:11Z.
Conflicts with main again in
DepthSurface.hppandDepthSurface.cppafter #1430; please rebase (and #425 on top). I'll run the manual build on the new head, which covers the re-run.Imported from boykopovar/AnyPS5. Originally posted by Amoenus on 2026-10-11T05:54:05Z.
Independent validation found a concrete false positive in the documented
HtileFillCoversapproximation. Current #374 (6d0fe18c) and #419 (b75dc179) contain the same helper, byte-for-byte.Reproducer:
HtileFillCovers(0x10000, {16, 16}, 0x10000, 16)returns true unchanged. For GFX10 non-RB+, revision0x82,GB_ADDR_CONFIG=0x00100044, pipe-alignedSW_64KB_Z_X, unchanged AMD PAL places a valid HTILE word at offset 260 (end 264). A 16-byte fill misses it. PAL reports a 32,768-byte physical extent. Checked for 1/2/4/8 samples and D16/D32. The current 16x8 unit example has contiguous valid words; 16x16 exposes the assumption.Reference: pinned PAL HTILE info/address routines. This is an unchanged source reference, not a PS5 measurement. TechnicalDebt already acknowledges the approximation; this supplies a concrete counterexample.
Local correction tested: require the complete physical extent for the supported layout (32 KiB per 1024x512 metadata block). A partial overlapping fill makes the resident surface throw on its next use; a complete known fill permits recovery. This is conservative, does not model partial tile updates or other layouts, and any general adoption still needs its layout assumptions enforced.
Validation:
7f1dc965: all 120 libraries/full build and conventions passed; 102 relevant groups x5 = 510 passes, no skips, max 4.06 s, Vulkan/MSAA required and shader caching disabled.FlushGpuWrites, every one of the 32,768 guest bytes is checked. This exercises the existing optimized fill route, not native execution of the AMD shader.Windows 11 / RTX 5080, driver 32.0.16.1062, GCC 15.2.0. The aggregate includes previous local snapshot prerequisites, conflict repairs and the independently verified standard-8x table correction; this is not an unchanged full PR build or Linux/lavapipe validation. Controlled PPSA99902 runs still stop at raw
PA_SC_AA_CONFIG=0x2030e003(31.471/31.004 s, no timeout), so the title has not exercised the HTILE correction. No frame/gameplay or console-equivalence claim. Original dump/baseline runtime preserved. No new PR/push. AI-assisted investigation/local code: Codex.Fork code and validation update (2026-10-11)
Proposed correction (fork only): partial HTILE-fill handling and regressions. Parent
a55955fais the adapted #374/#419 stack and includes the separate HTILE geometry helper. This is an extracted correction tested in the aggregate, not an isolated full topic build. It remains a conservative proposal for the pinned pipe-aligned layout; other metadata layouts still need enforced decoding guards before general adoption. Independent HTILE helper topic on main0e90079fhas no local MSAA prerequisites; 240 PAL configurations/run, 2,252,352 HTILE checks/run x5 and 15 mutation controls passed. It is source-backed, not a console measurement. AI-assisted: Codex.Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-11T07:59:34Z.
@Amoenus thanks, confirmed and fixed in
90e3c40d(credited):HtileFillCoversnow requires the fill to span the pipe-aligned metadata extent, 32 KiB per 1024x512 block (HtileMetadataBytes), and the test has your 16x16 counterexample (a 16- or 264-byte fill covers nothing). The fast clear fixtures fill that extent; the compute fixture now dispatches one group per KiB with TGID_X. A partial fill is still ignored rather than refused (the surface keeps its contents); the TechnicalDebt line says so and names the layout it assumes.@oneandonlydean #425 is re-stacked on it (
847cccc6, 326/326 agc tests on Windows). Main is merging a PR every minute or two this morning, so I'll rebase both onto main once it has quietened down later today rather than now and again in an hour.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T08:23:58Z.
Rebased onto current
main: the only conflicts were adjacency inDepthSurface.hpp/DepthSurface.cpp(main'sDepthSurfaceHoldsnext to this PR'sHtileFill*helpers). I kept both sides, no logic changed.libSceAgcDriveron the rebased tree: 371/371 pass;agc_driver_graphics,agc_driver_depth_fast_clearandagc_driver_depth_fast_clear_submitrun (not skipped), and the last two pass 20 repeats in a row.HtileFillCoverscounterexample by @Amoenus (fixed in the head).Merging once the manual full Build (linux and windows) is green on this head.