Repository navigation
feat(agc): run DB depth copies into a single-sample R32 float target - #5499
codingreapermaps wants to merge 1 commit into
Conversation
A draw with DB_RENDER_CONTROL.DEPTH_COPY copies one sample of the Z_32_FLOAT depth surface into color target 0. It now runs as a compute pass that fetches that sample and stores it into the R32 float target, when the draw covers the whole surface without depth or stencil tests. With COPY_CENTROID the sample is the first one the draw covers, which is sample 0 under the full sample mask the driver requires, as radeonsi programs its per-sample DB to CB copies. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The copy is picked from the viewport and scissor, not from what the draw covers, which is the same open problem as #1395. Could the copy run as the draw itself (a pixel shader reading the depth sample, rasterized from the title's geometry) so coverage comes from the draw and nothing needs guessing? |
|
Only PPSA12361 ran with the Running the copy as the draw itself makes sense, and it's the only way I see to close the coverage gap #1395 is also stuck on. Before rewriting I'd like to check the design with you, since it reaches beyond this PR:
Two questions:
I'll convert this PR to draft until the design is settled. |
|
A second concrete workload is now reported in issue #6304: |
|
Both parts make sense. Yes, please put MSAA depth sampling through the shadow image in its own PR first, with a test that sampling returns the depth values at each sample count, and this one depending on it. A driver-owned guest pixel program is fine with me: it keeps everything on the normal draw path; just mark it in the debt file as driver-authored code. For the single-sample case from #6304, either a |
|
Checking in, since #6304 now has a second region (PPSA34502) reproducing the same 0x84 abort on Linux. Where this stands against current
The Z32 to R32 copy and the sample pick look right. When you have a rebased head with the 1-sample case fixed, we'll review and run full CI. |
|
I opened #7318 as the separate multisample depth shadow-image prerequisite requested here. It copies the native depth samples into a same-format, same-sample-count sampled image and leaves sampled usage off the attachment. The focused target builds on Linux; its runtime stops at this host's CPU-feature guard before device selection, so I have no GPU result for this change. If the implementation matches the planned path, #5499 can rebase on it and list it as a dependency after review/merge. |
|
The |
|
Datapoint from a third title on the 0x88 is A stencil variant of the pass, written locally to see what comes next: Setup. Windows 11 (26200), RTX 4090 (NVIDIA 616.92), WinLibs GCC 15.2.0 r7 (UCRT), Release AI-assisted: yes (Claude Code) |
|
Status update: the proposed multisample-depth shadow prerequisite, #7318, has now merged. On the current #5499 head ( |
|
@codingreapermaps, I rebased this onto current Rebase. It conflicted in
815c622: the one-sample case (@oneandonlydean's and @MarcZX10's point):
Tested on Ubuntu 24.04, GCC 13.3, RTX 4070 Ti, driver 595.99.02:
Still open from the review: the copy is chosen from the viewport and scissor and isn't drawn from the title's geometry (the driver pixel program plan from 16 Oct). I haven't started on that. Would you reset this PR's branch to mine? That would be AI-assisted: yes (Claude Code) |
|
@milescoviello, I tested your branch with PPSA34501 and it gets past the |
|
@codingreapermaps @milescoviello alexpournaras reports above that milescoviello's rebase of this PR ( To get that reviewed and merged, could the rebased branch become this PR's head? @codingreapermaps, if you're happy to, reset this branch to 815c622 (your commit is kept as is). If you'd rather not, @milescoviello could open it as a new PR crediting you, and we'd close this one in its favour. Either works for us. Tell us which you prefer. The draw-based copy and |
|
Thanks @alexpournaras. That's the single-sample case from #6304 on the other region's release, so both regions now get past the 0x84 stop with 815c622. AI-assisted: yes (Claude Code) |
|
Thanks @oneandonlydean. Either way works for me too. I'll wait for @codingreapermaps until tomorrow before opening anything. One correction: the AI-assisted: yes (Claude Code) |
|
Another title stops on the same draw: Metal Gear & Metal Gear 2: Solid Snake (PPSA14408, #8737). Its game executable (started with |
|
@JJenkx a rebased copy is on my fork: At this head, on Linux, RTX 4070 Ti (NVIDIA 595.99.02), GCC 13.3, Release, AI-assisted: yes (Claude Code) |
|
As @oneandonlydean offered, I opened the carry as #8975. It holds @codingreapermaps's commit, with their authorship, plus my one-sample fix, rebased onto @JJenkx: the fork branch AI-assisted: yes (Claude Code) |
|
@milescoviello thanks for opening #8975 with @codingreapermaps's authorship kept. We'll review it once it's out of draft with the draw-based copy, and close this one in its favour then. |
|
@milescoviello your rebase (95ca794) passes our review, including your one-sample fix, and we'd like to merge it. Could you open it as a PR from your branch, crediting @codingreapermaps (their commits kept, or a Co-authored-by line)? Then we'll run full CI and merge it, and close this one as carried by yours. The whole-surface compute copy is fine for now; please keep the debt line for it. |
|
Carried by #8975, which landed this change with credit. Thanks for the original work here. |
What
A draw with
DB_RENDER_CONTROL.DEPTH_COPYthrewDB_RENDER_CONTROL depth copy, resummarize or decompress is unsupported. PPSA12361 (Transport Fever 2: Console Edition) issues one in every frame of a map:DB_RENDER_CONTROL = 0x84(DEPTH_COPYwithCOPY_CENTROID), a two-sampleZ_32_FLOATdepth surface (2688x1512) and a single-sample R32 float color target of the same size that its ambient occlusion pass samples next.DecodeDepthCopyPassrecognises the draw before shader compilation: depth copy only (no stencil copy, clear, resummarize or decompress), no depth or stencil tests, aZ_32_FLOATdepth plane, color writes to the red channel of color target 0 alone, a single-sample R32 float target of the depth surface's extent, the fullPA_SC_AA_MASKand a viewport and scissor covering the whole surface. Anything else throws, and draws withoutDEPTH_COPYare unchanged.DepthSample.comp) that fetches one sample of the host depth image and stores it into the target's resident storage image, which is then marked dirty like any other GPU write.COPY_CENTROIDthe copied sample is the first one the draw covers. radeonsi programs its DB to CB copies withCOPY_CENTROIDand a one-sample mask per sample (loop insi_blit_dbcb_copy); under the full sample mask required here that is sample 0. WithoutCOPY_CENTROID,COPY_SAMPLEselects it. The console is not measured; this is recorded indocs/dev/debt/libSceAgcDriver.md.SAMPLEDusage when the device can sample their format at their sample count; single-sample surfaces keep it unconditionally as before.drawCoversand is reused here.Overlap with #1395. That draft also recognises depth copy draws (
DecodeDepthCopyPass) together with depth clears, and is blocked on proving that a draw selected from register state really covers the whole surface. This PR has the same limitation: the copy is chosen from the viewport and scissor, not from the draw's geometry. It is narrower (depth copies into an R32 float target only) and adds a title that needs it (PPSA12361) and an execution test of the copy on the GPU. If the maintainers prefer to land the copy through #1395, this can be closed in its favour and the title data moved there.Tested
Windows 11, MinGW-w64 GCC 15.2.0, NVIDIA GeForce MX450 (driver 581.83).
agc_driver_graphics_tests: newdepthCopyPassTestsdecode the PPSA12361 register state and refuse a stencil copy, a missing sample, a partial sample mask, depth tests, a non-Z_32_FLOATplane, writes beyond the red channel, a non-R32 float target and a viewport over part of the surface. All graphics tests pass.agc_driver_depth_storage_tests: newDepthCopyCasecopies samples 0 and 1 of a cleared two-sample depth surface into aRenderTarget-tiled R32 float target and reads the cleared depth back from every texel of guest memory; a copy without a depth surface, of a third sample and of another extent are refused. The suite passes. On this machine the first Vulkan device is an Intel Iris Xe withoutshaderInt64, so it ran withVK_LOADER_DRIVERS_SELECT=*nv*.mainat0aa4cb1c2.Checklist
main; no other open PR implements the same functions (overlaps the draft feat(agc): add experimental depth clear and copy recognition #1395, see above)NotImplemented_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)