Repository navigation
feat(agc): multisampled color and depth targets with CB resolves - #419
Conversation
9274a09 to
c407d98
Compare
|
A data point on the fast-clear part, in case it helps scope it: PPSA21567 (Astro Bot) fast-clears single-sample color targets through their CMASK, which this PR's What the title's draws show (Linux,
These draws are currently skipped ( Do you plan to cover single-sample targets in this PR, or would you welcome that as a follow-up on top of it? I'm trying the obvious extension locally (the same zero-fill hook and clear-on-next-use for 1-sample targets, anything else refused) and can report how it behaves. |
|
Follow-up on the single-sample case, with what Mesa's AMD drivers say about the CMASK codes (Mesa
That matches what PPSA21567 does. Its non-DCC targets ( I tried the extension locally on top of this PR (Linux, with other open PRs and local changes, not clean |
|
@boykopovar this one needs your call: should multisampled colour targets be host-only images? With this PR their guest sample planes and FMASK are never written or read, so guest memory never holds an MSAA target's contents. Sampling one stays refused, and a CB resolve lands in the single-sample destination's resident image. That is the model main already uses for depth surfaces (a host image with no write-back), so it's an architecture choice more than a correctness question. My read: fine as a step, because every shader path that would read the sample planes still throws, but a CPU or DMA read of that memory would see stale bytes without an error, as with depth today. Either way it needs a rebase: it conflicts with main in |
|
Thanks. Yes, host-only multisampled color targets are meant as a step. Every shader path that would read the sample planes or FMASK still throws, so the gap is the one you name: a CPU or DMA read of that memory sees stale bytes, as with depth surfaces on @ThisIsAkill, thanks for the CMASK data and the Mesa references. Single-sample CMASK fast clears fit better as a follow-up on top of this than in it. Your rules (a whole zero fill fast-clears to |
c407d98 to
5bb1b5c
Compare
|
Thanks for the rebase. The #374 commits it carries now match #374's head, and the |
5bb1b5c to
eddd4a3
Compare
eddd4a3 to
3dc3e9d
Compare
|
Rebased onto current |
|
Rebased again on current Our commits on your branch are unchanged: duplicate TechnicalDebt lines removed, the guest-access guard covering Not covered by any test here: an actual MSAA draw and Merging once CI is green. |
8c3cbc0 to
208b908
Compare
|
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.
|
|
@billythemenace2 thanks, that reading is right: the guard ranges only go away at device teardown, so once Unity hands a former 2x target's memory to another resource, every read of it throws. With #419 merged that is on It would help to know which of those wrote the 1280x431 texture in PPSA06888. If you can add a print, the cheapest place to start is the single-sample color/depth target setup over the range: that's the hook I'd put first. The sample-location stops (New Joe & Mac, PPSA06888) are #2169's path, as you found. |
|
Source for how another PS5 emulator treats the AI-assisted (Claude Code). |
|
Summary of the registers behind
What a minimum treatment could be, as far as these sources support it: (1) keep rejecting unless the 16 location registers equal a standard table, as this PR does; (2) if an approximation is accepted, accept the mirrored 2x pattern only, explicitly, and list in AI-assisted (Claude Code). |
|
Update for New Joe & Mac: Caveman Ninja (PPSA02801), the title that stopped on AI-assisted (Claude Code). |
|
Following up on the retire-on-write idea from #4199/#1189: I implemented and tested it locally against Fallen Legion (PPSA07645), and wanted to share the results. Implementation
Result in the game. Fallen Legion aborts on a real macro that reuses a multisampled color target's memory after a resolve (the same 4x 3840x2160 target that #2121's resolve involves). With this change the store now retires that target instead of leaving a stale guard that crashes the next frame: One observation for the follow-up. The remaining overlapping reads in the title do not have a tracked preceding write: parts of the reuse come from GPU shader stores (or writes that happen before the target/guard exists). Retiring on writes alone therefore does not fully un-hang the game. Since true MSAA sampling/readback is not implemented, refusing those reads only ever aborts the title; letting them read the (now foreign) memory would turn a hard crash into a minor visual artifact while a real read-side test proves the region was repurposed. Happy to turn the write-guard core + test into a PR if useful, or to adjust the read-side behavior to match what you prefer. |
With APS5_PIPELINE_DMA (on by default since the previous commit) a DMA_DATA was enqueued before the packet path's metadata notes ran, so a fill of 0 over a depth surface's HTILE (boykopovar#374) or a color target's CMASK (boykopovar#419) never reached the surface: agc_driver_depth_fast_clear_submit failed. The queued commit now notes the fill in order before it stores it, and a DMA copy is checked against multisampled targets at enqueue, as on the packet path. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
With APS5_PIPELINE_DMA (on by default since the previous commit) a DMA_DATA was enqueued before the packet path's metadata notes ran, so a fill of 0 over a depth surface's HTILE (boykopovar#374) or a color target's CMASK (boykopovar#419) never reached the surface: agc_driver_depth_fast_clear_submit failed. The queued commit now notes the fill in order before it stores it, and a DMA copy is checked against multisampled targets at enqueue, as on the packet path. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
With APS5_PIPELINE_DMA (on by default since the previous commit) a DMA_DATA was enqueued before the packet path's metadata notes ran, so a fill of 0 over a depth surface's HTILE (boykopovar#374) or a color target's CMASK (boykopovar#419) never reached the surface: agc_driver_depth_fast_clear_submit failed. The queued commit now notes the fill in order before it stores it, and a DMA copy is checked against multisampled targets at enqueue, as on the packet path. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
With APS5_PIPELINE_DMA=1 a DMA_DATA was enqueued before the packet path's metadata notes ran, so a fill of 0 over a depth surface's HTILE (boykopovar#374) or a color target's CMASK (boykopovar#419) never reached the surface: agc_driver_depth_fast_clear_submit failed. The queued commit now notes the fill in order before it stores it, and a DMA copy is checked against multisampled targets at enqueue, as on the packet path. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> (cherry picked from commit fda7dbf)
What
Draws with multisampling enabled were refused (
multisampling or coverage conversion is unsupported). They now render:CB_COLOR_CONTROLresolve over a multisampled CB0 runs as a render pass whose resolve attachment is CB1's resident image. A single-sample resolve is still refused as before.CB_COLOR_CLEAR_WORD.EQAA (fewer fragments than samples), coverage conversion, nonstandard sample locations and multisampled mips stay refused. The draw key gains the sample-location and CMASK_BASE_EXT registers.
GTA V renders its reflection cube's faces into a 256x256 2x target and resolves each face into the cube.
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.
ctest: all tests pass. New cases cover: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 repositoryDrawKeyRegisters; whichever merges second keeps both sets of ranges. GTA V resolves into 4 KiB standard targets, which feat(agc): 4 KiB standard color targets and color views of one array slice #377 adds: whichever of feat(agc): 4 KiB standard color targets and color views of one array slice #377 and this merges second letsRunColorMetadataPassacceptColorTileMode::Standard4KBdestinations too (one condition)🤖 Generated with Claude Code