fix(agc): clear the host depth image on a fill of a depth or stencil plane #7131
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/7131"
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 JosepBove on 2026-10-17T12:50:22Z.
What
Heretic + Hexen (PPSA26525 01.003.000, #5912) and DOOM + DOOM II (PPSA21444 03.000.000, #5921) draw their Cohtml UI with black 64 px squares and words cut off mid-glyph on
main(#7130): Heretic's "add players" dialog shows "pla" for "player settings" and "ing for player..." for "Waiting for player...", with black blocks under the dialog.Renoir keeps the UI in a persistent layer with a
D32_SFLOAT_S8_UINTtarget, marks the dirty rectangles with stencilReplace2, draws withEqual2 and composes with ref 1, and resets the whole stencil plane to 1 before each frame with a fill ofDepthSliceBytes({1920, 1080}, 1)=0x280000bytes of0x01010101atDB_STENCIL_READ_BASE.NoteDepthMetadataFillacted only on a fill that coversDB_HTILE_DATA_BASE, so the fill reached guest memory and the residentDepthSurfaceimage kept the stencil of every earlier frame.NoteDepthMetadataFillnow also recognizes a fill that covers a known surface's whole stencil plane with four equal bytes, and one that covers its whole depth plane with a float in 0.0-1.0 (two equal UNORM halves for D16). The value is kept besidependingClear(depthFill,stencilFill) and used byApplyFastClearinstead ofDB_DEPTH_CLEAR/DB_STENCIL_CLEAR, so the image is cleared the next time the surface is bound, sampled or stored to, through the existing path (RecordClear). The fill value follows a plane to a surface that takes it over (takePlane). An aspect copy drops it (ForgetClear), and every HTILE-driven clear (a whole-HTILE fill, a recognized clear kernel, a cleared HTILE at bind) goes throughNoteHtileClear, which drops it too, so a later HTILE clear still clears toDB_DEPTH_CLEAR/DB_STENCIL_CLEAR. A partial fill, a dword whose bytes differ, a depth value outside 0.0-1.0 (the titles also fill other depth planes with0xff000000), a multisampled surface or a fill made before the surface exists leave the image as it was, as before. The technical-debt entry records the rules and that a plane fill under a compressed HTILE was not measured on the console.Tested
Windows 11 Home (26200), AMD Ryzen 9 9950X3D, NVIDIA RTX 5090 (616.92), WinLibs GCC 15.2.0 r7, Release,
BUILD_TESTING=ON, bundled dependencies. Branch onmainc9e6c45de.agc_driver_depth_plane_fill(new,tests/execution/DepthPlaneFill.cpp, on theDepthFastClearharness): writes stencil 2 over a 64x32D32_SFLOAT_S8_UINTsurface, then checks that a fill 4 bytes short of the stencil plane and a0x01020304fill leave the mark, that a0x01010101fill of the whole plane makesEqual2 cover nothing andEqual1 cover everything, that the stencil is writable again afterwards, and that a fill starting a page before the plane clears it to 0. For the depth plane it writes 0.5, checksLESSfails, and that0x3f800000clears to 1.0,0to 0.0, while0xff000000and a fill 4 bytes short change nothing. On a second D32 surface with an HTILE, a depth plane fill of 0.0 followed by a whole-HTILE fill of ZMask 0, and then followed byNoteHtileDepthClear, must each clear toDB_DEPTH_CLEAR(1.0); withoutNoteHtileCleardropping the fill value, the clear-kernel case fails. Onmainit fails at the first whole-plane fill (a fill of the whole stencil plane with 1 left the stencil mark 2); with this change it passes.ctest -R agc_driver_depth_: 13 of 13 pass.ctest --parallel 8 --timeout 120: 1382 of 1386 pass on the rebuilt tree. None of the four failures involves this change:conventions_blob_reads(the fixture'sgit tagfails because this machine's git signs tags),select_tests(Windows refuses the fixture's symlink without the privilege), andagc_driver_f16_fma_denormal_modesandagc_driver_fma_mix_f16_denormal_modes(NaN bit patterns0x7fff/0x7fffffffinstead of0xfe00/0xffc00000on this NVIDIA driver), both of which fail the same way when rebuilt withmain'sDepthSurface.cpp.python tools/check_conventions.py --base origin/main --head HEADpasses;git diff --checkis clean.--windows --registry,ANYPS5_GPU='RTX 5090', driven through main menu > multiplayer > local > add players by the pad input file: onmainc9e6c45dethe dialog is corrupted as above; with this change "player settings", "continue...", "current players (1/4)", "Player" and "Waiting for player..." are complete and no black blocks appear, at 60 FPS on the window counter in both runs. DOOM + DOOM II, same conversion, 90 s onmaine154f5658with this change: the title picker and the DOOM description page draw their text completely; not rerun onc9e6c45de.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 github-actions[bot] on 2026-10-17T13:08:32Z.
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)docs/dev/debt/libSceAgcDriver.mdL40-41core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppL1420-1421, L1427-1430core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppL1224-1225, L1292-1293, L1427-1430core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppL953-955, L1225, L1227core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppL326core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppL1227core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppL260core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppL1216-1231Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdImported from boykopovar/AnyPS5. Originally posted by akkadbakkad89 on 2026-10-17T13:11:29Z.
Independent hardware run, head
3e1b7be11, Windows 11, MinGW (WinLibs GCC 15.2.0), Release,ctest -R "agc_driver_depth_plane_fill|agc_driver_depth_fast_clear", serial fresh processes:agc_driver_depth_plane_fill,agc_driver_depth_fast_clear,agc_driver_depth_fast_clear_submitall pass — a second NVIDIA generation confirming the RTX 5090 result.ANYPS5_GPU=UHD, igvk64): all three pass — first Intel datapoint for the fill path.No Cohtml titles on this machine, so this is fixture-level evidence only.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-17T16:05:15Z.
Thanks for the independent run. This adds a second NVIDIA datapoint and an Intel UHD 630 fixture result for the depth-plane fill and fast-clear tests. It strengthens the host fixture coverage; the reported scope does not include a Cohtml title run.
Imported from boykopovar/AnyPS5. Originally posted by Pacuka on 2026-10-18T11:10:57Z.
Data point: this also fixes the grey character trail in The Smurfs - Dreams (PPSA21607, Unreal Engine) on RX 6650 XT / RADV. UE resets its CustomDepth stencil plane (2848x1600 D32S8, no HTILE) with a fill each frame. Without this change the stale stencil marks stayed, and UE's post-process drew grey Smurf silhouettes at every past position. Verified with a RenderDoc capture + a stencil trace; with main
9f25d0bf5the trail is gone. Thanks!AI-assisted (Claude Code).