feat(agc): import cleared native multisample D32S8 targets and whole HTILE fills #6300

Merged
Gashrod1 merged 2 commits from upstream-pr/6300 into main 2026-11-02 07:58:19 +00:00
Gashrod1 commented 2026-10-15 10:19:48 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Gashrod1 on 2026-10-15T10:19:48Z.


What

Follow-up to #5554 (merged), offered in https://github.com/boykopovar/AnyPS5/pull/5554#issuecomment-6184204253, with the data of https://github.com/boykopovar/AnyPS5/pull/5554#issuecomment-6181490234. Rebased on main 8dc92ae29; it keeps the HTILE routing check from #5627.

#5554 refuses every native multisampled depth target with a stencil plane. DAVE THE DIVER (PPSA19115) has a 2-sample 1920x1080 D32_SFLOAT_S8_UINT target with its stencil in HTILE. A fill of 0 then covers that whole HTILE (0x21be48000, 0x30000 bytes) and the title samples the depth at frame 17. With #5496 and #6297 it stops there (the D32S8 refusal is behind the fill one):

native multisample depth metadata fill transition is not implemented
  • D32S8 import. A D32_SFLOAT_S8_UINT target with HTILE stencil (TILE_STENCIL_DISABLE clear) is imported when every HTILE word proves both planes cleared:

    • depth: the existing proof (htileProvesClear, stencil encoding);
    • stencil: SMem (bits 9:8) 0, so the plane holds DB_STENCIL_CLEAR. The host image is already cleared to that value.

    Each proof has its own refusal. The stencil plane (MultisampledDepthBytes(extent, 1, samples)) joins the depth and HTILE ranges. It must be accessible and watched, is generation-checked and guarded against guest publication, and must not overlap either of them. A depth-only HTILE (htileStencil false) and an unaligned stencil plane are refused. D16S8 is still refused.

  • Whole HTILE fill. A DMA or compute fill covering the whole HTILE of a sampled native target is a clear transition. It is proven at the next sample the way #5554 proves an HTILE mask clear:

    • complete tracked stores since the fill (StoredAllSince);
    • no CPU write and no queued GPU write since the fill;
    • depth and stencil planes unchanged;
    • every word proving the depth clear and, on a stencil target, the stencil clear.

    The clear is then recorded on both planes. This applies to D16 and D32 targets too. A partial fill keeps the old refusal.

  • Fill still queued on the GPU. A fill the driver records on the GPU (VulkanDevice::FillBuffer) is often still pending when the title binds or samples the depth in the same frame. The HTILE words in guest memory are then not the fill's yet, and the queued write was refused as "external GPU writes".

    • The fill keeps its write note (Recorder::LastWriteNote) and its pattern.
    • While that note is still the newest queued write over the HTILE (NewestWriteNote), the clear is proven from the pattern, not from memory.
    • A GPU fill needs no complete tracked store.
    • A later queued write, a CPU write to the HTILE, a depth plane write, or a pattern that does not prove the clear is refused as before.
  • HTILE mask clear on a stencil target is refused. The mask kernel's effect on the stencil fields is not modeled.

  • Windows. GuestMemory::Watched excludes host-imported regions there, so the import keeps refusing with "requires watched accessible guest memory" until that memory is owned and tracked. This change does not touch that boundary, and a test pins it for the stencil plane.

  • The native multisampled depth entry in docs/dev/debt/libSceAgcDriver.md now describes the stencil plane and the fill transition.

Tested

Linux, Intel Alder Lake-P iGPU (Mesa 26.2.4), on main 8dc92ae29:

  • New agc_driver_native_depth_stencil (--stencil): D32S8 at 2, 4 and 8 samples, depth clear 0 and 1, both with an all-zero (or all 1.0) initial HTILE and with a later whole HTILE fill, covered separately.
    • Depth is checked by fetching every sample.
    • Stencil is checked through stencil-tested draws, since MSAA stencil sampling stays refused:
      • a draw with EQUAL clearStencil + 1 leaves the depth untouched;
      • a draw with EQUAL clearStencil writes every sample.
    • Fill cases: three cycles. Each cycle draws stencil 0xc3 (REPLACE) and confirms that the old clear value no longer passes. It then fills with new clear values, depth 0/1 and stencil 0x5a/0x33, and checks both planes again.
  • 15 refusal controls in the same test:
    • initial words proving depth but not stencil (SMem 3), stencil but not depth (ZMask 15), partial stencil (SMem 1), contradictory depth (one 1.0 word in a 0.0 HTILE);
    • unwatched stencil memory;
    • a CPU write and a queued GPU write to the stencil plane;
    • partial fill;
    • fill words failing the depth or the stencil proof;
    • incomplete tracked store;
    • CPU write to the HTILE after the fill;
    • stencil plane write after the fill;
    • overlapping fills;
    • HTILE mask clear of the stencil target.
  • agc_driver_native_depth_clear_refusals adds four queued-fill refusals: a later queued write, a CPU write to the HTILE, a depth plane write, and a fill pattern that does not prove the clear.
  • Mutation check for the queued fill: without the change, every queued-fill case fails with "external GPU writes"; skipping the pattern proof fails the bad-pattern refusal.
  • Mutation check: recording only the depth clear for a fill, or dropping the initial or the completed stencil proof, each fails the test.
  • agc_driver_native_depth_clears also runs every completed-clear case through a whole HTILE fill and through a whole HTILE fill still queued on the GPU when the depth is checked (72 cases). The eligibility test now expects a partial fill to refuse as before, and a whole fill with no store to refuse for lack of a complete tracked store.
  • Every agc* test (596) passes or skips except agc_driver_multisample_fill_host_only, which fails the same way on main (vkWaitSemaphoresKHR -4, noted in #6297), and agc_driver_store_over_untracked, which failed once in the parallel run and once in three runs alone: the known #6347 race fixed by #6359. Rerun with the queued-fill commit: the same two, plus agc_pending_key_stores once in the parallel run, which passes three runs out of three alone and does not touch depth surfaces.

Not proven in a title. PPSA19115 on Linux (Intel Alder Lake-P, Mesa 26.2.4) with this branch and #6297 still refuses its D32S8 target when the surface is created: "requires watched accessible guest memory". Its allocation (0x231580000, 0x10f4000) is host-imported by host pointer there (the import probe reports that host imports resolve write protection), so the depth range is unwatched and the fill path above is never reached. The title then reports "metadata fill transition" only because that later fill overwrites the first refusal. The watched-memory boundary therefore blocks this title on Linux as well as on Windows.

On Windows (RTX 5060, NVIDIA 596.36), PPSA19115 gets past that boundary only with local, unpublished changes: the private-import write watch prototype discussed in https://github.com/boykopovar/AnyPS5/pull/6300#issuecomment-6193282566, #6297, and page-precise write checks over the native depth ranges (a follow-up PR). With those, the queued-fill case above is what stopped it at frame 14: a FillBuffer of the whole HTILE (0x21be48000, 0x30000 bytes) still pending when the depth was bound. With this commit it runs past it, holds 60 fps on the title screen and reaches gameplay; the next refusal comes when the player dives and is not addressed here.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none (#5554 is merged)
  • Unblocks: none on its own; PPSA19115 #5963 also needs watched memory for host-imported ranges, on Windows and on Linux
  • GPUs tested: Intel Alder Lake-P iGPU, Mesa 26.2.4, Arch Linux
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4871722598 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6300). Originally posted by [Gashrod1](https://github.com/Gashrod1) on 2026-10-15T10:19:48Z. --- ### What Follow-up to #5554 (merged), offered in https://github.com/boykopovar/AnyPS5/pull/5554#issuecomment-6184204253, with the data of https://github.com/boykopovar/AnyPS5/pull/5554#issuecomment-6181490234. Rebased on `main` 8dc92ae29; it keeps the HTILE routing check from #5627. #5554 refuses every native multisampled depth target with a stencil plane. DAVE THE DIVER (PPSA19115) has a 2-sample 1920x1080 `D32_SFLOAT_S8_UINT` target with its stencil in HTILE. A fill of 0 then covers that whole HTILE (`0x21be48000`, `0x30000` bytes) and the title samples the depth at frame 17. With #5496 and #6297 it stops there (the D32S8 refusal is behind the fill one): ``` native multisample depth metadata fill transition is not implemented ``` - **D32S8 import.** A `D32_SFLOAT_S8_UINT` target with HTILE stencil (`TILE_STENCIL_DISABLE` clear) is imported when every HTILE word proves both planes cleared: - depth: the existing proof (`htileProvesClear`, stencil encoding); - stencil: SMem (bits 9:8) 0, so the plane holds `DB_STENCIL_CLEAR`. The host image is already cleared to that value. Each proof has its own refusal. The stencil plane (`MultisampledDepthBytes(extent, 1, samples)`) joins the depth and HTILE ranges. It must be accessible and watched, is generation-checked and guarded against guest publication, and must not overlap either of them. A depth-only HTILE (`htileStencil` false) and an unaligned stencil plane are refused. D16S8 is still refused. - **Whole HTILE fill.** A DMA or compute fill covering the whole HTILE of a sampled native target is a clear transition. It is proven at the next sample the way #5554 proves an HTILE mask clear: - complete tracked stores since the fill (`StoredAllSince`); - no CPU write and no queued GPU write since the fill; - depth and stencil planes unchanged; - every word proving the depth clear and, on a stencil target, the stencil clear. The clear is then recorded on both planes. This applies to D16 and D32 targets too. A partial fill keeps the old refusal. - **Fill still queued on the GPU.** A fill the driver records on the GPU (`VulkanDevice::FillBuffer`) is often still pending when the title binds or samples the depth in the same frame. The HTILE words in guest memory are then not the fill's yet, and the queued write was refused as "external GPU writes". - The fill keeps its write note (`Recorder::LastWriteNote`) and its pattern. - While that note is still the newest queued write over the HTILE (`NewestWriteNote`), the clear is proven from the pattern, not from memory. - A GPU fill needs no complete tracked store. - A later queued write, a CPU write to the HTILE, a depth plane write, or a pattern that does not prove the clear is refused as before. - **HTILE mask clear on a stencil target** is refused. The mask kernel's effect on the stencil fields is not modeled. - **Windows.** `GuestMemory::Watched` excludes host-imported regions there, so the import keeps refusing with "requires watched accessible guest memory" until that memory is owned and tracked. This change does not touch that boundary, and a test pins it for the stencil plane. - The native multisampled depth entry in `docs/dev/debt/libSceAgcDriver.md` now describes the stencil plane and the fill transition. ### Tested Linux, Intel Alder Lake-P iGPU (Mesa 26.2.4), on `main` 8dc92ae29: - New `agc_driver_native_depth_stencil` (`--stencil`): D32S8 at 2, 4 and 8 samples, depth clear 0 and 1, both with an all-zero (or all 1.0) initial HTILE and with a later whole HTILE fill, covered separately. - **Depth** is checked by fetching every sample. - **Stencil** is checked through stencil-tested draws, since MSAA stencil sampling stays refused: - a draw with `EQUAL clearStencil + 1` leaves the depth untouched; - a draw with `EQUAL clearStencil` writes every sample. - **Fill cases:** three cycles. Each cycle draws stencil `0xc3` (`REPLACE`) and confirms that the old clear value no longer passes. It then fills with new clear values, depth 0/1 and stencil `0x5a`/`0x33`, and checks both planes again. - 15 refusal controls in the same test: - initial words proving depth but not stencil (SMem 3), stencil but not depth (ZMask 15), partial stencil (SMem 1), contradictory depth (one 1.0 word in a 0.0 HTILE); - unwatched stencil memory; - a CPU write and a queued GPU write to the stencil plane; - partial fill; - fill words failing the depth or the stencil proof; - incomplete tracked store; - CPU write to the HTILE after the fill; - stencil plane write after the fill; - overlapping fills; - HTILE mask clear of the stencil target. - `agc_driver_native_depth_clear_refusals` adds four queued-fill refusals: a later queued write, a CPU write to the HTILE, a depth plane write, and a fill pattern that does not prove the clear. - Mutation check for the queued fill: without the change, every queued-fill case fails with "external GPU writes"; skipping the pattern proof fails the bad-pattern refusal. - Mutation check: recording only the depth clear for a fill, or dropping the initial or the completed stencil proof, each fails the test. - `agc_driver_native_depth_clears` also runs every completed-clear case through a whole HTILE fill and through a whole HTILE fill still queued on the GPU when the depth is checked (72 cases). The eligibility test now expects a partial fill to refuse as before, and a whole fill with no store to refuse for lack of a complete tracked store. - Every `agc*` test (596) passes or skips except `agc_driver_multisample_fill_host_only`, which fails the same way on `main` (`vkWaitSemaphoresKHR` -4, noted in #6297), and `agc_driver_store_over_untracked`, which failed once in the parallel run and once in three runs alone: the known #6347 race fixed by #6359. Rerun with the queued-fill commit: the same two, plus `agc_pending_key_stores` once in the parallel run, which passes three runs out of three alone and does not touch depth surfaces. Not proven in a title. PPSA19115 on Linux (Intel Alder Lake-P, Mesa 26.2.4) with this branch and #6297 still refuses its D32S8 target when the surface is created: "requires watched accessible guest memory". Its allocation (`0x231580000`, `0x10f4000`) is host-imported by host pointer there (the import probe reports that host imports resolve write protection), so the depth range is unwatched and the fill path above is never reached. The title then reports "metadata fill transition" only because that later fill overwrites the first refusal. The watched-memory boundary therefore blocks this title on Linux as well as on Windows. On Windows (RTX 5060, NVIDIA 596.36), PPSA19115 gets past that boundary only with local, unpublished changes: the private-import write watch prototype discussed in https://github.com/boykopovar/AnyPS5/pull/6300#issuecomment-6193282566, #6297, and page-precise write checks over the native depth ranges (a follow-up PR). With those, the queued-fill case above is what stopped it at frame 14: a `FillBuffer` of the whole HTILE (`0x21be48000`, `0x30000` bytes) still pending when the depth was bound. With this commit it runs past it, holds 60 fps on the title screen and reaches gameplay; the next refusal comes when the player dives and is not addressed here. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none (#5554 is merged) - [x] Unblocks: none on its own; PPSA19115 #5963 also needs watched memory for host-imported ranges, on Windows and on Linux - [x] GPUs tested: Intel Alder Lake-P iGPU, Mesa 26.2.4, Arch Linux - [x] AI-assisted: yes
Amoenus commented 2026-10-15 11:20:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Amoenus on 2026-10-15T11:20:31Z.


@Gashrod1 Parent #5554 is now merged at c9a96a548cd7e63161f069433cdfc56cbae26ac6; #5524 is merged. Its single post-drain notification carries the native extent. Our independent Windows composition (c9 plus the now-merged #6333 PM4 build dependency) passes the full app/libs build, checkers and27 groups once plus five repeats per selector:324 executions, no skips/timeouts, maximum5.73s. Fourteen runtime groups report each actual GPU. Exact pins, analysis advisory and scope; published5554 is unchanged.

Update on the Windows boundary: our separate native-color integration now has an explicit private-import watch promotion prototype and controls. It keeps the1MiB default, settles before the initial snapshot and rejects unsupported ownership/exclusion transitions. The previously failing fixture passes5/5 on each GPU and fails5/5 with only the promotion call disabled. #3036 maintains the full scope and82-group results. This could inform the depth-side transition; I have not applied it to #6300 or tested D32S8 or a new title replay. AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6190839949 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6300#issuecomment-6190839949). Originally posted by [Amoenus](https://github.com/Amoenus) on 2026-10-15T11:20:31Z. --- @Gashrod1 Parent #5554 is now merged at `c9a96a548cd7e63161f069433cdfc56cbae26ac6`; #5524 is merged. Its single post-drain notification carries the native extent. Our independent Windows composition (c9 plus the now-merged #6333 PM4 build dependency) passes the full app/libs build, checkers and27 groups once plus five repeats per selector:324 executions, no skips/timeouts, maximum5.73s. Fourteen runtime groups report each actual GPU. [Exact pins, analysis advisory and scope](https://github.com/boykopovar/AnyPS5/pull/5554#issuecomment-6192109486); published5554 is unchanged. Update on the Windows boundary: our separate native-color integration now has an [explicit private-import watch promotion prototype and controls](https://github.com/Amoenus/AnyPS5/compare/1a0abe338bef3306450c2fe204eac535ff6d16d2...3870cd16b8703ebea87b0a1414d5cfa60b6855ea). It keeps the1MiB default, settles before the initial snapshot and rejects unsupported ownership/exclusion transitions. The previously failing fixture passes5/5 on each GPU and fails5/5 with only the promotion call disabled. #3036 maintains the full scope and82-group results. This could inform the depth-side transition; I have not applied it to #6300 or tested D32S8 or a new title replay. AI-assisted: yes.
Gashrod1 commented 2026-10-15 13:31:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Gashrod1 on 2026-10-15T13:31:11Z.


@Amoenus Thanks. Rebased on main 8dc92ae29 and marked ready. The only conflict was in NativeMultisampleDepth.cpp, against #5627's CheckHtileRouting; both functions are kept. All four native depth tests pass, and the three stencil mutations listed in the description still fail the test on this base.

A title result, for the depth-side transition. PPSA19115 on Linux (Alder Lake-P, Mesa 26.2.4), with this PR and #6297, refuses its 2-sample 1920x1080 D32S8 target when it is created: "native multisample depth import requires watched accessible guest memory". The depth range 0x231590000+0x10e0000 is accessible but unwatched. Its allocation (0x231580000+0x10f4000) is host-imported by host pointer: the probe reports that host imports resolve write protection. ImportWatched and refreshImports then unwatch it. The dma-buf import, which the probe reports keeps the watch, is only tried when the host-pointer import fails. So on Linux too, the fill path is never reached for this title.

Both the Linux and the earlier Windows logs ended on "native multisample depth metadata fill transition is not implemented". That is because NoteDepthMetadataFill overwrites sampling.refusal for any overlapping surface, including one already refused at creation, so the first reason is lost. Keeping the first refusal would make title logs point at the real boundary. I can open that as a small separate fix if you agree.

Your private-import promotion looks like the right shape for the Windows depth side: RequireGuestWriteWatch over the depth, HTILE and (for D32S8) stencil ranges before the initial snapshot in prepareDepthSampling, as MultisampleTarget does for color. Do you plan to open it as a PR? If so, I would stack the depth-side call and its D32S8 controls on it and run this title on Windows.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6193282566 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6300#issuecomment-6193282566). Originally posted by [Gashrod1](https://github.com/Gashrod1) on 2026-10-15T13:31:11Z. --- @Amoenus Thanks. Rebased on `main` 8dc92ae29 and marked ready. The only conflict was in `NativeMultisampleDepth.cpp`, against #5627's `CheckHtileRouting`; both functions are kept. All four native depth tests pass, and the three stencil mutations listed in the description still fail the test on this base. A title result, for the depth-side transition. PPSA19115 on Linux (Alder Lake-P, Mesa 26.2.4), with this PR and #6297, refuses its 2-sample 1920x1080 D32S8 target when it is created: "native multisample depth import requires watched accessible guest memory". The depth range `0x231590000+0x10e0000` is accessible but unwatched. Its allocation (`0x231580000+0x10f4000`) is host-imported by host pointer: the probe reports that host imports resolve write protection. `ImportWatched` and `refreshImports` then unwatch it. The dma-buf import, which the probe reports keeps the watch, is only tried when the host-pointer import fails. So on Linux too, the fill path is never reached for this title. Both the Linux and the earlier Windows logs ended on "native multisample depth metadata fill transition is not implemented". That is because `NoteDepthMetadataFill` overwrites `sampling.refusal` for any overlapping surface, including one already refused at creation, so the first reason is lost. Keeping the first refusal would make title logs point at the real boundary. I can open that as a small separate fix if you agree. Your private-import promotion looks like the right shape for the Windows depth side: `RequireGuestWriteWatch` over the depth, HTILE and (for D32S8) stencil ranges before the initial snapshot in `prepareDepthSampling`, as `MultisampleTarget` does for color. Do you plan to open it as a PR? If so, I would stack the depth-side call and its D32S8 controls on it and run this title on Windows. AI-assisted: yes
Neithennn commented 2026-10-15 15:52:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Neithennn on 2026-10-15T15:52:29Z.


Windows NVIDIA run, since the description lists an Intel iGPU only.

Windows 11 Pro 26200, NVIDIA GeForce RTX 4080 (driver 617.42), AMD Ryzen 7 5800X, WinLibs GCC 15.2.0 r7, Ninja, Release, bundled dependencies, BUILD_TESTING=ON, ANYPS5_NO_SHADER_CACHE=1. Head c11074be8 merged onto main 92e50418f; full build succeeds.

  • Targeted, with ANYPS5_REQUIRE_VULKAN=1: agc_driver_native_depth_stencil, agc_driver_native_multisample_depth, agc_driver_native_depth_clears, agc_driver_native_depth_clear_refusals, agc_driver_native_depth_retirement, agc_driver_depth_htile_write, agc_driver_sample_mask_multisample, agc_driver_sample_multisample_target, agc_multisample_guest_access, agc_driver_multisample_fill_host_only: 10/10 pass.
  • agc_driver_native_depth_stencil reports every case as run on the RTX 4080 (2, 4 and 8 samples, clear 0 and 1, with and without fill; the fill cases refilled three times), none skipped.
  • Full ctest -j 8: 1295/1295. Unchanged main on the same machine: 1294/1294.

No title run.

AI-assisted: yes (runs done with Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6196281821 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6300#issuecomment-6196281821). Originally posted by [Neithennn](https://github.com/Neithennn) on 2026-10-15T15:52:29Z. --- Windows NVIDIA run, since the description lists an Intel iGPU only. Windows 11 Pro 26200, NVIDIA GeForce RTX 4080 (driver 617.42), AMD Ryzen 7 5800X, WinLibs GCC 15.2.0 r7, Ninja, Release, bundled dependencies, `BUILD_TESTING=ON`, `ANYPS5_NO_SHADER_CACHE=1`. Head `c11074be8` merged onto main `92e50418f`; full build succeeds. - Targeted, with `ANYPS5_REQUIRE_VULKAN=1`: `agc_driver_native_depth_stencil`, `agc_driver_native_multisample_depth`, `agc_driver_native_depth_clears`, `agc_driver_native_depth_clear_refusals`, `agc_driver_native_depth_retirement`, `agc_driver_depth_htile_write`, `agc_driver_sample_mask_multisample`, `agc_driver_sample_multisample_target`, `agc_multisample_guest_access`, `agc_driver_multisample_fill_host_only`: 10/10 pass. - `agc_driver_native_depth_stencil` reports every case as run on the RTX 4080 (2, 4 and 8 samples, clear 0 and 1, with and without fill; the fill cases `refilled three times`), none skipped. - Full `ctest -j 8`: 1295/1295. Unchanged main on the same machine: 1294/1294. No title run. AI-assisted: yes (runs done with Claude Code).
billythemenace2 commented 2026-10-15 16:54:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by billythemenace2 on 2026-10-15T16:54:09Z.


A title case for this PR: SONIC SUPERSTARS (PPSA06888) on main ec1193dc3 plus #5865, #5882 and #6297 stops about 30 s in, with no input, at:

AGC graphics: native multisample depth metadata fill transition is not implemented

A debug print in NoteDepthMetadataFill shows whole-HTILE fills of 0 over two 1920x1080 2-sample depth targets without stencil metadata, repeated every frame:

fill 0x225188000+0x30000 pattern 0x00000000 over htile 0x225188000+0x30000 of 1920x1080 2-sample depth 0x228850000 stencil=0 covers=1
fill 0x2251c0000+0x30000 pattern 0x00000000 over htile 0x2251c0000+0x30000 of 1920x1080 2-sample depth 0x22b810000 stencil=0 covers=1

With this PR (c11074be8) added, two runs gave two different results. The first stopped at the same fill transition refusal. The second, with the debug print, got past it and stopped at:

AGC graphics: native multisample stencil import requires HTILE stencil metadata

That is a D32S8 target whose HTILE has no stencil metadata. I have not identified which target it is yet. The two targets above report stencil=0, so it may be a third one.

Setup: Windows 11, MinGW-w64 GCC 15, Release, AMD Radeon RX 5700 XT (driver 32.0.21045.5002). Game bring-up: #5382.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6197524673 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6300#issuecomment-6197524673). Originally posted by [billythemenace2](https://github.com/billythemenace2) on 2026-10-15T16:54:09Z. --- A title case for this PR: SONIC SUPERSTARS (PPSA06888) on `main` `ec1193dc3` plus #5865, #5882 and #6297 stops about 30 s in, with no input, at: ``` AGC graphics: native multisample depth metadata fill transition is not implemented ``` A debug print in `NoteDepthMetadataFill` shows whole-HTILE fills of 0 over two 1920x1080 2-sample depth targets without stencil metadata, repeated every frame: ``` fill 0x225188000+0x30000 pattern 0x00000000 over htile 0x225188000+0x30000 of 1920x1080 2-sample depth 0x228850000 stencil=0 covers=1 fill 0x2251c0000+0x30000 pattern 0x00000000 over htile 0x2251c0000+0x30000 of 1920x1080 2-sample depth 0x22b810000 stencil=0 covers=1 ``` With this PR (`c11074be8`) added, two runs gave two different results. The first stopped at the same `fill transition` refusal. The second, with the debug print, got past it and stopped at: ``` AGC graphics: native multisample stencil import requires HTILE stencil metadata ``` That is a D32S8 target whose HTILE has no stencil metadata. I have not identified which target it is yet. The two targets above report `stencil=0`, so it may be a third one. Setup: Windows 11, MinGW-w64 GCC 15, Release, AMD Radeon RX 5700 XT (driver 32.0.21045.5002). Game bring-up: #5382. AI-assisted (Claude Code).
Gashrod1 commented 2026-10-16 08:08:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Gashrod1 on 2026-10-16T08:08:51Z.


@billythemenace2 thanks for the detailed report. Both messages fit one explanation.

fill transition: NoteDepthMetadataFill only takes the whole-HTILE fill path when samplingActive is set. Your print shows covers=1, so the fill took the generic branch because those surfaces were already refused when they were created. That branch then replaces the creation reason with metadata fill transition, so the message hides the real cause. #6423 keeps the first refusal. With it added, the first run should report the same reason as the second.

requires HTILE stencil metadata: this is the creation refusal. prepareDepthSampling refuses a D32S8 target whose HTILE has no stencil metadata (!htileStencil || htileDepthOnly). If the stencil=0 in your print is the HTILE stencil bit, and not the stencil address, those two 1920x1080 targets are likely this case rather than a third target. Printing target.stencilAddress, htileStencil and htileDepthOnly from prepareDepthSampling would confirm it. Without HTILE stencil metadata the stencil plane stays uncompressed, so it could probably be imported straight from its plane. I have not written that yet. It would be a follow-up to this PR and is not part of it.

On Windows, once these targets are accepted, the next stop may be metadata fill over unwatched memory or unproven fast-clear transition, if the HTILE or depth lands on host imports that write watching does not cover. I hit that on Dave the Diver (PPSA19115).

Further Dave fixes are on my local branch and will come as separate PRs that depend on this one:

  • releasing a native depth owner when another depth plane is placed over its memory;
  • releasing it when the CPU rewrites its memory before a guarded read;
  • page-precise CPU write checks next to the HTILE inside the same 64 KiB block.

The queued fill that changed between your two runs is already handled in c11074be8. Run-to-run timing likely decides which surface is refused first.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6211048701 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6300#issuecomment-6211048701). Originally posted by [Gashrod1](https://github.com/Gashrod1) on 2026-10-16T08:08:51Z. --- @billythemenace2 thanks for the detailed report. Both messages fit one explanation. **`fill transition`**: `NoteDepthMetadataFill` only takes the whole-HTILE fill path when `samplingActive` is set. Your print shows `covers=1`, so the fill took the generic branch because those surfaces were already refused when they were created. That branch then replaces the creation reason with `metadata fill transition`, so the message hides the real cause. #6423 keeps the first refusal. With it added, the first run should report the same reason as the second. **`requires HTILE stencil metadata`**: this is the creation refusal. `prepareDepthSampling` refuses a D32S8 target whose HTILE has no stencil metadata (`!htileStencil || htileDepthOnly`). If the `stencil=0` in your print is the HTILE stencil bit, and not the stencil address, those two 1920x1080 targets are likely this case rather than a third target. Printing `target.stencilAddress`, `htileStencil` and `htileDepthOnly` from `prepareDepthSampling` would confirm it. Without HTILE stencil metadata the stencil plane stays uncompressed, so it could probably be imported straight from its plane. I have not written that yet. It would be a follow-up to this PR and is not part of it. On Windows, once these targets are accepted, the next stop may be `metadata fill over unwatched memory` or `unproven fast-clear transition`, if the HTILE or depth lands on host imports that write watching does not cover. I hit that on Dave the Diver (PPSA19115). Further Dave fixes are on my local branch and will come as separate PRs that depend on this one: - releasing a native depth owner when another depth plane is placed over its memory; - releasing it when the CPU rewrites its memory before a guarded read; - page-precise CPU write checks next to the HTILE inside the same 64 KiB block. The queued fill that changed between your two runs is already handled in `c11074be8`. Run-to-run timing likely decides which surface is refused first. AI-assisted: yes
billythemenace2 commented 2026-10-16 12:09:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by billythemenace2 on 2026-10-16T12:09:10Z.


@Gashrod1 thanks, your reading was right. On main aff725bf6 plus #6297 (c63485076), #6300 (c11074be8) and #6423 (cbf964ed7), SONIC SUPERSTARS (PPSA06888) now reports the creation refusal straight away, in the first run:

AGC graphics: native multisample stencil import requires HTILE stencil metadata

#6423 conflicted with #6300 in NoteHtileDepthClear and NoteDepthMetadataFill. I kept #6300's branches and changed their refusal = assignments to Refuse(...).

The print you suggested, at the top of that check in prepareDepthSampling, shows eight depth targets before the stop. All of them are 1920x1080, 2 samples, D32_SFLOAT_S8_UINT, with a stencil plane and HTILE without stencil metadata:

depth 0x228450000 stencilAddress=0x229550000 htile=0x225188000 htileStencil=0 htileDepthOnly=1
depth 0x22b410000 stencilAddress=0x22c510000 htile=0x2251c0000 htileStencil=0 htileDepthOnly=1
depth 0x22f6d0000 stencilAddress=0x2307d0000 htile=0x22ca28000 htileStencil=0 htileDepthOnly=1
depth 0x232690000 stencilAddress=0x233790000 htile=0x22ca60000 htileStencil=0 htileDepthOnly=1
depth 0x249fd0000 stencilAddress=0x24b0d0000 htile=0x245c20000 htileStencil=0 htileDepthOnly=1
depth 0x249fd0000 stencilAddress=0x22ce90000 htile=0x245c78000 htileStencil=0 htileDepthOnly=1
depth 0x24cf90000 stencilAddress=0x231f90000 htile=0x22e408000 htileStencil=0 htileDepthOnly=1
depth 0x24f190000 stencilAddress=0x2336d0000 htile=0x22e440000 htileStencil=0 htileDepthOnly=1

The first two are the targets from my earlier fill print (HTILE 0x225188000 and 0x2251c0000), so they are not a third target. The stencil=0 in that print was the HTILE stencil bit.

So for this title, importing the stencil plane directly when HTILE carries no stencil metadata looks like the next step. I can run it on PPSA06888 when you have it.

Windows 11, MinGW-w64 GCC 15, Release, AMD Radeon RX 5700 XT.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6215188434 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6300#issuecomment-6215188434). Originally posted by [billythemenace2](https://github.com/billythemenace2) on 2026-10-16T12:09:10Z. --- @Gashrod1 thanks, your reading was right. On `main` `aff725bf6` plus #6297 (`c63485076`), #6300 (`c11074be8`) and #6423 (`cbf964ed7`), SONIC SUPERSTARS (PPSA06888) now reports the creation refusal straight away, in the first run: ``` AGC graphics: native multisample stencil import requires HTILE stencil metadata ``` #6423 conflicted with #6300 in `NoteHtileDepthClear` and `NoteDepthMetadataFill`. I kept #6300's branches and changed their `refusal =` assignments to `Refuse(...)`. The print you suggested, at the top of that check in `prepareDepthSampling`, shows eight depth targets before the stop. All of them are 1920x1080, 2 samples, `D32_SFLOAT_S8_UINT`, with a stencil plane and HTILE without stencil metadata: ``` depth 0x228450000 stencilAddress=0x229550000 htile=0x225188000 htileStencil=0 htileDepthOnly=1 depth 0x22b410000 stencilAddress=0x22c510000 htile=0x2251c0000 htileStencil=0 htileDepthOnly=1 depth 0x22f6d0000 stencilAddress=0x2307d0000 htile=0x22ca28000 htileStencil=0 htileDepthOnly=1 depth 0x232690000 stencilAddress=0x233790000 htile=0x22ca60000 htileStencil=0 htileDepthOnly=1 depth 0x249fd0000 stencilAddress=0x24b0d0000 htile=0x245c20000 htileStencil=0 htileDepthOnly=1 depth 0x249fd0000 stencilAddress=0x22ce90000 htile=0x245c78000 htileStencil=0 htileDepthOnly=1 depth 0x24cf90000 stencilAddress=0x231f90000 htile=0x22e408000 htileStencil=0 htileDepthOnly=1 depth 0x24f190000 stencilAddress=0x2336d0000 htile=0x22e440000 htileStencil=0 htileDepthOnly=1 ``` The first two are the targets from my earlier fill print (HTILE `0x225188000` and `0x2251c0000`), so they are not a third target. The `stencil=0` in that print was the HTILE stencil bit. So for this title, importing the stencil plane directly when HTILE carries no stencil metadata looks like the next step. I can run it on PPSA06888 when you have it. Windows 11, MinGW-w64 GCC 15, Release, AMD Radeon RX 5700 XT. AI-assisted (Claude Code).
MarcZX10 commented 2026-10-17 20:45:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-17T20:45:07Z.


Coordination note from the #7233 completion fix: the recognized HTILE mask-kernel path now marks its exact metadata range complete only after that dispatch’s completion checks succeed, while CheckCurrent keeps requiring StoredAllSince. #6300’s separate queued whole-HTILE fill proof remains necessary. The overlap audit flags the shared CheckCurrent hunk; when combining, preserve the queued-fill allowance alongside the complete-store check (gpuFill || StoredAllSince). There is no dependency between the two changes.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6240743496 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6300#issuecomment-6240743496). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-17T20:45:07Z. --- Coordination note from the #7233 completion fix: the recognized HTILE mask-kernel path now marks its exact metadata range complete only after that dispatch’s completion checks succeed, while `CheckCurrent` keeps requiring `StoredAllSince`. #6300’s separate queued whole-HTILE fill proof remains necessary. The overlap audit flags the shared `CheckCurrent` hunk; when combining, preserve the queued-fill allowance alongside the complete-store check (`gpuFill || StoredAllSince`). There is no dependency between the two changes.
adriadam10 commented 2026-10-18 19:52:21 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-18T19:52:21Z.

Review: CHANGES_REQUESTED


Thanks for the work. The diff matches the description and the tests pin per-sample depth values and stencil outcomes. One blocker:

  • This PR now conflicts with main in NoteDepthMetadataFill (core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp). main replaced the pendingClear assignment with surface->ForgetClear(written) / surface->NoteHtileClear(...) and added the single-sample plane-fill branch (PlaneFillCovers, NotePlaneFill). Please rebase and merge both: keep the native-MSAA whole-HTILE fill branch (samplingActive && HtileFillCovers) ahead of the generic branch, and keep ForgetClear/NoteHtileClear for the non-sampling path.
  • When combining with #7233, keep the queued-fill allowance next to the complete-store check (gpuFill || StoredAllSince), as noted by @MarcZX10.
  • After the rebase, rerun agc_driver_native_depth_stencil, agc_driver_native_depth_clears and agc_driver_native_depth_clear_refusals.

Once it is rebased and the full Build is green, it can go to the merge queue.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5564677664 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6300#pullrequestreview-5564677664). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-18T19:52:21Z. **Review:** CHANGES_REQUESTED --- Thanks for the work. The diff matches the description and the tests pin per-sample depth values and stencil outcomes. One blocker: - This PR now conflicts with `main` in `NoteDepthMetadataFill` (`core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp`). `main` replaced the `pendingClear` assignment with `surface->ForgetClear(written)` / `surface->NoteHtileClear(...)` and added the single-sample plane-fill branch (`PlaneFillCovers`, `NotePlaneFill`). Please rebase and merge both: keep the native-MSAA whole-HTILE fill branch (`samplingActive && HtileFillCovers`) ahead of the generic branch, and keep `ForgetClear`/`NoteHtileClear` for the non-sampling path. - When combining with #7233, keep the queued-fill allowance next to the complete-store check (`gpuFill || StoredAllSince`), as noted by @MarcZX10. - After the rebase, rerun `agc_driver_native_depth_stencil`, `agc_driver_native_depth_clears` and `agc_driver_native_depth_clear_refusals`. Once it is rebased and the full Build is green, it can go to the merge queue.
milescoviello commented 2026-10-19 11:47:30 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-19T11:47:30Z.


@Gashrod1 a rebase handoff, in case it saves you time, since adriadam10's review asks for a rebase. rebase/6300 (b74b5d42e8) is both your commits on main 62e946f114, with authorship unchanged. The conflicts were in DepthSurface.cpp, resolved as the review asks:

  • NoteHtileDepthClear: your stencil-surface refusal and clearAspects, written with main's sampling.Refuse(...) in place of assigning refusal.
  • NoteDepthMetadataFill: your native-MSAA whole-HTILE fill branch (samplingActive && HtileFillCovers) comes first. After it come main's generic branch (ForgetClear / NoteHtileClear) and its single-sample plane fills (PlaneFillCovers, NotePlaneFill), unchanged. The second commit's clearPattern and clearFillNote applied cleanly on top.

Tests (RTX 4070 Ti, Linux, Release):

  • agc_driver_native_multisample_depth passes 3 of 3.
  • The 30 tests matching native_multisample_depth|native_depth|depth_clear|htile|multisample|msaa|^agc_driver_graphics$|write_tracking pass, against 29 of 29 on main.
  • Khronos validation (1.3.275, native_multisample_depth|native_depth): nothing new against main, only the layer's known pNext-pNext and pLibraries-06681.
  • Conventions: one warning, the new debt-length check, on the entry this PR edits (1552 characters).

To take it, run git fetch https://github.com/milescoviello/AnyPS5 rebase/6300 && git reset --hard FETCH_HEAD on your branch, then force-push.

A data point for what comes after this PR. Ghost of Tsushima (PPSA02225) samples a 2x D32S8 1920x2160 target that #6300 still refuses. Its stencil is a separate plane, and its HTILE is depth-only (no stencil state in HTILE), not ITERATE_256 and not pipe-aligned. A logging build shows two whole-range fills before the sample, both with pattern 0:

  • the HTILE, 0x50000 bytes, exactly HtileMetadataBytes for that extent, so the footprint formula holds for this non-pipe-aligned HTILE;
  • the stencil plane, 0x870000 bytes, exactly the 2-sample stencil footprint.

With the format, stencil and HTILE refusals relaxed locally, the title stops at the next step, native multisample depth metadata fill transition is not implemented. Would you be OK with me doing this as a follow-up on top of #6300 (Depends on: #6300, #6557)? It would cover:

  • a D32S8 target with a depth-only HTILE and a separate stencil plane, whose initial stencil is proven from the plane's bytes, since HTILE says nothing about it;
  • a whole-plane stencil fill taken as a stencil clear;
  • non-pipe-aligned HTILE accepted where every word must prove the same clear, since the order of identical words doesn't matter.

I'd rather build on your PR than overlap it.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6266476777 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6300#issuecomment-6266476777). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-19T11:47:30Z. --- @Gashrod1 a **rebase handoff**, in case it saves you time, since adriadam10's review asks for a rebase. [`rebase/6300`](https://github.com/milescoviello/AnyPS5/tree/rebase/6300) (b74b5d42e8) is both your commits on `main` 62e946f114, with authorship unchanged. The conflicts were in `DepthSurface.cpp`, resolved as the review asks: - **`NoteHtileDepthClear`**: your stencil-surface refusal and `clearAspects`, written with `main`'s `sampling.Refuse(...)` in place of assigning `refusal`. - **`NoteDepthMetadataFill`**: your native-MSAA whole-HTILE fill branch (`samplingActive && HtileFillCovers`) comes first. After it come `main`'s generic branch (`ForgetClear` / `NoteHtileClear`) and its single-sample plane fills (`PlaneFillCovers`, `NotePlaneFill`), unchanged. The second commit's `clearPattern` and `clearFillNote` applied cleanly on top. Tests (RTX 4070 Ti, Linux, Release): - `agc_driver_native_multisample_depth` passes 3 of 3. - The 30 tests matching `native_multisample_depth|native_depth|depth_clear|htile|multisample|msaa|^agc_driver_graphics$|write_tracking` pass, against 29 of 29 on `main`. - Khronos validation (1.3.275, `native_multisample_depth|native_depth`): nothing new against `main`, only the layer's known `pNext-pNext` and `pLibraries-06681`. - Conventions: one warning, the new `debt-length` check, on the entry this PR edits (1552 characters). To take it, run `git fetch https://github.com/milescoviello/AnyPS5 rebase/6300 && git reset --hard FETCH_HEAD` on your branch, then force-push. **A data point for what comes after this PR.** Ghost of Tsushima (PPSA02225) samples a 2x D32S8 1920x2160 target that #6300 still refuses. Its stencil is a separate plane, and its HTILE is depth-only (no stencil state in HTILE), not ITERATE_256 and not pipe-aligned. A logging build shows two whole-range fills before the sample, both with pattern 0: - the HTILE, 0x50000 bytes, exactly `HtileMetadataBytes` for that extent, so the footprint formula holds for this non-pipe-aligned HTILE; - the stencil plane, 0x870000 bytes, exactly the 2-sample stencil footprint. With the format, stencil and HTILE refusals relaxed locally, the title stops at the next step, `native multisample depth metadata fill transition is not implemented`. Would you be OK with me doing this as a follow-up on top of #6300 (`Depends on: #6300, #6557`)? It would cover: - a D32S8 target with a depth-only HTILE and a separate stencil plane, whose initial stencil is proven from the plane's bytes, since HTILE says nothing about it; - a whole-plane stencil fill taken as a stencil clear; - non-pipe-aligned HTILE accepted where every word must prove the same clear, since the order of identical words doesn't matter. I'd rather build on your PR than overlap it. AI-assisted: yes (Claude Code)
BunnyFl commented 2026-10-20 18:12:33 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by BunnyFl on 2026-10-20T18:12:33Z.


For information, not a request to widen this PR: The Grinch: Christmas Adventures (PPSA07656) stops on the D32S8 refusal on main 892a4f132 (Windows, RX 9070 XT), with the depth-only HTILE case this PR refuses: a 2-sample 2560x1440 D32_SFLOAT_S8_UINT target with a separate stencil plane, htileStencil 0, its stencil plane all at the clear stencil (0), and all three ranges Watched on Windows. After that it samples the depth through a descriptor without HTILE (native multisample depth sampled metadata or XOR mismatch). Details: https://github.com/boykopovar/AnyPS5/discussions/8606

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6297848833 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6300#issuecomment-6297848833). Originally posted by [BunnyFl](https://github.com/BunnyFl) on 2026-10-20T18:12:33Z. --- For information, not a request to widen this PR: The Grinch: Christmas Adventures (PPSA07656) stops on the D32S8 refusal on `main` 892a4f132 (Windows, RX 9070 XT), with the depth-only HTILE case this PR refuses: a 2-sample 2560x1440 `D32_SFLOAT_S8_UINT` target with a separate stencil plane, `htileStencil` 0, its stencil plane all at the clear stencil (0), and all three ranges `Watched` on Windows. After that it samples the depth through a descriptor without HTILE (`native multisample depth sampled metadata or XOR mismatch`). Details: https://github.com/boykopovar/AnyPS5/discussions/8606
oneandonlydean commented 2026-10-20 18:50:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-20T18:50:00Z.


Picking this up for our testing: it addresses the stop we see in PPSA03208 on current main, one of the titles we're bringing up, and we'd like to move it into main. We'll review, test and merge it under the normal process. Your comments and review are still very welcome, @adriadam10.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6298606144 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6300#issuecomment-6298606144). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-20T18:50:00Z. --- Picking this up for our testing: it addresses the stop we see in PPSA03208 on current main, one of the titles we're bringing up, and we'd like to move it into main. We'll review, test and merge it under the normal process. Your comments and review are still very welcome, @adriadam10.
oneandonlydean commented 2026-10-20 19:25:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-20T19:25:18Z.


@Gashrod1 thanks for this. It now conflicts with main in a way we can't resolve mechanically: NoteDepthMetadataFill in core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp changed on main, along with the native multisample depth test and the debt note. That's also the blocker in the open review. Could you rebase it onto current main? @milescoviello offered a rebase branch earlier, which may be a useful starting point. Once it's rebased we'll run CI and test it.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6299387602 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6300#issuecomment-6299387602). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-20T19:25:18Z. --- @Gashrod1 thanks for this. It now conflicts with `main` in a way we can't resolve mechanically: `NoteDepthMetadataFill` in `core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cpp` changed on `main`, along with the native multisample depth test and the debt note. That's also the blocker in the open review. Could you rebase it onto current `main`? @milescoviello offered a rebase branch earlier, which may be a useful starting point. Once it's rebased we'll run CI and test it.
JJenkx commented 2026-10-20 20:13:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-10-20T20:13:50Z.


I prepared a refreshed branch for the author/maintainers to use: fix/native-depth-whole-htile-refresh, tip b0d031a94f71.

It is two commits on main 29e4c46b4d74, without merge commits or the descriptor integration stack:

  • 33c9c5ae87: refreshes the implementation from this PR's 4cbd7a4701 and c11074be82, preserving m.peau's authorship. The conflict resolution retains main's single-sample plane-fill handling, first-refusal reporting and ITERATE_256-off eligibility.
  • b0d031a94f: test-only correction. On RADV, the stencil fixture's direct raster writes were followed by a fetch from a stale sampled shadow (expected 0.3125, observed 0). Submit the raster batch, refresh through CachedSampledTexture, and synchronize before fetching. A failure-only diagnostic records the affected case.

Same-machine focused checks: main 4/4, refreshed branch 5/5, including stencil. Both used ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation and ctest --test-dir build-full -R '^agc_driver_native_(multisample_depth|depth_retirement|depth_clears|depth_clear_refusals|depth_stencil)$' -V. No skips, missing-layer warnings or VUID- messages in either log. GPU: AMD Radeon RX 6650 XT, RADV/Mesa 26.2.4, Arch Linux. Full runtime libraries build passes. Conventions: zero errors, one existing-length warning for the refreshed 1810-character debt entry.

Hades II (PPSA36082, bring-up #1965) reaches a rendered gameplay scene on this reduced stack, past the previous metadata-fill stop; scripted startup was observed through 190 seconds, then ordinary close returned native exit 0 with the PID gone and configuration restored. This is a bring-up result, not a performance comparison or verification of combat.

Matched test logs and compact native evidence. A local merge-tree check against newer main 9a97ac784da5 is clean; that newer revision was not rebuilt for these results. This does not update your PR branch; it is an offered rebase handoff. AI-assisted.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6300485999 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6300#issuecomment-6300485999). Originally posted by [JJenkx](https://github.com/JJenkx) on 2026-10-20T20:13:50Z. --- I prepared a refreshed branch for the author/maintainers to use: [fix/native-depth-whole-htile-refresh](https://github.com/JJenkx/AnyPS5/tree/fix/native-depth-whole-htile-refresh), tip `b0d031a94f71`. It is two commits on main `29e4c46b4d74`, without merge commits or the descriptor integration stack: - `33c9c5ae87`: refreshes the implementation from this PR's `4cbd7a4701` and `c11074be82`, preserving m.peau's authorship. The conflict resolution retains main's single-sample plane-fill handling, first-refusal reporting and ITERATE_256-off eligibility. - `b0d031a94f`: test-only correction. On RADV, the stencil fixture's direct raster writes were followed by a fetch from a stale sampled shadow (expected 0.3125, observed 0). Submit the raster batch, refresh through `CachedSampledTexture`, and synchronize before fetching. A failure-only diagnostic records the affected case. Same-machine focused checks: main **4/4**, refreshed branch **5/5**, including stencil. Both used `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation` and `ctest --test-dir build-full -R '^agc_driver_native_(multisample_depth|depth_retirement|depth_clears|depth_clear_refusals|depth_stencil)$' -V`. No skips, missing-layer warnings or `VUID-` messages in either log. GPU: AMD Radeon RX 6650 XT, RADV/Mesa 26.2.4, Arch Linux. Full runtime libraries build passes. Conventions: zero errors, one existing-length warning for the refreshed 1810-character debt entry. Hades II (PPSA36082, [bring-up #1965](https://github.com/boykopovar/AnyPS5/discussions/1965)) reaches a rendered gameplay scene on this reduced stack, past the previous metadata-fill stop; scripted startup was observed through 190 seconds, then ordinary close returned native exit 0 with the PID gone and configuration restored. This is a bring-up result, not a performance comparison or verification of combat. [Matched test logs and compact native evidence](https://gist.github.com/JJenkx/92230908979fbe9ef0ed1fbb8eb5bc8c). A local merge-tree check against newer main `9a97ac784da5` is clean; that newer revision was not rebuilt for these results. This does not update your PR branch; it is an offered rebase handoff. AI-assisted.
DavidSamir commented 2026-10-21 06:25:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by DavidSamir on 2026-10-21T06:25:02Z.


@Gashrod1, a question about scope. The Grinch: Christmas Adventures (PPSA07656, discussion #8606) stops in prepareDepthSampling with native multisample stencil or depth format import is not implemented, on a target this PR doesn't import yet:

  • D32_SFLOAT_S8_UINT, 2 samples, 2560x1440, one slice, Z_X, pipe-aligned, pipeBankXor 0, clear depth 0;
  • a separate stencil plane whose bytes all equal the clear stencil (0), and an HTILE that is depth-only (htileStencil 0, htileDepthOnly 1);
  • the title then samples that depth through a descriptor with no metadata (dccAddress 0, not pipe-aligned). With only the import let through, it next stops at native multisample depth sampled metadata or XOR mismatch.

The reporter's details are on #8606. Is a depth-only HTILE with an uncompressed stencil plane something you plan to cover in this PR, or should it be a separate one on top of it?

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6309564736 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6300#issuecomment-6309564736). Originally posted by [DavidSamir](https://github.com/DavidSamir) on 2026-10-21T06:25:02Z. --- @Gashrod1, a question about scope. The Grinch: Christmas Adventures (PPSA07656, discussion #8606) stops in `prepareDepthSampling` with `native multisample stencil or depth format import is not implemented`, on a target this PR doesn't import yet: - `D32_SFLOAT_S8_UINT`, 2 samples, 2560x1440, one slice, `Z_X`, pipe-aligned, `pipeBankXor` 0, clear depth 0; - a separate stencil plane whose bytes all equal the clear stencil (0), and an HTILE that is depth-only (`htileStencil` 0, `htileDepthOnly` 1); - the title then samples that depth through a descriptor with no metadata (`dccAddress` 0, not pipe-aligned). With only the import let through, it next stops at `native multisample depth sampled metadata or XOR mismatch`. The reporter's details are on #8606. Is a depth-only HTILE with an uncompressed stencil plane something you plan to cover in this PR, or should it be a separate one on top of it? AI-assisted: yes
oneandonlydean commented 2026-10-21 06:32:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-21T06:32:58Z.


@Gashrod1 your call on the scope @DavidSamir asks about. From our side, a depth-only HTILE with an uncompressed stencil plane is fine as a separate PR on top of this one, which keeps this one reviewable. Thanks @DavidSamir for the detailed target description.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6309680373 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6300#issuecomment-6309680373). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-21T06:32:58Z. --- @Gashrod1 your call on the scope @DavidSamir asks about. From our side, a depth-only HTILE with an uncompressed stencil plane is fine as a separate PR on top of this one, which keeps this one reviewable. Thanks @DavidSamir for the detailed target description.
JJenkx commented 2026-10-21 12:17:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-10-21T12:17:00Z.


Refreshed the offered author handoff branch to 3f43eff06c06affa1ef573a0642283adf00e8d89, four linear commits on main 1381826358ef3d20644608bfc1c54c9232bba81b. This is a handoff for this PR; your branch is unchanged.

  • c2a622691e refreshes your c11074be82 implementation with m.peau authorship preserved.
  • 174b12d5ae retains the stencil fixture shadow-refresh correction from the earlier handoff.
  • 5a9ab8e2c4 fixes the initial layout barrier for a sampled shadow with a combined depth/stencil format: transition both aspects. The earlier candidate produced VUID-VkImageMemoryBarrier-image-03320; the corrected candidate produces none. The depth-only copy remains depth-only.
  • 3f43eff06c initializes host HTILE to the opposite value before a successful queued fill, so stale host bytes cannot satisfy the regression.

Same-machine focused GPU checks: main 4/4, candidate 5/5, zero VUIDs, zero unavailable cases and no skips. Loader diagnostics confirm Khronos validation loading separately for every test. Completed-clear coverage is 24 cases on main and 72 on the candidate (HTILE dispatch, completed fill and queued fill); candidate stencil coverage is 12 cases plus 15 refusal cases. Seven common clear refusals pass on both, and the candidate additionally passes four queued-fill refusals. Full runtime libraries build on both; the candidate was restored and rebuilt afterward. Conventions: zero errors, one existing debt-entry-length warning.

Commands and pinned scripts are in the full paired evidence archive, including ctest --test-dir build-full -R '^agc_driver_native_(multisample_depth|depth_retirement|depth_clears|depth_clear_refusals|depth_stencil)$' -V with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, explicit VK_ADD_LAYER_PATH, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation and loader diagnostics. Archive SHA-256: 8e258cdb81b02a9ce8bfa2d2054b92e76fc8875fb51363ad623e38a77ef792a2. GPU: AMD Radeon RX 6650 XT, RADV/Mesa 26.2.4, Arch Linux.

Hades II (PPSA36082) native follow-up is now complete on this exact 3f43eff06c06 head: 192 seconds, ordinary close with launcher exit 0, and configuration restored. The three candidate-only single-sample depth regressions also pass with loader-confirmed Khronos validation per test and zero VUIDs. The 175-second screenshot shows the character in the rendered outdoor starting scene; inspection found no obvious full-screen corruption in that frame. This is startup/scene regression evidence only, with no main-versus-candidate performance comparison, combat coverage or full visual-correctness claim. Native follow-up archive includes the screenshot, native report/log, exact harness and regression logs. SHA-256: 86141c6645fd20950af2e9c171828589b8ad2d12a65440f876c1f7ec04b06363 (download verified). The Grinch depth-only-HTILE/uncompressed-stencil extension is outside this refresh, as discussed above. AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6315687237 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6300#issuecomment-6315687237). Originally posted by [JJenkx](https://github.com/JJenkx) on 2026-10-21T12:17:00Z. --- Refreshed the offered [author handoff branch](https://github.com/JJenkx/AnyPS5/tree/fix/native-depth-whole-htile-refresh) to `3f43eff06c06affa1ef573a0642283adf00e8d89`, four linear commits on main `1381826358ef3d20644608bfc1c54c9232bba81b`. This is a handoff for this PR; your branch is unchanged. - `c2a622691e` refreshes your `c11074be82` implementation with m.peau authorship preserved. - `174b12d5ae` retains the stencil fixture shadow-refresh correction from the earlier handoff. - `5a9ab8e2c4` fixes the initial layout barrier for a sampled shadow with a combined depth/stencil format: transition both aspects. The earlier candidate produced `VUID-VkImageMemoryBarrier-image-03320`; the corrected candidate produces none. The depth-only copy remains depth-only. - `3f43eff06c` initializes host HTILE to the opposite value before a successful queued fill, so stale host bytes cannot satisfy the regression. Same-machine focused GPU checks: main **4/4**, candidate **5/5**, zero VUIDs, zero unavailable cases and no skips. Loader diagnostics confirm Khronos validation loading separately for every test. Completed-clear coverage is 24 cases on main and 72 on the candidate (HTILE dispatch, completed fill and queued fill); candidate stencil coverage is 12 cases plus 15 refusal cases. Seven common clear refusals pass on both, and the candidate additionally passes four queued-fill refusals. Full runtime libraries build on both; the candidate was restored and rebuilt afterward. Conventions: zero errors, one existing debt-entry-length warning. Commands and pinned scripts are in the [full paired evidence archive](https://github.com/JJenkx/AnyPS5/releases/download/game-library-checks-20261016/20261021-pr6300-main138182-aspect-validation.tar.gz), including `ctest --test-dir build-full -R '^agc_driver_native_(multisample_depth|depth_retirement|depth_clears|depth_clear_refusals|depth_stencil)$' -V` with `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1`, explicit `VK_ADD_LAYER_PATH`, `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation` and loader diagnostics. Archive SHA-256: `8e258cdb81b02a9ce8bfa2d2054b92e76fc8875fb51363ad623e38a77ef792a2`. GPU: AMD Radeon RX 6650 XT, RADV/Mesa 26.2.4, Arch Linux. Hades II (PPSA36082) native follow-up is now complete on this exact `3f43eff06c06` head: 192 seconds, ordinary close with launcher exit 0, and configuration restored. The three candidate-only single-sample depth regressions also pass with loader-confirmed Khronos validation per test and zero VUIDs. The 175-second screenshot shows the character in the rendered outdoor starting scene; inspection found no obvious full-screen corruption in that frame. This is startup/scene regression evidence only, with no main-versus-candidate performance comparison, combat coverage or full visual-correctness claim. [Native follow-up archive](https://github.com/JJenkx/AnyPS5/releases/download/game-library-checks-20261016/20261021-pr6300-hades2-native-followup.tar.gz) includes the screenshot, native report/log, exact harness and regression logs. SHA-256: `86141c6645fd20950af2e9c171828589b8ad2d12a65440f876c1f7ec04b06363` (download verified). The Grinch depth-only-HTILE/uncompressed-stencil extension is outside this refresh, as discussed above. AI-assisted: yes.
JJenkx commented 2026-10-21 12:44:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-10-21T12:44:11Z.


@milescoviello @Gashrod1 I have a private follow-up prototype for the depth-only HTILE / separate uncompressed stencil case discussed here. Before opening another PR, I wanted to check whether this overlaps work you have already started.

It proves the complete initial stencil plane equals DB_STENCIL_CLEAR, retains the existing watched-range and generation checks, and makes later depth-only HTILE fills preserve raster-written stencil. The first focused GPU run passes 5/5 with validation loaded per test and no VUIDs; an expanded zero/nonzero stencil run is queued. This is fixture evidence only, on RX 6650 XT / RADV. I do not have Grinch or Ghost of Tsushima locally and am not claiming either title is unblocked.

The prototype keeps pipe-aligned HTILE and matching sampled metadata requirements. It does not cover Ghost's non-pipe-aligned HTILE, separate stencil-fill transitions, or Grinch's metadata-less descriptor. If you already have the overlapping initial import or refill preservation implemented, I can hand over the regression coverage instead of duplicating that work. Otherwise I will prepare this as a separate follow-up depending on #6300.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6316224509 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6300#issuecomment-6316224509). Originally posted by [JJenkx](https://github.com/JJenkx) on 2026-10-21T12:44:11Z. --- @milescoviello @Gashrod1 I have a private follow-up prototype for the depth-only HTILE / separate uncompressed stencil case discussed here. Before opening another PR, I wanted to check whether this overlaps work you have already started. It proves the complete initial stencil plane equals `DB_STENCIL_CLEAR`, retains the existing watched-range and generation checks, and makes later depth-only HTILE fills preserve raster-written stencil. The first focused GPU run passes 5/5 with validation loaded per test and no VUIDs; an expanded zero/nonzero stencil run is queued. This is fixture evidence only, on RX 6650 XT / RADV. I do not have Grinch or Ghost of Tsushima locally and am not claiming either title is unblocked. The prototype keeps pipe-aligned HTILE and matching sampled metadata requirements. It does not cover Ghost's non-pipe-aligned HTILE, separate stencil-fill transitions, or Grinch's metadata-less descriptor. If you already have the overlapping initial import or refill preservation implemented, I can hand over the regression coverage instead of duplicating that work. Otherwise I will prepare this as a separate follow-up depending on #6300. AI-assisted: yes.
milescoviello commented 2026-10-21 12:56:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-21T12:56:03Z.


@JJenkx no overlap from me. I haven't started anything on the initial stencil import or on depth-only HTILE fills preserving stencil, so please go ahead with your follow-up. My only part in #6300 was the rebase handoff for @Gashrod1.

Ghost of Tsushima needs more memory than the 16 GB cap I can give titles here, so I can't check the title side for you either.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6316567312 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6300#issuecomment-6316567312). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-21T12:56:03Z. --- @JJenkx no overlap from me. I haven't started anything on the initial stencil import or on depth-only HTILE fills preserving stencil, so please go ahead with your follow-up. My only part in #6300 was the rebase handoff for @Gashrod1. Ghost of Tsushima needs more memory than the 16 GB cap I can give titles here, so I can't check the title side for you either. AI-assisted: yes (Claude Code)
milescoviello commented 2026-10-21 21:45:46 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-21T21:45:46Z.


@Gashrod1 @JJenkx a correction to my last comment: Ghost of Tsushima (PPSA02225) reaches this code early, so I could test it after all. Ubuntu 26.04.1, RTX 4070 Ti, NVIDIA 615.71.09, release libraries, 20 GB cap, pad input.

  • main a6dcea9279 stops at 15 s with a warm shader cache (54 s cold) on compute shader 0x20001ef700: AGC graphics: native multisample stencil or depth format import is not implemented (DepthSurface.cpp:102).
  • main with the handoff branch 3f43eff06c merged in (clean merge) gets past the format check. It stops at 14 s on the next refusal in prepareDepthSampling: native multisample stencil import requires HTILE stencil metadata, from stencil && (!target.htileStencil || target.htileDepthOnly).

So this PR moves Ghost forward, and its D32S8 surface is the case without stencil metadata in HTILE: either the depth-only HTILE with a separate stencil plane that @JJenkx described, or no HTILE stencil at all. I haven't told those two apart yet. When the follow-up is up, I can run Ghost on it.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6327252710 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6300#issuecomment-6327252710). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-21T21:45:46Z. --- @Gashrod1 @JJenkx a correction to my last comment: Ghost of Tsushima (PPSA02225) reaches this code early, so I could test it after all. Ubuntu 26.04.1, RTX 4070 Ti, NVIDIA 615.71.09, release libraries, 20 GB cap, pad input. - `main` a6dcea9279 stops at 15 s with a warm shader cache (54 s cold) on `compute shader 0x20001ef700: AGC graphics: native multisample stencil or depth format import is not implemented` (`DepthSurface.cpp:102`). - `main` with the handoff branch 3f43eff06c merged in (clean merge) gets past the format check. It stops at 14 s on the next refusal in `prepareDepthSampling`: `native multisample stencil import requires HTILE stencil metadata`, from `stencil && (!target.htileStencil || target.htileDepthOnly)`. So this PR moves Ghost forward, and its D32S8 surface is the case without stencil metadata in HTILE: either the depth-only HTILE with a separate stencil plane that @JJenkx described, or no HTILE stencil at all. I haven't told those two apart yet. When the follow-up is up, I can run Ghost on it. AI-assisted: yes (Claude Code)
EagleBearerYS commented 2026-10-21 22:09:05 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-21T22:09:05Z.


@Gashrod1, another title stops on a native multisample depth target with a stencil plane, but in a shape this PR doesn't cover. We'll prepare it as a PR stacked on this one.

The Grinch: Christmas Adventures (PPSA07656, 01.000.003) aborts about 2 s in, before its first present, on plain main 892a4f132 (BunnyFl's report):

[gpu] driver failure: AGC graphics: native multisample stencil or depth format import is not implemented

BunnyFl's print of the DepthTarget in prepareDepthSampling gives:

  • VK_FORMAT_D32_SFLOAT_S8_UINT, 2 samples, 2560x1440, one slice, Z_X, pipeBankXor 0, clear depth 0;
  • a separate stencil plane (stencilAddress set) and a depth-only HTILE (htileStencil 0, htileDepthOnly 1), pipe-aligned;
  • the depth plane (0x1e00000 bytes), the stencil plane (0x780000) and the HTILE (0x48000), which don't overlap and are all accessible and watched;
  • every byte of the stencil plane equal to the clear stencil (0) at that point.

This PR imports D32S8 only with the stencil in HTILE, and it refuses a depth-only HTILE, so this target falls outside it.

BunnyFl also tried letting only this case through, then discarded the experiment. The title then stops at the next check, when it samples the depth:

AGC graphics: native multisample depth sampled metadata or XOR mismatch

The sampled descriptor has no metadata (dccAddress 0, not pipe-aligned) while the target has its HTILE; pipeBankXor and iterate256 match. So the title needs both pieces: the import with a separate, uncompressed stencil plane, and a sample of that depth through a descriptor without HTILE.

Since it's the same import path, we'll build it on this PR's head. If you'd rather fold it into this PR, the commits will be on a fork branch for you to take as they are.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6327638251 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6300#issuecomment-6327638251). Originally posted by [EagleBearerYS](https://github.com/EagleBearerYS) on 2026-10-21T22:09:05Z. --- @Gashrod1, another title stops on a native multisample depth target with a stencil plane, but in a shape this PR doesn't cover. We'll prepare it as a PR stacked on this one. The Grinch: Christmas Adventures (PPSA07656, 01.000.003) aborts about 2 s in, before its first present, on plain `main` 892a4f132 ([BunnyFl's report](https://github.com/boykopovar/AnyPS5/discussions/8606)): ``` [gpu] driver failure: AGC graphics: native multisample stencil or depth format import is not implemented ``` BunnyFl's print of the `DepthTarget` in `prepareDepthSampling` gives: - `VK_FORMAT_D32_SFLOAT_S8_UINT`, 2 samples, 2560x1440, one slice, `Z_X`, `pipeBankXor` 0, clear depth 0; - a **separate stencil plane** (`stencilAddress` set) and a **depth-only HTILE** (`htileStencil` 0, `htileDepthOnly` 1), pipe-aligned; - the depth plane (0x1e00000 bytes), the stencil plane (0x780000) and the HTILE (0x48000), which don't overlap and are all accessible and watched; - every byte of the stencil plane equal to the clear stencil (0) at that point. This PR imports D32S8 only with the stencil in HTILE, and it refuses a depth-only HTILE, so this target falls outside it. BunnyFl also tried letting only this case through, then discarded the experiment. The title then stops at the next check, when it samples the depth: ``` AGC graphics: native multisample depth sampled metadata or XOR mismatch ``` The sampled descriptor has no metadata (`dccAddress` 0, not pipe-aligned) while the target has its HTILE; `pipeBankXor` and `iterate256` match. So the title needs both pieces: the import with a separate, uncompressed stencil plane, and a sample of that depth through a descriptor without HTILE. Since it's the same import path, we'll build it on this PR's head. If you'd rather fold it into this PR, the commits will be on a fork branch for you to take as they are.
milescoviello commented 2026-10-21 22:23:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-21T22:23:44Z.


@EagleBearerYS Ghost of Tsushima (PPSA02225) is probably the same shape: with this PR it stops on the same refusal 14 s in (my comment above), native multisample stencil import requires HTILE stencil metadata. When your stacked branch is up, I'll run Ghost on it at 20 GB, warm and cold, and post the next stop there.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6327871474 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6300#issuecomment-6327871474). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-21T22:23:44Z. --- @EagleBearerYS Ghost of Tsushima (PPSA02225) is probably the same shape: with this PR it stops on the same refusal 14 s in (my comment above), `native multisample stencil import requires HTILE stencil metadata`. When your stacked branch is up, I'll run Ghost on it at 20 GB, warm and cold, and post the next stop there. AI-assisted: yes (Claude Code)
Raghav314 commented 2026-10-21 23:49:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Raghav314 on 2026-10-21T23:49:52Z.


@Gashrod1 Hades II (PPSA36082) hits the same refusal on current main (a6dcea927): native multisample depth metadata fill transition is not implemented, thrown while the hub loads, reproduced twice. I merged this PR locally onto that main (with my draw pipeline and heap PRs) and the game loads into the hub and runs.

The merge with current main has conflicts in DepthSurface.cpp (main now records refusals through DepthSamplingState::Refuse and clears through ForgetClear/NoteHtileClear), NativeMultisampleDepth.cpp (CheckDepthTarget gained an iterate256 parameter in the same position as your source) and the debt file. With my resolution, agc_driver_native_depth_stencil fails with "Native depth feedback refused through the draw resource path", so that part probably needs your own rebase. The fill tests pass.

LLM assistance used.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6329147895 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6300#issuecomment-6329147895). Originally posted by [Raghav314](https://github.com/Raghav314) on 2026-10-21T23:49:52Z. --- @Gashrod1 Hades II (PPSA36082) hits the same refusal on current `main` (a6dcea927): `native multisample depth metadata fill transition is not implemented`, thrown while the hub loads, reproduced twice. I merged this PR locally onto that `main` (with my draw pipeline and heap PRs) and the game loads into the hub and runs. The merge with current `main` has conflicts in `DepthSurface.cpp` (`main` now records refusals through `DepthSamplingState::Refuse` and clears through `ForgetClear`/`NoteHtileClear`), `NativeMultisampleDepth.cpp` (`CheckDepthTarget` gained an `iterate256` parameter in the same position as your `source`) and the debt file. With my resolution, `agc_driver_native_depth_stencil` fails with "Native depth feedback refused through the draw resource path", so that part probably needs your own rebase. The fill tests pass. LLM assistance used.
JJenkx commented 2026-10-21 23:52:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-10-21T23:52:25Z.


@EagleBearerYS, another data point for the stacked stencil-plane shape. Spirit of the Island (PPSA13934, 01.000.000) aborts at its first gameplay frame on main, right after New Game, on native multisample stencil or depth format import is not implemented. It is the format check in prepareDepthSampling. These are the target's fields, printed by a local diagnostic at the refusal:

fmt=130 (VK_FORMAT_D32_SFLOAT_S8_UINT) samples=8 extent=512x512
addr=0x2c53d0000 stencil=0x2c5e10000 htile=0x2bf1e8000
htileStencil=0 pipeAligned=0 depthSwizzle=24 slices=0-0 clearDepth=0.0

So it has a separate stencil plane, no HTILE stencil and an HTILE that is not pipe-aligned. That is #8319's gap as well as the stencil plane. It is 8x, not 2x.

Setup: Windows 11, AMD Radeon RX 6700 XT, AMD driver 26.10.1, main a6dcea927 with #8361 (test-only). Reproduced once, with the names typed through the IME dialog by gdb. I can run your branch on this title when it is up.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6329181155 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6300#issuecomment-6329181155). Originally posted by [JJenkx](https://github.com/JJenkx) on 2026-10-21T23:52:25Z. --- @EagleBearerYS, another data point for the stacked stencil-plane shape. Spirit of the Island (PPSA13934, 01.000.000) aborts at its first gameplay frame on `main`, right after New Game, on `native multisample stencil or depth format import is not implemented`. It is the format check in `prepareDepthSampling`. These are the target's fields, printed by a local diagnostic at the refusal: ``` fmt=130 (VK_FORMAT_D32_SFLOAT_S8_UINT) samples=8 extent=512x512 addr=0x2c53d0000 stencil=0x2c5e10000 htile=0x2bf1e8000 htileStencil=0 pipeAligned=0 depthSwizzle=24 slices=0-0 clearDepth=0.0 ``` So it has a separate stencil plane, no HTILE stencil and an HTILE that is not pipe-aligned. That is #8319's gap as well as the stencil plane. It is 8x, not 2x. Setup: Windows 11, AMD Radeon RX 6700 XT, AMD driver 26.10.1, `main` a6dcea927 with #8361 (test-only). Reproduced once, with the names typed through the IME dialog by gdb. I can run your branch on this title when it is up.
EagleBearerYS commented 2026-10-22 00:35:05 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-22T00:35:05Z.


@Gashrod1, the stacked draft is up: #9533. It carries this PR's two commits unchanged, merges main into them, and adds six commits for D32S8 targets whose stencil is a separate plane and whose HTILE is depth-only. It also lets that depth be sampled through a descriptor with no metadata.

It covers the three titles with that shape, reported here and in discussion #8606:

  • @BunnyFl, The Grinch: Christmas Adventures (PPSA07656): the separate cleared stencil plane, and the sample through a descriptor without HTILE that came next in your experiment.
  • @milescoviello, Ghost of Tsushima (PPSA02225): the depth-only HTILE that isn't pipe-aligned, when all its words are one clear word, and the two whole fills of the HTILE and the stencil plane before the sample, in the orders the driver sees them.
  • @JJenkx, Spirit of the Island (PPSA13934): your 8x 512x512 target has the same shape: a separate plane and a depth-only HTILE that isn't pipe-aligned. Thanks for printing its fields. The draft also covers the case your prototype handled (comment).

It's tested only on lavapipe, which samples D32S8 at four samples, so two and eight samples haven't run on a GPU yet. If any of you can run the branch (fix/agc-msaa-d32s8-separate-stencil on EagleBearerYS/AnyPS5) on your title, the first line it stops on after the native depth import would tell us the most. If Ghost of Tsushima creates its target before the two fills, it would print a creation reason such as "native multisample stencil plane does not hold its clear value", and that's worth knowing too.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6329759613 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6300#issuecomment-6329759613). Originally posted by [EagleBearerYS](https://github.com/EagleBearerYS) on 2026-10-22T00:35:05Z. --- @Gashrod1, the stacked draft is up: #9533. It carries this PR's two commits unchanged, merges `main` into them, and adds six commits for D32S8 targets whose stencil is a separate plane and whose HTILE is depth-only. It also lets that depth be sampled through a descriptor with no metadata. It covers the three titles with that shape, reported here and in discussion #8606: - @BunnyFl, The Grinch: Christmas Adventures (PPSA07656): the separate cleared stencil plane, and the sample through a descriptor without HTILE that came next in your experiment. - @milescoviello, Ghost of Tsushima (PPSA02225): the depth-only HTILE that isn't pipe-aligned, when all its words are one clear word, and the two whole fills of the HTILE and the stencil plane before the sample, in the orders the driver sees them. - @JJenkx, Spirit of the Island (PPSA13934): your 8x 512x512 target has the same shape: a separate plane and a depth-only HTILE that isn't pipe-aligned. Thanks for printing its fields. The draft also covers the case your prototype handled ([comment](https://github.com/boykopovar/AnyPS5/pull/6300#issuecomment-6316224509)). It's tested only on lavapipe, which samples D32S8 at four samples, so two and eight samples haven't run on a GPU yet. If any of you can run the branch (`fix/agc-msaa-d32s8-separate-stencil` on EagleBearerYS/AnyPS5) on your title, the first line it stops on after the native depth import would tell us the most. If Ghost of Tsushima creates its target before the two fills, it would print a creation reason such as "native multisample stencil plane does not hold its clear value", and that's worth knowing too.
EagleBearerYS commented 2026-10-22 15:26:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-22T15:26:50Z.


@Gashrod1 (cc @oneandonlydean, @adriadam10) #9533 carries this PR's two commits unchanged, with your authorship. On top of them it has a merge of main (8eba29aeef) that resolves the conflict adriadam10's review describes: NoteDepthMetadataFill keeps this PR's samplingActive && HtileFillCovers branch ahead of main's ForgetClear/NoteHtileClear and plane-fill paths, written with main's DepthSamplingState::Refuse. #9533 is on main b7d1d47a5f, which includes #7233 and #7371, and its native multisample depth tests, including this PR's, pass 10 of 10 on GitHub's Linux runner (run). On Windows they build, and the Vulkan ones skip.

So #9533 can land this PR's part with your credit kept, if that suits you. If you'd rather update this PR yourself, either of the existing handoffs would do: milescoviello's rebase/6300 or JJenkx's refreshed branch. #9533 would then rebase onto it.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6344511957 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6300#issuecomment-6344511957). Originally posted by [EagleBearerYS](https://github.com/EagleBearerYS) on 2026-10-22T15:26:50Z. --- @Gashrod1 (cc @oneandonlydean, @adriadam10) #9533 carries this PR's two commits unchanged, with your authorship. On top of them it has a merge of `main` ([8eba29aeef](https://github.com/EagleBearerYS/AnyPS5/commit/8eba29aeef)) that resolves the conflict adriadam10's review describes: `NoteDepthMetadataFill` keeps this PR's `samplingActive && HtileFillCovers` branch ahead of `main`'s `ForgetClear`/`NoteHtileClear` and plane-fill paths, written with `main`'s `DepthSamplingState::Refuse`. #9533 is on `main` b7d1d47a5f, which includes #7233 and #7371, and its native multisample depth tests, including this PR's, pass 10 of 10 on GitHub's Linux runner ([run](https://github.com/EagleBearerYS/AnyPS5/actions/runs/39799208572)). On Windows they build, and the Vulkan ones skip. So #9533 can land this PR's part with your credit kept, if that suits you. If you'd rather update this PR yourself, either of the existing handoffs would do: milescoviello's [rebase/6300](https://github.com/boykopovar/AnyPS5/pull/6300#issuecomment-6266476777) or JJenkx's [refreshed branch](https://github.com/boykopovar/AnyPS5/pull/6300#issuecomment-6315687237). #9533 would then rebase onto it.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!6300
No description provided.