AGC: compute buffer read of a native 4-sample D32 depth target needs sample-preserving publication (Onimusha: Way of the Sword, PPSA27836) #6570

Open
opened 2026-10-15 21:01:55 +00:00 by simonbronk · 7 comments
simonbronk commented 2026-10-15 21:01:55 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by simonbronk on 2026-10-15T21:01:55Z.


What

With #6557, Onimusha: Way of the Sword (PPSA27836) passes the native multisample depth import of #6362 and stops a few commands later, during the first scene load:

compute shader 0x211200de00: AGC graphics: sample-preserving guest publication of native multisample depth is not implemented

The refusal is RequireNoResidentDepthRead_nid_no_patch (DepthSurface.cpp), reached from the guest read guard (RequireNoMultisampleTarget(..., "a CPU read")) while the compute dispatch snapshots a buffer.

Data (local diagnostic prints, not in any branch)

  • Depth target: 0x2000e60000, 128x64, 4 samples, VK_FORMAT_D32_SFLOAT, no stencil, HTILE 0x2000e80000 (pipe-aligned, ITERATE_256 off). Guarded ranges: depth 0x2000e60000+0x20000, HTILE 0x2000e80000+0x8000.
  • The read: 0x2000e60000+0x200000, starting at the depth base and covering both ranges. It is the first guest read of these ranges after the guard is created. Whether a draw wrote the target in between was not measured.
  • Earlier in the same run, 0x2000e60000 held a 960x1080 single-sample texture (format 22, tile mode 4), so the title reuses this memory for different surfaces.
  • Same stop in 3 of 3 runs. The shader address changes between runs (0x211200d000, 0x2111c16c00, 0x211200de00).

Build: main 4eb91eacd + #5907 + #5841 + #5884 + #5915 + #6557, APS5_NO_HOST_IMPORT=1 (#6374), Windows 11 Pro 26200, NVIDIA GeForce RTX 5070 (617.42).

Existing work

No open PR implements this. #6498 (fixing #6480) adds refusals for buffer aliases of native MSAA targets and does not publish. @Amoenus's fork has MultisampleSwizzleEquations.hpp (Z_X equations for 1/2/4-byte elements and 2/4/8 fragments) and a color publication path on codex/integration-main03-msaa-publication. On that branch the depth refusal above is unchanged.

Question

@Amoenus, do you plan to upstream the multisample swizzle equations and the readback/retile path? Publishing native depth (host samples to Z_X memory, HTILE set to expanded) would build on them. I can write the depth part and test it on this title once the foundation is in main, or test your branch here if you prefer to do it yourself. @Gashrod1, this touches the native multisample depth surfaces your #6297, #6300 and #6423 work on.

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5873872402 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/6570). Originally posted by [simonbronk](https://github.com/simonbronk) on 2026-10-15T21:01:55Z. --- ### What With #6557, Onimusha: Way of the Sword (PPSA27836) passes the native multisample depth import of #6362 and stops a few commands later, during the first scene load: ``` compute shader 0x211200de00: AGC graphics: sample-preserving guest publication of native multisample depth is not implemented ``` The refusal is `RequireNoResidentDepthRead_nid_no_patch` (`DepthSurface.cpp`), reached from the guest read guard (`RequireNoMultisampleTarget(..., "a CPU read")`) while the compute dispatch snapshots a buffer. ### Data (local diagnostic prints, not in any branch) - Depth target: `0x2000e60000`, 128x64, 4 samples, `VK_FORMAT_D32_SFLOAT`, no stencil, HTILE `0x2000e80000` (pipe-aligned, `ITERATE_256` off). Guarded ranges: depth `0x2000e60000+0x20000`, HTILE `0x2000e80000+0x8000`. - The read: `0x2000e60000+0x200000`, starting at the depth base and covering both ranges. It is the first guest read of these ranges after the guard is created. Whether a draw wrote the target in between was not measured. - Earlier in the same run, `0x2000e60000` held a 960x1080 single-sample texture (format 22, tile mode 4), so the title reuses this memory for different surfaces. - Same stop in 3 of 3 runs. The shader address changes between runs (`0x211200d000`, `0x2111c16c00`, `0x211200de00`). Build: `main` 4eb91eacd + #5907 + #5841 + #5884 + #5915 + #6557, `APS5_NO_HOST_IMPORT=1` (#6374), Windows 11 Pro 26200, NVIDIA GeForce RTX 5070 (617.42). ### Existing work No open PR implements this. #6498 (fixing #6480) adds refusals for buffer aliases of native MSAA targets and does not publish. @Amoenus's fork has `MultisampleSwizzleEquations.hpp` (Z_X equations for 1/2/4-byte elements and 2/4/8 fragments) and a color publication path on `codex/integration-main03-msaa-publication`. On that branch the depth refusal above is unchanged. ### Question @Amoenus, do you plan to upstream the multisample swizzle equations and the readback/retile path? Publishing native depth (host samples to Z_X memory, HTILE set to expanded) would build on them. I can write the depth part and test it on this title once the foundation is in `main`, or test your branch here if you prefer to do it yourself. @Gashrod1, this touches the native multisample depth surfaces your #6297, #6300 and #6423 work on.
Amoenus commented 2026-10-15 21:07:59 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Amoenus on 2026-10-15T21:07:59Z.


@simonbronk Yes, I plan to extract the shared layout/equations and sample-preserving publication work into focused upstream PRs. Your report gives the depth consumer a concrete title and stop to validate against. Happy for you to take the depth implementation and title testing; I will focus on making the shared foundation reviewable on current main.

The older branch you linked is preserved. A newer published checkpoint is fe0a86b6, on codex/integration-6060-floor290. Useful pieces at that exact revision:

  • Swizzle equations and CPU layout/Tile/Detile implementation: Z_X supports 1/2/4-byte elements with 2/4/8 fragments, including pipe/bank XOR within the implemented 16-pipe configuration.
  • Layout tests: address vectors, fragment/layer round trips, inverse equations, padding preservation and explicit refusals. These are CPU layout checks, not depth-publication hardware validation.
  • Color readback/publication path: ReadSamples / PublishGuest currently handle R_X color targets. The depth refusal remains; this checkpoint will not fix your reported stop. It is an integration reference, not a focused patch to cherry-pick wholesale.

For the depth part, the remaining validation needs to cover distinct per-sample D32 values, the exact expanded HTILE encoding for this configuration, producer completion, and reuse/retirement of the previous surface. The 2 MiB buffer read also needs to publish the owned depth/HTILE ranges while preserving unrelated bytes. The layout helper preserves padding; the publication caller must deliberately handle any backing/padded samples it exposes. A resolve or removing the guard would not establish those semantics.

I have not reproduced Onimusha here. Our color-path validation does not establish D32/HTILE correctness. Please keep the depth work coordinated here; you can inspect or adapt these pinned helpers now rather than waiting for the broad integration branch to land. I will link the focused foundation PRs here when ready.

AI-assisted source inspection and reply.

Focused foundations are available: #6588 provides the CPU R_X/Z_X layout/equations and retile helpers; #6601 provides the sampled-image reader, including per-sample D32 float bits. A combined validation commit is now pushed to our fork. The API and validation handoff has its exact composition and test scope. Native depth publication, HTILE and title testing remain the coordinated follow-up; neither foundation changes the reported refusal. AI-assisted: Codex.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6202304285 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/6570#issuecomment-6202304285). Originally posted by [Amoenus](https://github.com/Amoenus) on 2026-10-15T21:07:59Z. --- @simonbronk Yes, I plan to extract the shared layout/equations and sample-preserving publication work into focused upstream PRs. Your report gives the depth consumer a concrete title and stop to validate against. Happy for you to take the depth implementation and title testing; I will focus on making the shared foundation reviewable on current main. The older branch you linked is preserved. A newer published checkpoint is [`fe0a86b6`](https://github.com/Amoenus/AnyPS5/commit/fe0a86b6cd2fc42515e7b32f793064ebc5f9df7b), on `codex/integration-6060-floor290`. Useful pieces at that exact revision: - [Swizzle equations](https://github.com/Amoenus/AnyPS5/blob/fe0a86b6cd2fc42515e7b32f793064ebc5f9df7b/core/libs/prx/libSceAgcDriver/Graphics/include/MultisampleSwizzleEquations.hpp) and [CPU layout/Tile/Detile implementation](https://github.com/Amoenus/AnyPS5/blob/fe0a86b6cd2fc42515e7b32f793064ebc5f9df7b/core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTextureLayout.cpp): Z_X supports 1/2/4-byte elements with 2/4/8 fragments, including pipe/bank XOR within the implemented 16-pipe configuration. - [Layout tests](https://github.com/Amoenus/AnyPS5/blob/fe0a86b6cd2fc42515e7b32f793064ebc5f9df7b/core/libs/prx/libSceAgcDriver/tests/MultisampleTextureLayout.cpp): address vectors, fragment/layer round trips, inverse equations, padding preservation and explicit refusals. These are CPU layout checks, not depth-publication hardware validation. - [Color readback/publication path](https://github.com/Amoenus/AnyPS5/blob/fe0a86b6cd2fc42515e7b32f793064ebc5f9df7b/core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp): `ReadSamples` / `PublishGuest` currently handle R_X color targets. The depth refusal remains; this checkpoint will not fix your reported stop. It is an integration reference, not a focused patch to cherry-pick wholesale. For the depth part, the remaining validation needs to cover distinct per-sample D32 values, the exact expanded HTILE encoding for this configuration, producer completion, and reuse/retirement of the previous surface. The 2 MiB buffer read also needs to publish the owned depth/HTILE ranges while preserving unrelated bytes. The layout helper preserves padding; the publication caller must deliberately handle any backing/padded samples it exposes. A resolve or removing the guard would not establish those semantics. I have not reproduced Onimusha here. Our color-path validation does not establish D32/HTILE correctness. Please keep the depth work coordinated here; you can inspect or adapt these pinned helpers now rather than waiting for the broad integration branch to land. I will link the focused foundation PRs here when ready. AI-assisted source inspection and reply. <!-- foundation-extraction-status --> **Focused foundations are available:** #6588 provides the CPU R_X/Z_X layout/equations and retile helpers; #6601 provides the sampled-image reader, including per-sample D32 float bits. A [combined validation commit](https://github.com/Amoenus/AnyPS5/commit/6f91c1b68bf561c530270df09d2652b6c94afbf6) is now pushed to our fork. The [API and validation handoff](https://github.com/boykopovar/AnyPS5/issues/6570#issuecomment-6202800028) has its exact composition and test scope. Native depth publication, HTILE and title testing remain the coordinated follow-up; neither foundation changes the reported refusal. AI-assisted: Codex. <!-- /foundation-extraction-status -->
simonbronk commented 2026-10-15 21:11:34 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by simonbronk on 2026-10-15T21:11:34Z.


@Amoenus thanks, that split works for me. I'll take the depth publication and the title testing, and use the helpers at fe0a86b6 as the layout reference. The PR will depend on your foundation PRs instead of copying them. Before writing it I'll measure the points you list: whether a draw writes the target before the read, distinct per-sample D32 values, the expanded HTILE word for this configuration, and how the 2 MiB read lines up with the previous surface at that address. Results will go here.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6202366418 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/6570#issuecomment-6202366418). Originally posted by [simonbronk](https://github.com/simonbronk) on 2026-10-15T21:11:34Z. --- @Amoenus thanks, that split works for me. I'll take the depth publication and the title testing, and use the helpers at fe0a86b6 as the layout reference. The PR will depend on your foundation PRs instead of copying them. Before writing it I'll measure the points you list: whether a draw writes the target before the read, distinct per-sample D32 values, the expanded HTILE word for this configuration, and how the 2 MiB read lines up with the previous surface at that address. Results will go here.
Amoenus commented 2026-10-15 21:36:58 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Amoenus on 2026-10-15T21:36:58Z.


Submitted foundation status, 2026-10-17

The shared color foundation #6973 → #6987 → #6989 → #6995 → #7002 is now rebased to main 21a0672ab2, pushed and clean against inspected main 47a266cf97; #6498 remains the buffer-guard prerequisite. The five PR descriptions record their exact new heads, repeated NVIDIA/AMD/llvmpipe tests and declared dependencies. #6480 maintains the consolidated stack, retained integration and scope. No whole-suite claim.

This remains R_X color publication and caller wiring. Native depth ownership, Z_X guest commit and expanded HTILE publication are not implemented by these PRs; the Onimusha stop remains unvalidated here. The connected D32-to-Z_X evidence below retains its original pin. AI-assisted: Codex; author responsible.

@simonbronk Updated shared-foundation composition: c4d6d3cc8, branch codex/test-msaa-reader-retile-main143, contains main 143f13055, #6588 head f1a733dd5, #6601 head 4b24b3ca0, and #6887's connected tests. #6452 is excluded; earlier pins remain preserved.

New connected D32 coverage: #6887 now renders separate R32_UINT and D32_SFLOAT 129x67, 17-layer, 4x images. Actual readback feeds R_X/Z_X tile and detile with XOR 0/0x8100. Each mode checks 587,724 rendered elements, padding, source/outer sentinels and 28 pinned Addrlib fragment addresses. The depth case uses distinct finite D32 values below 1.0. This tests the D32-to-Z_X handoff directly without implementing a native owner or HTILE publisher.

At this exact pin, all eight reader groups pass three fresh repetitions on each verified RTX 5080, AMD Radeon Graphics and Ubuntu 24.04 llvmpipe device: 72 passes, maximum0.51s. Windows GCC15.2r7 runs all 2x/4x/8x reader subcases; Linux GCC13.3 / Mesa25.2.8 LLVM20.1.2 runs 4x and excludes the reported 36 unavailable 2x/8x subcases. Both connected modes execute fully, no whole-test skips. A bounded D32 host-sample ordering control fails the intended assertion on NVIDIA; restoring this head passes. Selected targets rebuild on both OSes; previous full app/libs builds retain pin bfae8feb4. Conventions, registration, diff and selected Cppcheck/clang-tidy checks pass. GPU/OS/driver details and historical controls are in #6887.

The sampled-array view must be in GENERAL; the caller still owns barriers, completion and resource lifetimes. This test connects helpers through an ordinary host buffer. It does not publish native depth ownership, stencil or expanded HTILE. In particular, the reader still rejects a VK_FORMAT_D32_SFLOAT_S8_UINT argument; written-stencil handling needs separate attention for the later title report. No Onimusha run or title unblock is claimed. Native publication remains your coordinated follow-up.

AI-assisted: Codex. This handoff is edited in place.

Earlier main896 handoff and retained reader validation

@simonbronk Foundation handoff (source pins below): branch codex/validate-msaa-foundations-maine0, pinned at 185ef412f, now includes main 896e1b2b72f30f5196c1a600fd7aaf1165b9f44d.

The helpers and fixtures remain byte-identical to #6588 head f506edb26 and #6601 head 4b24b3ca0; the composition also retains #6452's separate Windows test-alignment correction. No new production behavior is introduced, and the two submission PRs stay focused. The small foundation branch excludes our broader experimental integration.

Fresh affected-path validation at 7275bcd02 on main e0e3ced1e: selected reader/layout targets and dependencies build on Windows 11 Enterprise 26200 / GCC 15.2r7 and Ubuntu 24.04 WSL2 / GCC 13.3. CPU layout passes three fresh processes per OS. All six reader modes pass three fresh processes on each of NVIDIA RTX 5080, AMD Radeon Graphics and Linux llvmpipe: 54 reader + 6 CPU passes, longest 0.51 s. Every reader process verifies its selected device. Windows runs 2x/4x/8x with no unavailable subcases; llvmpipe runs 4x and reports 36 unavailable 2x/8x subcases, excluded from coverage. No whole test skips or timeouts. All 32,768 distinct finite values in the 128x64 4x D32 case and the uint/depth pipeline transitions pass each repetition. Conventions and registration checks pass.

The final 185ef412f differs from that tested pin only in .github/workflows/build.yml, adopting main's Linux CI wild-linker setup. Local source/build settings are unchanged, so the matrix was retained rather than repeated. These are local selected builds using our existing toolchains, not a wild-linker CI result or new full-application build. Earlier full builds, oracle comparisons and controls retain their original pins below. Windows GPU drivers: NVIDIA 610.62 / 32.0.16.1062 and AMD 32.0.21036.18; Linux Mesa 25.2.8 llvmpipe (LLVM 20.1.2), vendor 10005:0000.

Independent reader follow-up: jotitadev's corrected-head retest confirms #6601 head 4b24b3ca0 on Ubuntu 26.04 / GCC 15.2, merged with main 0615cd2b8: all six modes pass 3/3 on Mesa 26.0.3 lavapipe (LLVM 21.1.8), running 4x/8x and reporting 2x unavailable; RTX 3070 driver 595.99.02 passes all six with 2x/4x/8x. This is the reviewer's reader validation, not another run of our combined branch or a connected depth-publication/title test. The requested Mesa 26.0.3 retest is complete.

API/remaining scope: TextureDetiler::DispatchMultisampleReadback takes a sampled 2D-array view in GENERAL and emits layer/y/x/fragment elements. Its caller owns producer/readback barriers, completion and resource lifetime; #6588 supplies CPU retile/layout. Neither helper publishes guest ranges or expanded HTILE. The later written-stencil report also needs distinct attention: the current fixture tests D32 depth, not stencil extraction, and explicitly refuses a VK_FORMAT_D32_SFLOAT_S8_UINT argument. That is a confirmed helper/test boundary, not a newly reproduced title blocker. No Onimusha run, native-depth publication, stencil/HTILE correctness or title-unblock claim here.

AI-assisted: Codex. This existing handoff is edited in place.

Earlier main5d API handoff, full-build evidence and connected color example

@simonbronk The shared foundations are proposed in #6588 (CPU R_X/Z_X layout and retile) and #6601 (sampled-image readback, including D32).

TextureDetiler::DispatchMultisampleReadback takes VkFormat, a 2D-array sampled view in GENERAL, an output storage buffer, dimensions/layers/fragments and a firstElement/elements window. Output order is layer/y/x/fragment. It supports unsigned 1/2/4/8/16-byte element views and D32 float bits, preserving unused bytes in the final packed buffer word. The caller owns producer/readback barriers, completion and resource lifetimes. This reader does not require #5881 or storage usage on the source image.

Combined branch ready for your work: codex/validate-msaa-foundations-main5d, now pinned at 82155cf97. It contains main 5d9dcc42d + #6601 head 4b24b3ca0 + the separate #6452 Windows test-alignment correction + #6588's unchanged layout implementation/fixture. Relative to the previous 6f91c1b6 pin, only the reader fixture changes: unsupported sample counts are reported while supported counts continue. The reader API and both production helpers are unchanged. The two submitted PRs remain focused and do not include #6452.

On this exact combined pin, the full Windows app/libs build, conventions and test registration pass, as do five CPU-layout processes and 60 fresh reader processes (six modes x five repetitions x two GPUs). Physical selection is verified for every reader process: RTX 5080 and AMD Radeon integrated graphics. Reader cases cover 2/4/8 samples, two layers, partial windows, sentinels, forced 2D dispatch, descriptor reuse, and all 32,768 distinct finite D32 values in the 128x64 4x fixture. These exercise the two helpers separately; they do not test a connected guest-publication path. Independent layout-oracle comparisons, fault controls, broader regression matrices and static-analysis results are detailed in the respective PRs.

Local Linux confirmation of this combined pin: Ubuntu 24.04 WSL2, GCC 13.3, Release, bundled dependencies/SPIRV-Tools ON. Both fixture targets and their dependencies build; the CPU layout test passes five fresh processes, and all six reader modes pass five fresh processes each on Mesa 25.2.8 lavapipe (LLVM 20.1.2, 256 bits). All 30 reader processes verify the software device. They run supported 4x and explicitly report unavailable 2x/8x subcases; no whole tests skip. Maximum of the 35 processes: 0.15 s. This is selected-target Linux coverage, not a full Linux app/suite build. The exact updated combined pin also passes the full Windows build/checks and the 65 Windows processes described above (maximum 0.44 s). The original-reader/fixed-reader lavapipe comparison is recorded in #6601.

Your remaining depth work is resident-surface ownership/producer completion, publication of Z_X depth and expanded HTILE, range/padding preservation and reuse/retirement, followed by title validation. The native depth refusal remains. No Onimusha reproduction, HTILE correctness or title-unblock claim here. AI-assisted: Codex.

Connected color-consumer example: integration commit eb3c113a6 wires the shared reader into the retained color readback/CPU-retile/publication path. The raw array view now declares sampled usage as well as storage usage. The device-feature-disabled fixture passes all 48 color configurations, 5/5 fresh processes on each NVIDIA/AMD GPU; the old consumer fails all ten controls. Full Windows builds and a 163-group matrix per GPU selector pass. This broader branch is an adaptation reference; use the small combined foundation branch above for the depth work. Source contracts for extended usage and view usage apply. Depth/HTILE/title status is unchanged. AI-assisted: Codex.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6202800028 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/6570#issuecomment-6202800028). Originally posted by [Amoenus](https://github.com/Amoenus) on 2026-10-15T21:36:58Z. --- <!-- color-publication-submissions-v1 --> ### Submitted foundation status, 2026-10-17 The shared color foundation #6973 → #6987 → #6989 → #6995 → #7002 is now rebased to main `21a0672ab2`, pushed and clean against inspected main `47a266cf97`; #6498 remains the buffer-guard prerequisite. The five PR descriptions record their exact new heads, repeated NVIDIA/AMD/llvmpipe tests and declared dependencies. [#6480](https://github.com/boykopovar/AnyPS5/issues/6480) maintains the consolidated stack, retained integration and scope. No whole-suite claim. This remains R_X color publication and caller wiring. Native depth ownership, Z_X guest commit and expanded HTILE publication are not implemented by these PRs; the Onimusha stop remains unvalidated here. The connected D32-to-Z_X evidence below retains its original pin. AI-assisted: Codex; author responsible. <!-- /color-publication-submissions-v1 --> <!-- current-main-foundation-handoff --> @simonbronk **Updated shared-foundation composition:** [`c4d6d3cc8`](https://github.com/Amoenus/AnyPS5/commit/c4d6d3cc85e1c6a9018ad5e02dfff10819f795a6), branch [`codex/test-msaa-reader-retile-main143`](https://github.com/Amoenus/AnyPS5/tree/codex/test-msaa-reader-retile-main143), contains main `143f13055`, #6588 head `f1a733dd5`, #6601 head `4b24b3ca0`, and #6887's connected tests. #6452 is excluded; earlier pins remain preserved. **New connected D32 coverage:** #6887 now renders separate R32_UINT and D32_SFLOAT 129x67, 17-layer, 4x images. Actual readback feeds R_X/Z_X tile and detile with XOR 0/0x8100. Each mode checks 587,724 rendered elements, padding, source/outer sentinels and 28 pinned Addrlib fragment addresses. The depth case uses distinct finite D32 values below 1.0. This tests the D32-to-Z_X handoff directly without implementing a native owner or HTILE publisher. At this exact pin, all eight reader groups pass three fresh repetitions on each verified RTX 5080, AMD Radeon Graphics and Ubuntu 24.04 llvmpipe device: **72 passes**, maximum0.51s. Windows GCC15.2r7 runs all 2x/4x/8x reader subcases; Linux GCC13.3 / Mesa25.2.8 LLVM20.1.2 runs 4x and excludes the reported 36 unavailable 2x/8x subcases. Both connected modes execute fully, no whole-test skips. A bounded [D32 host-sample ordering control](https://github.com/Amoenus/AnyPS5/commit/68f1553d2905f1df03e42367f1de1fee9ac3d177) fails the intended assertion on NVIDIA; restoring this head passes. Selected targets rebuild on both OSes; previous full app/libs builds retain pin `bfae8feb4`. Conventions, registration, diff and selected Cppcheck/clang-tidy checks pass. GPU/OS/driver details and historical controls are in #6887. The sampled-array view must be in GENERAL; the caller still owns barriers, completion and resource lifetimes. This test connects helpers through an ordinary host buffer. It does not publish native depth ownership, stencil or expanded HTILE. In particular, the reader still rejects a `VK_FORMAT_D32_SFLOAT_S8_UINT` argument; written-stencil handling needs separate attention for the later title report. No Onimusha run or title unblock is claimed. Native publication remains your coordinated follow-up. AI-assisted: Codex. This handoff is edited in place. <!-- /current-main-foundation-handoff --> <details> <summary>Earlier main896 handoff and retained reader validation</summary> @simonbronk **Foundation handoff (source pins below):** [branch `codex/validate-msaa-foundations-maine0`](https://github.com/Amoenus/AnyPS5/tree/codex/validate-msaa-foundations-maine0), pinned at [`185ef412f`](https://github.com/Amoenus/AnyPS5/commit/185ef412faecc83b0efd95e89103664294511944), now includes main `896e1b2b72f30f5196c1a600fd7aaf1165b9f44d`. The helpers and fixtures remain byte-identical to #6588 head `f506edb26` and #6601 head `4b24b3ca0`; the composition also retains #6452's separate Windows test-alignment correction. No new production behavior is introduced, and the two submission PRs stay focused. The small foundation branch excludes our broader experimental integration. **Fresh affected-path validation at `7275bcd02` on main `e0e3ced1e`:** selected reader/layout targets and dependencies build on Windows 11 Enterprise 26200 / GCC 15.2r7 and Ubuntu 24.04 WSL2 / GCC 13.3. CPU layout passes three fresh processes per OS. All six reader modes pass three fresh processes on each of NVIDIA RTX 5080, AMD Radeon Graphics and Linux llvmpipe: **54 reader + 6 CPU passes**, longest 0.51 s. Every reader process verifies its selected device. Windows runs 2x/4x/8x with no unavailable subcases; llvmpipe runs 4x and reports 36 unavailable 2x/8x subcases, excluded from coverage. No whole test skips or timeouts. All 32,768 distinct finite values in the 128x64 4x D32 case and the uint/depth pipeline transitions pass each repetition. Conventions and registration checks pass. The final `185ef412f` differs from that tested pin only in `.github/workflows/build.yml`, adopting main's Linux CI wild-linker setup. Local source/build settings are unchanged, so the matrix was retained rather than repeated. These are local selected builds using our existing toolchains, not a wild-linker CI result or new full-application build. Earlier full builds, oracle comparisons and controls retain their original pins below. Windows GPU drivers: NVIDIA 610.62 / 32.0.16.1062 and AMD 32.0.21036.18; Linux Mesa 25.2.8 llvmpipe (LLVM 20.1.2), vendor `10005:0000`. **Independent reader follow-up:** [jotitadev's corrected-head retest](https://github.com/boykopovar/AnyPS5/pull/6601#pullrequestreview-5549985186) confirms #6601 head `4b24b3ca0` on Ubuntu 26.04 / GCC 15.2, merged with main `0615cd2b8`: all six modes pass 3/3 on Mesa 26.0.3 lavapipe (LLVM 21.1.8), running 4x/8x and reporting 2x unavailable; RTX 3070 driver 595.99.02 passes all six with 2x/4x/8x. This is the reviewer's reader validation, not another run of our combined branch or a connected depth-publication/title test. The requested Mesa 26.0.3 retest is complete. **API/remaining scope:** `TextureDetiler::DispatchMultisampleReadback` takes a sampled 2D-array view in GENERAL and emits layer/y/x/fragment elements. Its caller owns producer/readback barriers, completion and resource lifetime; #6588 supplies CPU retile/layout. Neither helper publishes guest ranges or expanded HTILE. The later written-stencil report also needs distinct attention: the current fixture tests D32 depth, not stencil extraction, and explicitly refuses a `VK_FORMAT_D32_SFLOAT_S8_UINT` argument. That is a confirmed helper/test boundary, not a newly reproduced title blocker. No Onimusha run, native-depth publication, stencil/HTILE correctness or title-unblock claim here. AI-assisted: Codex. This existing handoff is edited in place. </details> <details> <summary>Earlier main5d API handoff, full-build evidence and connected color example</summary> @simonbronk The shared foundations are proposed in #6588 (CPU R_X/Z_X layout and retile) and #6601 (sampled-image readback, including D32). [`TextureDetiler::DispatchMultisampleReadback`](https://github.com/Amoenus/AnyPS5/blob/4b24b3ca03012f12f7c43fa49db61991e3f6c002/core/libs/prx/libSceAgcDriver/Graphics/include/TextureDetiler.hpp) takes `VkFormat`, a 2D-array sampled view in GENERAL, an output storage buffer, dimensions/layers/fragments and a `firstElement`/`elements` window. Output order is layer/y/x/fragment. It supports unsigned 1/2/4/8/16-byte element views and D32 float bits, preserving unused bytes in the final packed buffer word. The caller owns producer/readback barriers, completion and resource lifetimes. This reader does not require #5881 or storage usage on the source image. **Combined branch ready for your work:** [`codex/validate-msaa-foundations-main5d`](https://github.com/Amoenus/AnyPS5/tree/codex/validate-msaa-foundations-main5d), now pinned at [`82155cf97`](https://github.com/Amoenus/AnyPS5/commit/82155cf978c3470ffbeccfee86c4752266a59179). It contains main `5d9dcc42d` + #6601 head `4b24b3ca0` + the separate #6452 Windows test-alignment correction + #6588's unchanged layout implementation/fixture. Relative to the previous `6f91c1b6` pin, only the reader fixture changes: unsupported sample counts are reported while supported counts continue. The reader API and both production helpers are unchanged. The two submitted PRs remain focused and do not include #6452. On this exact combined pin, the full Windows app/libs build, conventions and test registration pass, as do five CPU-layout processes and 60 fresh reader processes (six modes x five repetitions x two GPUs). Physical selection is verified for every reader process: RTX 5080 and AMD Radeon integrated graphics. Reader cases cover 2/4/8 samples, two layers, partial windows, sentinels, forced 2D dispatch, descriptor reuse, and all 32,768 distinct finite D32 values in the 128x64 4x fixture. These exercise the two helpers separately; they do not test a connected guest-publication path. Independent layout-oracle comparisons, fault controls, broader regression matrices and static-analysis results are detailed in the respective PRs. **Local Linux confirmation of this combined pin:** Ubuntu 24.04 WSL2, GCC 13.3, Release, bundled dependencies/SPIRV-Tools ON. Both fixture targets and their dependencies build; the CPU layout test passes five fresh processes, and all six reader modes pass five fresh processes each on Mesa 25.2.8 lavapipe (LLVM 20.1.2, 256 bits). All 30 reader processes verify the software device. They run supported 4x and explicitly report unavailable 2x/8x subcases; no whole tests skip. Maximum of the 35 processes: 0.15 s. This is selected-target Linux coverage, not a full Linux app/suite build. The exact updated combined pin also passes the full Windows build/checks and the 65 Windows processes described above (maximum 0.44 s). The original-reader/fixed-reader lavapipe comparison is recorded in #6601. Your remaining depth work is resident-surface ownership/producer completion, publication of Z_X depth and expanded HTILE, range/padding preservation and reuse/retirement, followed by title validation. The native depth refusal remains. No Onimusha reproduction, HTILE correctness or title-unblock claim here. AI-assisted: Codex. <!-- color-consumer-validation --> **Connected color-consumer example:** [integration commit `eb3c113a6`](https://github.com/Amoenus/AnyPS5/commit/eb3c113a6f95560f56f6c02d03689c8b58ed00cb) wires the shared reader into the retained color readback/CPU-retile/publication path. The raw array view now declares sampled usage as well as storage usage. The device-feature-disabled fixture passes all 48 color configurations, 5/5 fresh processes on each NVIDIA/AMD GPU; the old consumer fails all ten controls. Full Windows builds and a 163-group matrix per GPU selector pass. This broader branch is an adaptation reference; use the small combined foundation branch above for the depth work. Source contracts for [extended usage](https://docs.vulkan.org/refpages/latest/refpages/source/VkImageCreateFlagBits.html) and [view usage](https://docs.vulkan.org/refpages/latest/refpages/source/VkImageViewUsageCreateInfo.html) apply. Depth/HTILE/title status is unchanged. AI-assisted: Codex. <!-- /color-consumer-validation --> </details>
simonbronk commented 2026-10-16 07:26:27 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by simonbronk on 2026-10-16T07:26:27Z.


Measured on the title (main 5d9dcc42d + #5907 + #5884 + #5915 + #6557, APS5_NO_HOST_IMPORT=1, RTX 5070, 3 runs, local prints only):

  • Producer: between the native import and the failing read there is exactly one draw bound to the target. It has depthTest on with GREATER_OR_EQUAL, depthWrite off, no stencil test, no depth bounds and no color targets, rasterized at 4 samples. So nothing on the host writes the surface after the import; its samples are still the clear value the import took from HTILE.
  • Consumer: compute shader 0x2111838e00 (the address moves between runs), wave64, 128 threads. It reads the memory through a buffer V# in s[8:11]: six buffer_load_dwordx4 with idxen at offsets 0 to 0x50, so 96-byte records. It then buffer_store_dwords into the same V#, does a returning buffer_atomic_add on s[12:15] and an image_store. The snapshot of that buffer is the 2 MiB CPU read that hits the guard. The title is reusing the depth's memory as a structured buffer, not reading depth samples.

So for this stop, the guest bytes are already exact: a draw that neither writes depth nor stencil leaves the native surface equal to what was imported. Publication is not needed here. Retiring the native surface on a guest access is enough, as long as the host never wrote it after the import. I plan a small PR for that:

  • track whether a native multisample depth surface was written on the host after its import (draws with depth or stencil writes, clears, copies, storage write-back);
  • on a guest read or write over an unwritten one, retire it and its guards instead of throwing;
  • keep the existing refusal for surfaces the host did write. That case still needs your foundations and the depth publication, which stays the follow-up here.

One point I can't settle from a source yet: whether the DB leaves HTILE untouched for a depth-test-only draw. I'll look for it in Mesa/PAL before writing it down, and record it as technical debt if no source settles it.

AI-assisted: yes (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6210371827 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/6570#issuecomment-6210371827). Originally posted by [simonbronk](https://github.com/simonbronk) on 2026-10-16T07:26:27Z. --- Measured on the title (main 5d9dcc42d + #5907 + #5884 + #5915 + #6557, `APS5_NO_HOST_IMPORT=1`, RTX 5070, 3 runs, local prints only): - **Producer:** between the native import and the failing read there is exactly one draw bound to the target. It has `depthTest` on with `GREATER_OR_EQUAL`, **`depthWrite` off**, no stencil test, no depth bounds and **no color targets**, rasterized at 4 samples. So nothing on the host writes the surface after the import; its samples are still the clear value the import took from HTILE. - **Consumer:** compute shader `0x2111838e00` (the address moves between runs), wave64, 128 threads. It reads the memory through a buffer V# in `s[8:11]`: six `buffer_load_dwordx4` with `idxen` at offsets 0 to 0x50, so 96-byte records. It then `buffer_store_dword`s into the same V#, does a returning `buffer_atomic_add` on `s[12:15]` and an `image_store`. The snapshot of that buffer is the 2 MiB CPU read that hits the guard. The title is reusing the depth's memory as a structured buffer, not reading depth samples. So for this stop, the guest bytes are already exact: a draw that neither writes depth nor stencil leaves the native surface equal to what was imported. Publication is not needed here. Retiring the native surface on a guest access is enough, as long as the host never wrote it after the import. I plan a small PR for that: - track whether a native multisample depth surface was written on the host after its import (draws with depth or stencil writes, clears, copies, storage write-back); - on a guest read or write over an unwritten one, retire it and its guards instead of throwing; - keep the existing refusal for surfaces the host did write. That case still needs your foundations and the depth publication, which stays the follow-up here. One point I can't settle from a source yet: whether the DB leaves HTILE untouched for a depth-test-only draw. I'll look for it in Mesa/PAL before writing it down, and record it as technical debt if no source settles it. AI-assisted: yes (Claude Code).
simonbronk commented 2026-10-16 07:49:00 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by simonbronk on 2026-10-16T07:49:00Z.


#6727 implements the unwritten-surface case described above. A guest access over a native multisample depth surface that the host did not write after its import now retires the surface. A surface the host did write keeps the refusal. With it the title passes this stop and goes further into the first scene load, until depth export, shader coverage or ordered fragment execution is unsupported (register 0x203 = 0x00000045).

This issue stays open for the written-surface case: publishing host samples to Z_X memory with expanded HTILE, on top of #6588 and #6601.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6210720800 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/6570#issuecomment-6210720800). Originally posted by [simonbronk](https://github.com/simonbronk) on 2026-10-16T07:49:00Z. --- #6727 implements the unwritten-surface case described above. A guest access over a native multisample depth surface that the host did not write after its import now retires the surface. A surface the host did write keeps the refusal. With it the title passes this stop and goes further into the first scene load, until `depth export, shader coverage or ordered fragment execution is unsupported (register 0x203 = 0x00000045)`. This issue stays open for the written-surface case: publishing host samples to Z_X memory with expanded HTILE, on top of #6588 and #6601.
simonbronk commented 2026-10-16 10:36:25 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by simonbronk on 2026-10-16T10:36:25Z.


Update from PPSA27836. With #6727 and #6762 the title now hits the written-surface case of this issue:

  1. The DB_SHADER_CONTROL 0x45 draw writes the stencil of the native 4-sample D32 target: REPLACE_OP on depth pass, write mask 0xff.
  2. The next compute dispatch (0x211183a700) reads that memory.
  3. It throws sample-preserving guest publication of native multisample depth is not implemented.

So retiring unwritten surfaces is not enough for this title; it needs the publication on top of #6588 and #6601. When either of them moves, I can test it on the title.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6213621899 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/6570#issuecomment-6213621899). Originally posted by [simonbronk](https://github.com/simonbronk) on 2026-10-16T10:36:25Z. --- Update from PPSA27836. With #6727 and #6762 the title now hits the written-surface case of this issue: 1. The `DB_SHADER_CONTROL` 0x45 draw writes the stencil of the native 4-sample D32 target: `REPLACE_OP` on depth pass, write mask 0xff. 2. The next compute dispatch (`0x211183a700`) reads that memory. 3. It throws `sample-preserving guest publication of native multisample depth is not implemented`. So retiring unwritten surfaces is not enough for this title; it needs the publication on top of #6588 and #6601. When either of them moves, I can test it on the title.
simonbronk commented 2026-10-17 08:55:39 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by simonbronk on 2026-10-17T08:55:39Z.


@Amoenus answers from a run on the title today. Tree: main 17cfb1f4c + #5915 + #6557 + #6727 + #6762, APS5_NO_HOST_IMPORT=1, RTX 5070, plus local prints only (not pushed).

The written surface has no stencil plane. It is plain D32 depth:

[diag-dsw] draw writes depth target 0x2003bc0000: depthTest 1 depthWrite 1 stencilTest 0 writeMask 0/0 ... samples 4
[diag-dsw] note write: address 0x2003bc0000 stencilAddress 0x0 guest format 126 host format 126 samples 4 extent 128x64 htile 0x2003be0000 htileStencil 0 already 0
[diag-dsw] refusal: guard 0x2003bc0000+0x20000 access 0x2003ba0000+0x200000
  • Host VkFormat 126 (VK_FORMAT_D32_SFLOAT), stencilAddress 0, HTILE without stencil.
  • The dirty mark comes from the draw path (Draw.cpp: writesDepthTarget → NoteDepthSurfaceWrite), from a draw with depth test and depth write on and no stencil test.
  • The read that is refused is a 2 MiB range starting 128 KiB below the target and covering all of it (the compute's buffer V#).

So the title doesn't need your D32S8 stencil reader. It needs Z_X depth publication (D32, 4 samples, 128x64) and HTILE expansion. My earlier comment, which tied this stop to the DB_SHADER_CONTROL 0x45 stencil draw, was wrong. That draw targets another depth surface (its DB_STENCIL_INFO has a stencil format), and it isn't the producer here. Sorry for the noise.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6231999468 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/6570#issuecomment-6231999468). Originally posted by [simonbronk](https://github.com/simonbronk) on 2026-10-17T08:55:39Z. --- @Amoenus answers from a run on the title today. Tree: `main` 17cfb1f4c + #5915 + #6557 + #6727 + #6762, `APS5_NO_HOST_IMPORT=1`, RTX 5070, plus local prints only (not pushed). **The written surface has no stencil plane.** It is plain D32 depth: ``` [diag-dsw] draw writes depth target 0x2003bc0000: depthTest 1 depthWrite 1 stencilTest 0 writeMask 0/0 ... samples 4 [diag-dsw] note write: address 0x2003bc0000 stencilAddress 0x0 guest format 126 host format 126 samples 4 extent 128x64 htile 0x2003be0000 htileStencil 0 already 0 [diag-dsw] refusal: guard 0x2003bc0000+0x20000 access 0x2003ba0000+0x200000 ``` - Host `VkFormat` 126 (`VK_FORMAT_D32_SFLOAT`), `stencilAddress` 0, HTILE without stencil. - The dirty mark comes from the draw path (`Draw.cpp`: `writesDepthTarget` → `NoteDepthSurfaceWrite`), from a draw with depth test and depth write on and no stencil test. - The read that is refused is a 2 MiB range starting 128 KiB below the target and covering all of it (the compute's buffer V#). So the title doesn't need your D32S8 stencil reader. It needs Z_X depth publication (D32, 4 samples, 128x64) and HTILE expansion. My earlier comment, which tied this stop to the `DB_SHADER_CONTROL` 0x45 stencil draw, was wrong. That draw targets another depth surface (its `DB_STENCIL_INFO` has a stencil format), and it isn't the producer here. Sorry for the noise.
Sign in to join this conversation.
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#6570
No description provided.