perf(agc): expand draw recipes to support depth targets #4947
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4947"
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 Kikoarl on 2026-10-13T06:00:48Z.
What
Expands direct
DrawRecipecreation and cached replay execution to draws with active depth targets:bool hasDepthtostruct DrawRecipeinRecipe.hpp.!state.depthguard for direct draws inDraw.cpp, populatingrecipe->hasDepth = state.depth.has_value().DrawWithRecipe, validatesrecipe.hasDepth == state.depth.has_value(), checks thattargetViewsmatchesstate.colors.size() + (recipe.hasDepth ? 1u : 0u), and verifies depth target identity viarecipe.targetViews.back() == DepthSurfaceView(context, *state.depth), rejecting withDrawRecipeMiss::TargetGoneon mismatch.docs/dev/debt/libSceAgcDriver.mdto document depth target validation behavior without mentioning HTILE fast clear handling.tests/execution/DepthBiasPerFace.cppwith dynamic RAIIGuestBlock(VirtualAlloc / aligned_alloc) to conform to MinGW PE/COFF 8192-byte object limit.Performance & Telemetry (Astro Bot PPSA21567)
Measured across alternating 10-second runs on the title intro/gameplay transition scene against base
ea2bbefb2:main(ea2bbefb2)main + #4947main(ea2bbefb2)main + #4947main(ea2bbefb2)main + #4947NotRecordable) to cached replay hits (DrawFromRecipe), saving ~8.9 µs per draw of descriptor and pipeline state validation.Tested
PPSA21567)agc_driver_depth_bias_per_face_tests(DepthDrawRecipevalidates successful recording/replay and negative rejection on altered target address and removed depth target). All tests pass.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 xXPBSXx on 2026-10-13T08:18:54Z.
Windows build check (MinGW GCC 15.2, Release, Windows 10): the new test does not compile on this toolchain.
Built on main
c2565f014with only this PR's commit applied (no other PR), targetagc_driver_depth_bias_per_face_tests:Both lines are
alignas(65536) static std::array<std::byte, 65536>objects; the PE/COFF object format used by MinGW caps static alignment at 8192. So the failure is in the PR's own test code, not in an interplay with other PRs. A heap/VirtualAlloc/aligned-allocation based buffer (or aligning at runtime within a larger buffer) would build on both platforms.Not tested: the test itself (it never got built), and nothing outside this compile error; no game run.
AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-13T09:20:51Z.
Three things:
alignas(65536), see the Windows report above); please make it build there.Imported from boykopovar/AnyPS5. Originally posted by Kikoarl on 2026-10-13T09:34:48Z.
Thanks @oneandonlydean for the review. Addressed all three points:
alignas(65536)arrays intests/execution/DepthBiasPerFace.cppwith a RAIIGuestBlockhelper allocating dynamically viaVirtualAllocon Windows andstd::aligned_allocon POSIX systems, ensuring full MinGW PE/COFF compatibility while maintaining 64 KiB alignment.docs/dev/debt/libSceAgcDriver.md. The debt entry now strictly documents the depth target validation and view identity matching present in the diff.ea2bbefb2to the PR description (~1.2 ms/frame improvement on Astro BotPPSA21567, ~134 depth draws/frame replayed with ~8.9 µs unit savings per draw). Rebased on latestorigin/main.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-13T22:38:04Z.
The
#include <windows.h>block atDepthBiasPerFace.cpp:129-134is inside the anonymous namespace, which MinGW's headers don't support. Please move it up to the other includes, asCopiedWriterCopy.cppdoes, and include<cstdlib>and<cstring>foraligned_alloc/free/memset.Imported from boykopovar/AnyPS5. Originally posted by mrfelek on 2026-10-13T23:28:36Z.
Numbers for this PR alone, as asked above. Diablo II: Resurrected (PPSA03912, 01.039.000), Linux, RTX 3080 Ti (NVIDIA 615.71.09),
APS5_HOST_IMPORT_MIB=16384,APS5_THREAD_PRIORITY=high.libSceAgcDriver.prxdiffers between the two builds; same runtime and settings, alternating runs A1 B1 A2 B2 A3 B3, each driven automatically to the same place (in game, standing still in the Rogue Encampment) and measured over the last 7 windows of 10 s.Mean 41.2 on A and 41.5 on B: no measurable difference (the two sets overlap, and the spread inside one set is about the size of the gap). It also changes nothing visible: no new refusal or abort in either build.
That fits this title: its draw-cache hit rate is only about 0.2% (the user data changes on almost every draw), so few of its draws are replayed from the cache and there is little for depth-target replay to speed up. So this is a no-change result on Diablo II, not evidence for or against the PR on a title that does hit the cache.
AI-assisted; the runs are from my machine and I can attach the
[draw-cache]and[present]lines of each run.Imported from boykopovar/AnyPS5. Originally posted by Kikoarl on 2026-10-14T00:02:13Z.
Done @oneandonlydean. Moved
<windows.h>to the top includes (outside the anonymous namespace) as inCopiedWriterCopy.cpp, added<cstdlib>and<cstring>, and rebased cleanly onto latestorigin/main(d1670009f). Verifiedagc_driver_depth_bias_per_face_testspasses.