fix(agc): claim a multisampled color target that a single-sample storage image store overlaps #13248

Merged
hugodearaujo merged 8 commits from upstream-pr/13248 into main 2026-11-14 11:32:00 +00:00
hugodearaujo commented 2026-10-30 07:48:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by hugodearaujo on 2026-10-30T07:48:07Z.


What

#8223 retires a multisampled color target that the title reused: a CPU write over it, or a depth, stencil, HTILE or color target bound over its memory, claims it, and the next guarded access retires it. A title can also reuse that memory through a dispatch, by storing to a single-sample storage image that overlaps it. That store gets none of #8223's evidence, so the cached image check in Revalidate (or the storage image lookup of a fresh build) still throws "overlaps multisampled color target … whose samples are only on the host".

This PR counts that store as a claim, like the binds in #8223:

  • resolveImageBinding: a storage image element that the binding records as stored (imageWritten[element]) claims, before its own guard, every target whose guarded ranges overlap the bytes of the level it stores to (WrittenStorageBytes, the same whole-block ranges main uses to retire covered depth surfaces). The element's descriptor words and level are kept in its DescribedRange.
  • revalidateFull: a kept stored element claims the same way before its a cached image access guard, so a resource set built before the target existed passes too. Ranges keep the build's binding order, so a read that comes before the store in the same set is still refused.
  • MultisampleTarget.cpp: MultisampleColorTargetOverlaps (a cheap check before the level's bytes are described) and ClaimMultisampleTargetStore, which sets #8223's claimed flag on the overlapped non-FMASK ranges and logs the first 8 claims.

Still refused: an element the binding does not record as stored (an empty imageWritten, which main treats as written for store-back), an element that only reads, any other access to the memory, and a one-fragment target's FMASK guard (never claimed, as in #8223). Unlike #10049, the store does not have to cover the whole target, and a store whose shader also loads the image counts too, as a color target bound with blending does in #8223. A new debt entry, "Multisampled color targets under single-sample storage stores", says what is not exact: a target still sampled after such a store loses its samples, and where the store leaves the target's memory unwritten, guest memory keeps the bytes it held before the target instead of its samples.

Why: Assassin's Creed Mirage (PPSA13960 01.007.000). With #8223, the title stops at 73-85 s on

compute shader 0x1000810a00: AGC graphics: a cached image access of 0x10dc1d0000+0x480000 overlaps multisampled color target 0x10dc450000+0x480000 (4 samples), whose samples are only on the host: guest access to it is not implemented

As traced in this #8223 comment and the following one: every frame draws a 1x 1920x1080 color target at 0x10dc1d0000 and samples it, then draws the 4x 960x540 target at 0x10dc450000 (guarded for 0x480000 bytes, so its first 0x200000 bytes are the 1x image's last 0x200000), then compute shader 0x1000810a00, a 14-instruction clear with one image_store and no image load, writes the whole 1x image, and the next draws render into the 1x target again. The clear covers 0x200000 of the target's 0x480000 bytes, so #10049's full-cover rule does not fire. The resource set was built before the target first appeared, so the refusal comes from Revalidate.

A diagnostic build that logs every color target, guard, claim and retirement over that range shows the patched sequence on each of the 16 frames of that screen: the 4x target is guarded at its draw, the clear's Revalidate claims it (claim-by-store 0x10dc450000+0x480000 by 0x10dc450000+0x70000), the same cached image access retires it, and the next frame draws and guards it again.

#8223 (claimed, TargetUse) is merged now; this branch merged main 42d009f5f3 (11cfa16b5e), so its diff against main is this change only.

Tested

Linux 7.2.11, RADV (Mesa 26.2.6), AMD Radeon RX 9070 XT, Release, BUILD_TESTING=ON, on main 3b32cc7b61 + #8223 d488531766 (base 3ce340bf7a), this change on top (6a40548ab2; the same commit was first tested on main 66b8e907e4).

  • After #8223 was merged: main 42d009f5f3 merged in (11cfa16b5e; the only conflict was the debt file, where this PR's new entry sits next to #6498's). Paired validation on main 42d009f5f3 and this head, the same 56 entries with the Khronos layer: 55 of 56 on both with identical per-test results and no VUID- lines (agc_driver_native_multisample_depth fails on both on this machine, as below). Negative control: main 42d009f5f3 with only this PR's CachedImageMultisampleGuard.cpp fails agc_driver_cached_image_multisample_guard with a cached image access of …+0x4000 overlaps multisampled color target …+0x10000 (4 samples).
  • agc_driver_cached_image_multisample_guard, new CheckStoredImage, for compute and draw sets: a 64x64 linear storage image whose last 8 KiB overlap the first 8 KiB of a 4x 64x64 target (64 KiB guarded, different base):
    • stored: the set is built before the target is drawn. Revalidate passes and the target no longer reports host-only samples, and a read of its unstored half passes. The target is drawn again and guarded again; a fresh build passes and retires it; drawn once more, it is guarded.
    • read-only (imageWritten = {false}) and unknown use (imageWritten = {}): Revalidate and a fresh build both throw, and the target stays guarded.
    • a one-fragment target's FMASK guard under the same stored image: both throw with the FMASK message, and the guard stays.
  • Mutations, one at a time, each failing at its own check: no claims at all, and no claim in Revalidate: a cached image access of …+0x4000 overlaps multisampled color target …+0x10000 (4 samples); no claim in the build: a storage image access of …+0x4000 overlaps multisampled color target …; claiming for elements of unknown use: a fresh storage image that does not store over the guarded memory was accepted; claiming FMASK ranges: a cached storage image that does not store over the guarded memory was accepted.
  • Validation layer on the base and on this change, same machine and the same 56 ctest entries (every MSAA, FMASK, cached image, depth storage, storage cache, image table and draw cache reuse test), ctest -V with VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, ANYPS5_NO_SHADER_CACHE=1, ANYPS5_REQUIRE_VULKAN=1: 55/56 on both. The one failure on both, agc_driver_native_multisample_depth (the native depth buffer-write fixture was not bound as a host import, after host import … failed at vkAllocateMemory (-1000072003)), also fails on plain main on this machine. Neither log has a VUID- line or was not found but was requested; both have the same 25 Undefined-Value-ShaderOutputNotConsumed warnings from tests in main.
  • Assassin's Creed Mirage, Cross every 30 s from 60 s:
    • main 3b32cc7b61: stops at 73 s on a storage image access of 0x10dfd20000+0x1fe0000 overlaps multisampled color target 0x10e0720000+0x870000, then a CPU read of the same range in presentation (66b8e907e4: same, 73 s).
    • main + #8223: stops at 73 s on the cached image access above (66b8e907e4 + #8223: 81 s).
    • main + #8223 + this PR: the store claims the target each frame ([gpu] a single-sample storage image store to 0x10dc450000+0x70000 claims the memory of multisampled color target 0x10dc450000+0x480000 (4 samples), 8 of 8 reports). In 12 of 14 runs (300 s or 110 s, on both bases) the title gets past the autosave notice where the two builds above stop, shows "Update! New Game+ Available", accepts Cross, and reaches the Menu Narration screen, still there at 300 s (about 15 frames per 10 s from 70 s on). In 2 of 14 runs it stops at 79 s on a different refusal, a follow-up this PR does not touch: [videoout] presentation failed: AGC graphics: a CPU read of 0x10dc1d0000+0x480000 overlaps multisampled color target 0x10dc450000+0x870000 (4 samples). That is a second 4x target (960x540, B10G11R11, 4-byte texels) drawn at the same address right after the last claim, and the read covers exactly the 1x image the clear stored.
  • tools/check_conventions.py --base 3ce340bf7a passes.
  • Linux and Windows, by milescoviello (comment), Release, GCC 15.2:
    • Ubuntu 26.04.1, RTX 4070 Ti (NVIDIA 615.71.09): head bf30501d66 merged onto main b8194198cf; agc_driver_cached_image_multisample_guard passes 3 of 3. With only this PR's test file on main b8194198cf, it fails at checking a compute storage image store over part of a 4x target with a cached image access of ... overlaps multisampled color target ... (4 samples), whose samples are only on the host.
    • Windows 11 VM, GeForce GT 1030 (WinLibs GCC 15.2 UCRT): this head merged onto main 5546586fb1; the test passes 3 of 3. main alone, with its own version of the test, passes 3 of 3 too.
  • Windows, AMD driver, by Ethan-Hainline (comment): head bf30501d66 merged onto main 510d0bf986, Windows 11 Pro, Radeon Vega iGPU (GCN, Ryzen 5 7530U), AMD driver 23.19.24.04, WinLibs GCC 16.2.0, Release, with the validation layer. agc_driver_cached_image_multisample_guard passes 3 of 3, the log has the store's claim of the 4x target, and no VUID- line.

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
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source (none)
  • Generic behaviour, not specific to one title
  • Depends on: none (#8223 is merged). The overlap report now lists #10049 (ShaderResources.hpp/.cpp, CachedImageMultisampleGuard.cpp; it retires a target only when a store covers all of it, this PR claims it on any overlapping store, so the two would need reconciling) and #12745 (ShaderResources.cpp), and #7002, #9700, #10492 and #10497 for the debt file only. Whichever lands first, I'll rebase this PR over it.
  • Fixes: none
  • Unblocks: PPSA13960 past the autosave notice to the Menu Narration screen (12 of 14 runs; the other 2 stop on the follow-up above). PPSA01317 01.710.000 past the Licence Centre refusal (a cached image access of 0x1238ba0000+0x1560000 overlaps multisampled color target 0x1238d30000+0x2d0000 (4 samples)); its menu renders and the run stops later on #17251. That run was by freneza, with 88091bc014 on main 4977f64052 together with #10049 (comment).
  • GPUs tested: AMD Radeon RX 9070 XT (RADV, Mesa 26.2.6), Linux. Others, from runs posted here: NVIDIA RTX 5070 (615.78.08), Linux (PPSA01317); NVIDIA laptop GPU (Turing, driver 621) and Intel iGPU (driver 101.70xx), Windows (agc_driver_cached_image_multisample_guard: fails without the change and passes with it on both); NVIDIA RTX 4070 Ti (615.71.09), Linux, and GeForce GT 1030, Windows 11 VM (the same test: fails without the change on Linux, passes with it on both); AMD Radeon Vega iGPU (GCN, driver 23.19.24.04), Windows 11 (the same test passes with the change).
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5081180908 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13248). Originally posted by [hugodearaujo](https://github.com/hugodearaujo) on 2026-10-30T07:48:07Z. --- ### What #8223 retires a multisampled color target that the title reused: a CPU write over it, or a depth, stencil, HTILE or color target bound over its memory, claims it, and the next guarded access retires it. A title can also reuse that memory through a dispatch, by storing to a single-sample storage image that overlaps it. That store gets none of #8223's evidence, so the cached image check in `Revalidate` (or the storage image lookup of a fresh build) still throws "overlaps multisampled color target … whose samples are only on the host". This PR counts that store as a claim, like the binds in #8223: - `resolveImageBinding`: a storage image element that the binding records as stored (`imageWritten[element]`) claims, before its own guard, every target whose guarded ranges overlap the bytes of the level it stores to (`WrittenStorageBytes`, the same whole-block ranges main uses to retire covered depth surfaces). The element's descriptor words and level are kept in its `DescribedRange`. - `revalidateFull`: a kept stored element claims the same way before its `a cached image access` guard, so a resource set built before the target existed passes too. Ranges keep the build's binding order, so a read that comes before the store in the same set is still refused. - `MultisampleTarget.cpp`: `MultisampleColorTargetOverlaps` (a cheap check before the level's bytes are described) and `ClaimMultisampleTargetStore`, which sets #8223's `claimed` flag on the overlapped non-FMASK ranges and logs the first 8 claims. Still refused: an element the binding does not record as stored (an empty `imageWritten`, which main treats as written for store-back), an element that only reads, any other access to the memory, and a one-fragment target's FMASK guard (never claimed, as in #8223). Unlike #10049, the store does not have to cover the whole target, and a store whose shader also loads the image counts too, as a color target bound with blending does in #8223. A new debt entry, "Multisampled color targets under single-sample storage stores", says what is not exact: a target still sampled after such a store loses its samples, and where the store leaves the target's memory unwritten, guest memory keeps the bytes it held before the target instead of its samples. Why: Assassin's Creed Mirage (PPSA13960 01.007.000). With #8223, the title stops at 73-85 s on ``` compute shader 0x1000810a00: AGC graphics: a cached image access of 0x10dc1d0000+0x480000 overlaps multisampled color target 0x10dc450000+0x480000 (4 samples), whose samples are only on the host: guest access to it is not implemented ``` As traced in [this #8223 comment](https://github.com/boykopovar/AnyPS5/pull/8223#issuecomment-6373704951) and the following one: every frame draws a 1x 1920x1080 color target at 0x10dc1d0000 and samples it, then draws the 4x 960x540 target at 0x10dc450000 (guarded for 0x480000 bytes, so its first 0x200000 bytes are the 1x image's last 0x200000), then compute shader 0x1000810a00, a 14-instruction clear with one `image_store` and no image load, writes the whole 1x image, and the next draws render into the 1x target again. The clear covers 0x200000 of the target's 0x480000 bytes, so #10049's full-cover rule does not fire. The resource set was built before the target first appeared, so the refusal comes from `Revalidate`. A diagnostic build that logs every color target, guard, claim and retirement over that range shows the patched sequence on each of the 16 frames of that screen: the 4x target is guarded at its draw, the clear's `Revalidate` claims it (`claim-by-store 0x10dc450000+0x480000 by 0x10dc450000+0x70000`), the same cached image access retires it, and the next frame draws and guards it again. #8223 (`claimed`, `TargetUse`) is merged now; this branch merged `main` 42d009f5f3 (11cfa16b5e), so its diff against `main` is this change only. ### Tested Linux 7.2.11, RADV (Mesa 26.2.6), AMD Radeon RX 9070 XT, Release, `BUILD_TESTING=ON`, on `main` 3b32cc7b61 + #8223 d488531766 (base 3ce340bf7a), this change on top (6a40548ab2; the same commit was first tested on `main` 66b8e907e4). - After #8223 was merged: `main` 42d009f5f3 merged in (11cfa16b5e; the only conflict was the debt file, where this PR's new entry sits next to #6498's). Paired validation on `main` 42d009f5f3 and this head, the same 56 entries with the Khronos layer: 55 of 56 on both with identical per-test results and no `VUID-` lines (`agc_driver_native_multisample_depth` fails on both on this machine, as below). Negative control: `main` 42d009f5f3 with only this PR's `CachedImageMultisampleGuard.cpp` fails `agc_driver_cached_image_multisample_guard` with `a cached image access of …+0x4000 overlaps multisampled color target …+0x10000 (4 samples)`. - `agc_driver_cached_image_multisample_guard`, new `CheckStoredImage`, for compute and draw sets: a 64x64 linear storage image whose last 8 KiB overlap the first 8 KiB of a 4x 64x64 target (64 KiB guarded, different base): - stored: the set is built before the target is drawn. `Revalidate` passes and the target no longer reports host-only samples, and a read of its unstored half passes. The target is drawn again and guarded again; a fresh build passes and retires it; drawn once more, it is guarded. - read-only (`imageWritten = {false}`) and unknown use (`imageWritten = {}`): `Revalidate` and a fresh build both throw, and the target stays guarded. - a one-fragment target's FMASK guard under the same stored image: both throw with the FMASK message, and the guard stays. - Mutations, one at a time, each failing at its own check: no claims at all, and no claim in `Revalidate`: `a cached image access of …+0x4000 overlaps multisampled color target …+0x10000 (4 samples)`; no claim in the build: `a storage image access of …+0x4000 overlaps multisampled color target …`; claiming for elements of unknown use: `a fresh storage image that does not store over the guarded memory was accepted`; claiming FMASK ranges: `a cached storage image that does not store over the guarded memory was accepted`. - Validation layer on the base and on this change, same machine and the same 56 ctest entries (every MSAA, FMASK, cached image, depth storage, storage cache, image table and draw cache reuse test), `ctest -V` with `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, `ANYPS5_NO_SHADER_CACHE=1`, `ANYPS5_REQUIRE_VULKAN=1`: 55/56 on both. The one failure on both, `agc_driver_native_multisample_depth` (`the native depth buffer-write fixture was not bound as a host import`, after `host import … failed at vkAllocateMemory (-1000072003)`), also fails on plain `main` on this machine. Neither log has a `VUID-` line or `was not found but was requested`; both have the same 25 `Undefined-Value-ShaderOutputNotConsumed` warnings from tests in `main`. - Assassin's Creed Mirage, Cross every 30 s from 60 s: - `main` 3b32cc7b61: stops at 73 s on `a storage image access of 0x10dfd20000+0x1fe0000 overlaps multisampled color target 0x10e0720000+0x870000`, then `a CPU read` of the same range in presentation (66b8e907e4: same, 73 s). - `main` + #8223: stops at 73 s on the cached image access above (66b8e907e4 + #8223: 81 s). - `main` + #8223 + this PR: the store claims the target each frame (`[gpu] a single-sample storage image store to 0x10dc450000+0x70000 claims the memory of multisampled color target 0x10dc450000+0x480000 (4 samples)`, 8 of 8 reports). In 12 of 14 runs (300 s or 110 s, on both bases) the title gets past the autosave notice where the two builds above stop, shows "Update! New Game+ Available", accepts Cross, and reaches the Menu Narration screen, still there at 300 s (about 15 frames per 10 s from 70 s on). In 2 of 14 runs it stops at 79 s on a different refusal, a follow-up this PR does not touch: `[videoout] presentation failed: AGC graphics: a CPU read of 0x10dc1d0000+0x480000 overlaps multisampled color target 0x10dc450000+0x870000 (4 samples)`. That is a second 4x target (960x540, B10G11R11, 4-byte texels) drawn at the same address right after the last claim, and the read covers exactly the 1x image the clear stored. - `tools/check_conventions.py --base 3ce340bf7a` passes. - **Linux and Windows, by milescoviello** ([comment](https://github.com/boykopovar/AnyPS5/pull/13248#issuecomment-6778063749)), Release, GCC 15.2: - Ubuntu 26.04.1, RTX 4070 Ti (NVIDIA 615.71.09): head `bf30501d66` merged onto `main` `b8194198cf`; `agc_driver_cached_image_multisample_guard` passes 3 of 3. With only this PR's test file on `main` `b8194198cf`, it fails at `checking a compute storage image store over part of a 4x target` with `a cached image access of ... overlaps multisampled color target ... (4 samples), whose samples are only on the host`. - Windows 11 VM, GeForce GT 1030 (WinLibs GCC 15.2 UCRT): this head merged onto `main` `5546586fb1`; the test passes 3 of 3. `main` alone, with its own version of the test, passes 3 of 3 too. - **Windows, AMD driver, by Ethan-Hainline** ([comment](https://github.com/boykopovar/AnyPS5/pull/13248#issuecomment-6785214307)): head `bf30501d66` merged onto `main` `510d0bf986`, Windows 11 Pro, Radeon Vega iGPU (GCN, Ryzen 5 7530U), AMD driver 23.19.24.04, WinLibs GCC 16.2.0, Release, with the validation layer. `agc_driver_cached_image_multisample_guard` passes 3 of 3, the log has the store's claim of the 4x target, and no `VUID-` line. ### 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 - [x] Unimplemented paths throw - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source (none) - [x] Generic behaviour, not specific to one title - [x] Depends on: none (#8223 is merged). The overlap report now lists #10049 (`ShaderResources.hpp/.cpp`, `CachedImageMultisampleGuard.cpp`; it retires a target only when a store covers all of it, this PR claims it on any overlapping store, so the two would need reconciling) and #12745 (`ShaderResources.cpp`), and #7002, #9700, #10492 and #10497 for the debt file only. Whichever lands first, I'll rebase this PR over it. - [x] Fixes: none - [x] Unblocks: PPSA13960 past the autosave notice to the Menu Narration screen (12 of 14 runs; the other 2 stop on the follow-up above). PPSA01317 01.710.000 past the Licence Centre refusal (`a cached image access of 0x1238ba0000+0x1560000 overlaps multisampled color target 0x1238d30000+0x2d0000 (4 samples)`); its menu renders and the run stops later on #17251. That run was by freneza, with `88091bc014` on `main` 4977f64052 together with #10049 ([comment](https://github.com/boykopovar/AnyPS5/pull/13248#issuecomment-6724514647)). - [x] GPUs tested: AMD Radeon RX 9070 XT (RADV, Mesa 26.2.6), Linux. Others, from runs posted here: NVIDIA RTX 5070 (615.78.08), Linux (PPSA01317); NVIDIA laptop GPU (Turing, driver 621) and Intel iGPU (driver 101.70xx), Windows (`agc_driver_cached_image_multisample_guard`: fails without the change and passes with it on both); NVIDIA RTX 4070 Ti (615.71.09), Linux, and GeForce GT 1030, Windows 11 VM (the same test: fails without the change on Linux, passes with it on both); AMD Radeon Vega iGPU (GCN, driver 23.19.24.04), Windows 11 (the same test passes with the change). - [x] AI-assisted: yes
XairRrR commented 2026-11-02 21:05:24 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-02T21:05:24Z.

Review: APPROVED


Reviewed — approved

A storage image element that the binding records as stored now claims the multisampled color targets it overlaps, both in a fresh build and in Revalidate. The change builds, and the changed test passes here and fails against main's driver code.

What I ran

Head 11cfa16b5e4bd19714b154aa35f460e32eb3a4fa, main 9090972b7e91fd266819cbd77a8b058e177b5682, merged with --no-ff in a clean worktree. Machine: Debian 13 VM, GCC 14.2.0, Release, Ninja, lavapipe (Mesa 26.1.6, LLVM 19), no GPU.

git diff --check 9090972b7e91fd266819cbd77a8b058e177b5682...11cfa16b5e4bd19714b154aa35f460e32eb3a4fa
python3 tools/check_conventions.py --base 9090972b7e91fd266819cbd77a8b058e177b5682
ctest --test-dir build -j8 --test-load 32 --output-on-failure -R "cached_image_multisample_guard|multisample_retirement|multisample_srgb_twin|multisample_fill_host_only|sample_multisample_target|agc_multisample_guest_access"
ctest --test-dir build -V -R cached_image_multisample_guard
# negative control
git show 9090972b7e:<4 production files> > <path>
ninja -C build -j32 -l32 agc_driver_cached_image_multisample_guard_tests
ctest --test-dir build --output-on-failure -R cached_image_multisample_guard
git show 780aab9dc2:<4 production files> > <path>
ninja -C build -j32 -l32 agc_driver_cached_image_multisample_guard_tests
ctest --test-dir build -R cached_image_multisample_guard
git status --porcelain

Results

Check Result
git diff --check clean
check_conventions.py All conventions checks passed
Configure, build, libs (script) ok
Selected tests (script, 2038 run) no new failures, no timeouts. The 7 known failures (agc_driver_division, the denormal-mode tests, unwrap_self, vector_constant_factor_tininess) also fail on main
Validation layer (script, 757 tests, layer loaded in 756, missing in none) 0 tests with new VUID- lines compared with main
6 focused multisample tests 6/6 pass. The longest is agc_driver_sample_multisample_target at 8.2 s
agc_driver_cached_image_multisample_guard passes in 0.21 s. All 8 new CheckStoredImage cases run (compute and draw × store / read / unknown use / FMASK), and the claim line is printed 4 times
New cases in the changed test
[gpu] a single-sample storage image store to 0x7f1bdde9e000+0x4000 claims the memory of multisampled color target 0x7f1bddea0000+0x10000 (4 samples)
...
checking a compute storage image store over part of a 4x target
checking a compute storage image read over part of a 4x target
checking a compute storage image of unknown use over part of a 4x target
checking a compute storage image store over a one-fragment target's FMASK
checking a draw storage image store over part of a 4x target
checking a draw storage image read over part of a 4x target
checking a draw storage image of unknown use over part of a 4x target
checking a draw storage image store over a one-fragment target's FMASK
cached image multisample guard tests passed

Negative control

I restored MultisampleTarget.hpp, ShaderResources.hpp, MultisampleTarget.cpp and ShaderResources.cpp from main and kept the PR's test, then rebuilt. The test failed at the first new case:

Output
checking a compute storage image store over part of a 4x target
AGC graphics: a cached image access of 0x7fe6c461e000+0x4000 overlaps multisampled color target 0x7fe6c4620000+0x10000 (4 samples), whose samples are only on the host: guest access to it is not implemented
0% tests passed, 1 tests failed out of 1

This matches the negative controls JJenkx and jacknieland reported. After I restored the merged files and rebuilt, the test passes again and git status --porcelain is empty.

Findings

Blocking

None.

Non-blocking

  • Unblocks line has no Game bring-up discussion. CONTRIBUTING asks for the title ID together with its Game bring-up discussion (Unblocks: PPSA01325 #3232). The line names PPSA13960 but no discussion. Please add the discussion number if one exists.
  • A claim survives a build that is refused later. In core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp:5196 the claim is made before the element's own lookup and before the later bindings of the same set. If a later binding is refused (for example a read of a different, still-guarded range), the target is already claimed, and the next guarded access anywhere retires it. This is the same "a bind counts as reuse" trade-off as #8223, and the new debt entry covers the visible effect (a target sampled after the store loses its samples). I mention it so the reconciliation with #10049 that the description already plans can take it into account.

On the code itself:

  • The decode used in revalidateFull (DecodeTextureResource(*range.storedWords)) matches the build. record->resource comes from the same DecodeTextureResource(words) (ShaderResources.cpp:4972), and the stored mip already includes the dedupe mipOffset.
  • ClaimMultisampleTargetStore changes only the atomic claimed flag, under the shared lock. Retirement still happens under the unique lock in RequireNoMultisampleColorTarget.
  • k2DMsaa storage elements leave through the earlier continue at ShaderResources.cpp:5172-5187, so they never claim.

Not verified

  • No hardware GPU here: the tests ran only on lavapipe. Other people's comments cover RADV (RX 9070 XT), AMD Windows (RX 9070 XT, RX 6700 XT) and NVIDIA (RTX 2000 Ada Linux, GTX 1650 Windows).
  • The Assassin's Creed Mirage (PPSA13960) results: I launched no titles.
  • The epoch fast path of Revalidate (ShaderResources.cpp:3663-3678) skips both the claim and the guard, as it already did on main. No test here exercises a target guarded between two epoch-proved reuses.
  • The interaction with #10049 and #12745, which touch the same functions.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5743334017 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13248#pullrequestreview-5743334017). Originally posted by [XairRrR](https://github.com/XairRrR) on 2026-11-02T21:05:24Z. **Review:** APPROVED --- # Reviewed — approved A storage image element that the binding records as stored now claims the multisampled color targets it overlaps, both in a fresh build and in `Revalidate`. The change builds, and the changed test passes here and fails against `main`'s driver code. ## What I ran Head `11cfa16b5e4bd19714b154aa35f460e32eb3a4fa`, `main` `9090972b7e91fd266819cbd77a8b058e177b5682`, merged with `--no-ff` in a clean worktree. Machine: Debian 13 VM, GCC 14.2.0, Release, Ninja, lavapipe (Mesa 26.1.6, LLVM 19), no GPU. ``` git diff --check 9090972b7e91fd266819cbd77a8b058e177b5682...11cfa16b5e4bd19714b154aa35f460e32eb3a4fa python3 tools/check_conventions.py --base 9090972b7e91fd266819cbd77a8b058e177b5682 ctest --test-dir build -j8 --test-load 32 --output-on-failure -R "cached_image_multisample_guard|multisample_retirement|multisample_srgb_twin|multisample_fill_host_only|sample_multisample_target|agc_multisample_guest_access" ctest --test-dir build -V -R cached_image_multisample_guard # negative control git show 9090972b7e:<4 production files> > <path> ninja -C build -j32 -l32 agc_driver_cached_image_multisample_guard_tests ctest --test-dir build --output-on-failure -R cached_image_multisample_guard git show 780aab9dc2:<4 production files> > <path> ninja -C build -j32 -l32 agc_driver_cached_image_multisample_guard_tests ctest --test-dir build -R cached_image_multisample_guard git status --porcelain ``` ## Results | Check | Result | |---|---| | `git diff --check` | clean | | `check_conventions.py` | All conventions checks passed | | Configure, build, `libs` (script) | ok | | Selected tests (script, 2038 run) | no new failures, no timeouts. The 7 known failures (`agc_driver_division`, the denormal-mode tests, `unwrap_self`, `vector_constant_factor_tininess`) also fail on `main` | | Validation layer (script, 757 tests, layer loaded in 756, missing in none) | 0 tests with new `VUID-` lines compared with `main` | | 6 focused multisample tests | 6/6 pass. The longest is `agc_driver_sample_multisample_target` at 8.2 s | | `agc_driver_cached_image_multisample_guard` | passes in 0.21 s. All 8 new `CheckStoredImage` cases run (compute and draw × store / read / unknown use / FMASK), and the claim line is printed 4 times | <details><summary>New cases in the changed test</summary> ``` [gpu] a single-sample storage image store to 0x7f1bdde9e000+0x4000 claims the memory of multisampled color target 0x7f1bddea0000+0x10000 (4 samples) ... checking a compute storage image store over part of a 4x target checking a compute storage image read over part of a 4x target checking a compute storage image of unknown use over part of a 4x target checking a compute storage image store over a one-fragment target's FMASK checking a draw storage image store over part of a 4x target checking a draw storage image read over part of a 4x target checking a draw storage image of unknown use over part of a 4x target checking a draw storage image store over a one-fragment target's FMASK cached image multisample guard tests passed ``` </details> ## Negative control I restored `MultisampleTarget.hpp`, `ShaderResources.hpp`, `MultisampleTarget.cpp` and `ShaderResources.cpp` from `main` and kept the PR's test, then rebuilt. The test failed at the first new case: <details><summary>Output</summary> ``` checking a compute storage image store over part of a 4x target AGC graphics: a cached image access of 0x7fe6c461e000+0x4000 overlaps multisampled color target 0x7fe6c4620000+0x10000 (4 samples), whose samples are only on the host: guest access to it is not implemented 0% tests passed, 1 tests failed out of 1 ``` </details> This matches the negative controls JJenkx and jacknieland reported. After I restored the merged files and rebuilt, the test passes again and `git status --porcelain` is empty. ## Findings ### Blocking None. ### Non-blocking - **`Unblocks` line has no Game bring-up discussion.** CONTRIBUTING asks for the title ID together with its Game bring-up discussion (`Unblocks: PPSA01325 #3232`). The line names PPSA13960 but no discussion. Please add the discussion number if one exists. - **A claim survives a build that is refused later.** In `core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp:5196` the claim is made before the element's own lookup and before the later bindings of the same set. If a later binding is refused (for example a read of a different, still-guarded range), the target is already `claimed`, and the next guarded access anywhere retires it. This is the same "a bind counts as reuse" trade-off as #8223, and the new debt entry covers the visible effect (a target sampled after the store loses its samples). I mention it so the reconciliation with #10049 that the description already plans can take it into account. On the code itself: - The decode used in `revalidateFull` (`DecodeTextureResource(*range.storedWords)`) matches the build. `record->resource` comes from the same `DecodeTextureResource(words)` (`ShaderResources.cpp:4972`), and the stored `mip` already includes the dedupe `mipOffset`. - `ClaimMultisampleTargetStore` changes only the atomic `claimed` flag, under the shared lock. Retirement still happens under the unique lock in `RequireNoMultisampleColorTarget`. - `k2DMsaa` storage elements leave through the earlier `continue` at `ShaderResources.cpp:5172-5187`, so they never claim. ## Not verified - No hardware GPU here: the tests ran only on lavapipe. Other people's comments cover RADV (RX 9070 XT), AMD Windows (RX 9070 XT, RX 6700 XT) and NVIDIA (RTX 2000 Ada Linux, GTX 1650 Windows). - The Assassin's Creed Mirage (PPSA13960) results: I launched no titles. - The epoch fast path of `Revalidate` (`ShaderResources.cpp:3663-3678`) skips both the claim and the guard, as it already did on `main`. No test here exercises a target guarded between two epoch-proved reuses. - The interaction with #10049 and #12745, which touch the same functions. <!-- anyps5-bots job=1913 head=11cfa16b5e4bd19714b154aa35f460e32eb3a4fa -->
gabichuuuuu commented 2026-11-08 15:35:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by gabichuuuuu on 2026-11-08T15:35:53Z.

Review: COMMENTED


Ran 01ef7271b7 merged on main 302864d48c on Windows 11 x64 (WinLibs GCC 15.2), on an NVIDIA laptop GPU (Turing, driver 621) and an Intel iGPU (driver 101.70xx), with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1 and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation (Khronos validation layer 1.4.368), ctest -R '^agc_driver_cached_image_multisample_guard' -V:

main main + only this PR's CachedImageMultisampleGuard.cpp change, 2 runs each
NVIDIA passed failed passed
Intel passed failed passed
  • Without the driver change, the updated test fails on both GPUs with "a cached image access of … overlaps multisampled color target … (4 samples), whose samples are only on the host: guest access to it is not implemented". With the change, the overlapping single-sample store claims the target, and the test passes every time.
  • The test file hasn't changed on main since the branch point, so the middle column is the PR's own test on main's code.
  • The layer was inserted in the test. No log has was not found but was requested by env var VK_INSTANCE_LAYERS, and no log on either side has a VUID-. To be sure validation messages reach these logs, the same layer with best practices on printed 28 BestPractices- warnings into an agc_driver_recorder log on each GPU.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5818476690 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13248#pullrequestreview-5818476690). Originally posted by [gabichuuuuu](https://github.com/gabichuuuuu) on 2026-11-08T15:35:53Z. **Review:** COMMENTED --- Ran `01ef7271b7` merged on `main` 302864d48c on Windows 11 x64 (WinLibs GCC 15.2), on an NVIDIA laptop GPU (Turing, driver 621) and an Intel iGPU (driver 101.70xx), with `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1` and `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation` (Khronos validation layer 1.4.368), `ctest -R '^agc_driver_cached_image_multisample_guard' -V`: | | `main` | `main` + only this PR's `CachedImageMultisampleGuard.cpp` | change, 2 runs each | |---|---|---|---| | NVIDIA | passed | failed | passed | | Intel | passed | failed | passed | - Without the driver change, the updated test fails on both GPUs with "a cached image access of … overlaps multisampled color target … (4 samples), whose samples are only on the host: guest access to it is not implemented". With the change, the overlapping single-sample store claims the target, and the test passes every time. - The test file hasn't changed on `main` since the branch point, so the middle column is the PR's own test on `main`'s code. - The layer was inserted in the test. No log has `was not found but was requested by env var VK_INSTANCE_LAYERS`, and no log on either side has a `VUID-`. To be sure validation messages reach these logs, the same layer with best practices on printed 28 `BestPractices-` warnings into an `agc_driver_recorder` log on each GPU. AI-assisted: yes.
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!13248
No description provided.