fix(agc): retire a multisampled color target a write-only storage image overwrites #10049

Closed
frankea wants to merge 17 commits from upstream-pr/10049 into main
frankea commented 2026-10-23 06:30:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by frankea on 2026-10-23T06:30:03Z.


What

A multisampled color target keeps its samples on the host, so every guest access to its memory throws, and only an unmap or allocation removal that covers the target retires it (debt entry "Multisampled color targets"). A title that pools render target memory and reuses a resolved target's range for a compute shader's output stopped on that guard, even though the shader overwrites the memory and never reads it.

  • DescriptorBinding gains imageRead, an ElementFlags like main's other element flags, one entry per image element, from the resource tracker's per-image read flag (any image access other than a store, atomics included). Image table elements are marked read. The shader disk cache keeps it (format 69; main is at 68), and the binding grows from main's 864 bytes to 920. This is the image counterpart of bufferRead (2fb7a77ac), and the recompiler already uses written && !read the same way for storage images in ResourceMaterializer.
  • A storage image element the shader stores to and never loads from now passes its own guard for a target when the bytes of the level it writes (WrittenStorageBytes, the same whole-block ranges main uses to retire covered depth surfaces) cover the target's whole color range. The target is then retired with the unmap rule (retireCovered, shared with retireUnmapped), at the end of the resource build or of a successful Revalidate. Retiring last means every other access of the same dispatch or draw has already passed its own guard: a sampled read of the same memory still throws.
  • Still refused: an element that also loads from the image, a write that covers only part of the target, and every other access to the target's memory.
  • main's guards: since #9186 an overlapping range that is not host-only (a target made from a texture no draw rendered to) is retired on access and a host-only one is refused, since #8223 unless the title wrote over it or bound another target over it after its last use (canRetire), and since 9d6332386 a one-fragment target's FMASK is guarded as a range of its own. This PR's exemption is checked first: a range whose target's color plane the store covers is passed and left for the retirement at the end of the build, host-only or not. FMASK ranges have no color plane and are not exempt, so a store over a one-fragment target's FMASK is still refused with main's FMASK message.
  • The resource content key also packs imageRead, like imageWritten, and main's compact key for large image tables hashes it with the other flag vectors. The key's labeller (LabelShaderKey, used by the APS5_PROFILE_DRAW miss counts), the churn profiler's key walk (chargeShaderKey) and the KeyMiss test count all 11 flag vectors.
  • A new debt entry, "Multisampled color targets overwritten by storage stores", says when a storage write retires a target, that a one-fragment target's FMASK is not retired this way, and what is not exact: the covered bytes are the level's whole tile blocks, not the texels the shader writes, so where it leaves texels unwritten the console keeps the target's bytes and guest memory keeps what it held before the target.

Why: Gran Turismo 7 (PPSA01317) reuses the memory of the 4-sample EQAA target it draws while loading the World Map. After the CB resolve, compute shader 0x1258c1fd00 (8x8 threads, wave64) stores to three images from the table at user data words 2-3: 1920x1080 at 0x1238ba0000 (the target's base, 0x1238ba00 0xc4200000 0x010dc1df 0x91b00fac 0 0x00700000 0 0, 0xff0000 bytes), 1920x1080 at 0x1239b90000, and a one-channel image at 0x123ab80000. Each thread stores either zeros or texels it loads from three other images; it loads nothing from the three it stores to (replayed offline with agc_shader_replay --asm). The resource set was built before the target existed, so the run stopped in Revalidate: compute shader 0x1258c1fd00: AGC graphics: a cached image access of 0x1238ba0000+0xff0000 overlaps multisampled color target 0x1238ba0000+0x200000 (4 samples), whose samples are only on the host: guest access to it is not implemented.

Tested

  • Refreshed onto main a4ef806cd7 (merge 73b8218e12, head 9b94901b30; conflicts in ShaderResources.cpp, Recompiler.hpp and ShaderDiskCache.cpp/.hpp, resolved as described in the comments: imageRead is an ElementFlags, DescriptorBinding 920 bytes, format 69; 9b94901b30 makes chargeShaderKey count 11 flag vectors). The binding size was measured on the box's libstdc++ (MinGW GCC 15.2.0): 864 on main, 920 here. RTX 4090 (NVIDIA 616.92, Windows 11 build 26200), main a4ef806cd7 and 9b94901b30 built in the same tree:
    • Focused set, 284 ctest entries of the 28 targets below, --repeat until-fail:3: on both, the same 276 pass three times, the same 4 skip and the same 4 fail with the same messages: agc_driver_msaa_dcc_clear_2/4/8 (a same-value CPU color store did not invalidate multisampled DCC residency) and agc_driver_native_depth_publication (a native depth publication overwrote a byte the guest stored). agc_driver_cached_image_multisample_guard passes on both and runs 9 checks on this head against 5 on main (the four new CheckOverwrittenTarget cases: written 128x128, read and written 128x128, written 64x64, written 128x128 beside a sampled read).
    • Validation layer (Vulkan SDK 1.4.363.0, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, VK_LOADER_DEBUG=layer, ANYPS5_NO_SHADER_CACHE=1, ANYPS5_REQUIRE_VULKAN=1, ctest -V) on the same 284: the same results on both, 1400 Insert instance layer lines on each side, no VUID- line and no was not found but was requested by env var VK_INSTANCE_LAYERS, and the same warnings (27 Undefined-Value-ShaderOutputNotConsumed-DynamicRendering, 1 Undefined-Value-ShaderOutputNotConsumed).
    • ctest -R agc, 1575 entries: 1553 pass, 15 skip and 7 fail on both, the same tests: the 4 above plus agc_driver_image_plane_address_on_line (67.50 vs 60, the NVIDIA LOD blend) and agc_driver_image_sample_lod_clamp / agc_driver_image_sample_lod_clamp_shader_lane (2 vs 1).
  • The refreshes onto main 3cb1cd29ec and 7383be1a19 (6f8593891f, f5b27d4d89) ran only on an Apple M5 Max under Rosetta 2 and MoltenVK, as described in the 11/06 comment, and the one onto main 4138defef7 (18bda85904) only in CI. The RTX 4090 run above is the 4090 rerun promised on 11/06.
  • Refreshed onto main ee9a9a66c (d500cd1ed; main had taken disk cache format 50, the number this branch used, so the merge kept it without a conflict and 70150798a takes 52) and onto main b1b5353cf (head bff3f2a07; main's #6628 guarded-range generation now also counts this PR's retirement in retireCovered), RTX 4090 (NVIDIA 616.92, Windows 11), each test run three times: the 207 ctest entries of the focused set's executables pass 207/207 on bff3f2a07, and 207/207 under the validation layer (VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, VK_LOADER_DEBUG=layer, ANYPS5_NO_SHADER_CACHE=1, ANYPS5_REQUIRE_VULKAN=1, ctest -V): 895 Insert instance layer lines, no VUID- line, and the same warnings as main in every test. main b1b5353cf: 207/207 in both runs. The first merge (70150798a, main ee9a9a66c) gave the same result.
  • Refreshed onto main bb04a4f1e (head 3974b1292; the ShaderDiskCache conflict resolved to main's RecompileResult size 552, this PR's DescriptorBinding size 696 and format 50), RTX 4090, each test run three times: the 196 ctest entries of the focused set's executables pass 196/196, and 196/196 under the validation layer (VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, VK_LOADER_DEBUG=layer, ANYPS5_NO_SHADER_CACHE=1, ANYPS5_REQUIRE_VULKAN=1, ctest -V), with 875 Insert instance layer lines and no VUID- line or was not found but was requested by env var VK_INSTANCE_LAYERS. main bb04a4f1e gives the same in both runs. agc_host_import_cut_lifetime (#10746) passes on both now.
  • Refreshed onto main ca6e29e83 (head 6d3bc5e2a; the ShaderResources.cpp and debt-file conflicts resolved as described in the comments): of the 183 ctest entries of the focused set's executables, 182 pass, and the same 182 under the validation layer (same settings as below), where the loader inserted the layer and the log has no VUID- line or was not found but was requested by env var VK_INSTANCE_LAYERS. The one failure, agc_host_import_cut_lifetime (the larger side of an unmap of 1440 KiB at the start of the import's first 2 MiB run left the write watch), fails the same way on main ca6e29e83, which otherwise gives the same results in both runs.
  • Gran Turismo 7 (PPSA01317 01.710.000) on the RTX 4090, with this change on a local integration branch of main f894ba69d plus the pull requests the title needs before this stop (#7978, #7243, #7256, #7550, #8564, #9020, #9335, #9068, #9700, #9721, #9743, #9806, a local form of #9988) and local diagnostics. In runs um-4 and um-5, compute shader 0x1258c1fd00's store retires the EQAA target (its color and FMASK ranges, logged by a local print) and the World Map's main pass draws on. Both runs then stop on a line list drawn into a multisampled target without MSAA_ENABLE, which main draws since #8871; the integration branch predates it.

Windows 11 (build 26200), NVIDIA GeForce RTX 4090 (driver 616.92), MinGW GCC Release build with BUILD_TESTING=ON, all on one machine.

  • New cases in agc_driver_cached_image_multisample_guard (CheckOverwrittenTarget): a compute set built before a 4-sample 64x64 target appears at its memory, with one storage image element. A write-only 128x128 element (64 KiB, the target's whole guarded range) revalidates, retires the target, and a fresh build over a new target retires it too. A read-and-written element, a write-only 64x64 element (16 KiB of it) and a write-only element beside a sampled read of the same memory all still throw, in Revalidate and in a fresh build, and leave the target guarded.
  • agc_shader_disk_cache round-trips imageRead; agc_driver_graphics checks that the content key changes with the last imageRead bit; agc_driver_key_miss builds keys with 11 flag vectors.
  • Focused set: 82 ctest entries of 27 targets: the MSAA, CMASK, FMASK and journal tests of #9988's set, plus agc_shader_disk_cache, agc_driver_key_miss and the storage tests depth_storage, depth_storage_dispatch, depth_storage_reuse, storage_cache_budget, storage_flush_ordering, image_table_reuse and draw_cache_reuse.
  • This PR (177b85aa8 on main 0db47b263): 82/82 passed, each test run three times (ctest --repeat until-fail:3).
  • Control: the first commit alone with this PR's CachedImageMultisampleGuard.cpp, run before the branch moved to main 0db47b263 (951e93436 on main 9a030c2d5, the same change with cache format 45): the first new case fails with main's refusal, AGC graphics: a cached image access of 0x200000000+0x10000 overlaps multisampled color target 0x200000000+0x10000 (4 samples), whose samples are only on the host: guest access to it is not implemented.
  • Validation layer: VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation (Vulkan SDK 1.4.363.0), ANYPS5_NO_SHADER_CACHE=1 and ANYPS5_REQUIRE_VULKAN=1 with ctest -V, on main 0db47b263 (115/115, a set that includes these 82) and on this PR (82/82). Neither log has was not found but was requested by env var VK_INSTANCE_LAYERS, and neither has a VUID- line. Both have the same 16 Undefined-Value-ShaderOutputNotConsumed-DynamicRendering warnings, from tests in main.
  • After merging main 379b1dca3 (head 17b8f6682): the one code conflict, in DescriptorBindingBuilder.cpp, keeps this PR's imageRead.push_back(true) beside #8792's imageAtomic.push_back(element.atomic). The disk cache format moves to 48 in its own commit, since main's 46 line merged cleanly and the imageRead bits would otherwise have shipped under it. RTX 4090: the 85 ctest entries the same targets now select pass 85/85, three times each, and 85/85 under the validation layer with no VUID- line (the same 16 warnings, from tests in main). main 9c85790c9 passes the union of this run's sets, 109/109, under the same layer settings with no VUID- line.
  • After merging main 5b85225ef (807ec18eb) and the FMASK exclusion (8ea73d837), RTX 4090, each test run three times. The set is 178 ctest entries of 28 targets: the 27 above plus agc_driver_recorder_tests, which now checks in agc_multisample_guest_access that a write-only store over every byte of a one-fragment target's guarded FMASK is refused.
    • This PR (b4612f900, the same code before the new check's message was reworded): 177/178. 8ea73d837 reran agc_multisample_guest_access and agc_driver_cached_image_multisample_guard: 2/2.
    • main 5b85225ef: 177/178. The one failure on both is agc_host_import_cut_lifetime (the larger side of an unmap of 1440 KiB at the start of the import's first 2 MiB run left the write watch), #10746, which fails on main on every run here.
    • Control: this PR with the exemption switched off (overwrittenTarget returns false): agc_driver_cached_image_multisample_guard fails with main's refusal, a cached image access of 0x200000000+0x10000 overlaps multisampled color target 0x200000000+0x10000 (4 samples), whose samples are only on the host.
    • Control: the merge commit alone with the new check: agc_multisample_guest_access fails with a write-only storage store over every guarded byte of a host-drawn one-fragment target's FMASK did not throw.
    • Validation layer (VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, VK_LOADER_DEBUG=layer, ANYPS5_NO_SHADER_CACHE=1, ANYPS5_REQUIRE_VULKAN=1, ctest -V) on the 178 entries, on main 5b85225ef and on b4612f900: each log has 790 Insert instance layer lines, no VUID- line and no was not found but was requested by env var VK_INSTANCE_LAYERS; both fail only #10746's entry.
  • Not run on Linux, where the sizeof(DescriptorBinding) == 920 assert applies (main's 864 plus one ElementFlags, 56 bytes with libstdc++, the size the 4090 box's MinGW libstdc++ also gives). tools/check_conventions.py --base origin/main passes on 9b94901b30.

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 (#9020 has merged). Merge order with #15941 (EagleBearerYS), which also adds a parameter to RequireNoMultisampleTarget and changes the same storage-image call in ShaderResources.cpp: #15941 goes first, then this PR merges main and takes both parameters, DepthReadCause cause = DepthReadCause::Access before overwritten, with the storage-image call passing DepthReadCause::Reuse and its covered bytes.
  • Fixes: none
  • Unblocks: PPSA01317 #4697 (past this stop, to the line-list draw under Tested that main already draws)
  • GPUs tested: NVIDIA GeForce RTX 4090, driver 616.92, Windows 11 build 26200
  • AI-assisted: yes (Claude Code)
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4978819748 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10049). Originally posted by [frankea](https://github.com/frankea) on 2026-10-23T06:30:03Z. --- ### What A multisampled color target keeps its samples on the host, so every guest access to its memory throws, and only an unmap or allocation removal that covers the target retires it (debt entry "Multisampled color targets"). A title that pools render target memory and reuses a resolved target's range for a compute shader's output stopped on that guard, even though the shader overwrites the memory and never reads it. - `DescriptorBinding` gains `imageRead`, an `ElementFlags` like `main`'s other element flags, one entry per image element, from the resource tracker's per-image read flag (any image access other than a store, atomics included). Image table elements are marked read. The shader disk cache keeps it (format 69; `main` is at 68), and the binding grows from `main`'s 864 bytes to 920. This is the image counterpart of `bufferRead` (2fb7a77ac), and the recompiler already uses `written && !read` the same way for storage images in `ResourceMaterializer`. - A storage image element the shader stores to and never loads from now passes its own guard for a target when the bytes of the level it writes (`WrittenStorageBytes`, the same whole-block ranges main uses to retire covered depth surfaces) cover the target's whole color range. The target is then retired with the unmap rule (`retireCovered`, shared with `retireUnmapped`), at the end of the resource build or of a successful `Revalidate`. Retiring last means every other access of the same dispatch or draw has already passed its own guard: a sampled read of the same memory still throws. - Still refused: an element that also loads from the image, a write that covers only part of the target, and every other access to the target's memory. - `main`'s guards: since #9186 an overlapping range that is not host-only (a target made from a texture no draw rendered to) is retired on access and a host-only one is refused, since #8223 unless the title wrote over it or bound another target over it after its last use (`canRetire`), and since 9d6332386 a one-fragment target's FMASK is guarded as a range of its own. This PR's exemption is checked first: a range whose target's color plane the store covers is passed and left for the retirement at the end of the build, host-only or not. FMASK ranges have no color plane and are not exempt, so a store over a one-fragment target's FMASK is still refused with `main`'s FMASK message. - The resource content key also packs `imageRead`, like `imageWritten`, and `main`'s compact key for large image tables hashes it with the other flag vectors. The key's labeller (`LabelShaderKey`, used by the `APS5_PROFILE_DRAW` miss counts), the churn profiler's key walk (`chargeShaderKey`) and the `KeyMiss` test count all 11 flag vectors. - A new debt entry, "Multisampled color targets overwritten by storage stores", says when a storage write retires a target, that a one-fragment target's FMASK is not retired this way, and what is not exact: the covered bytes are the level's whole tile blocks, not the texels the shader writes, so where it leaves texels unwritten the console keeps the target's bytes and guest memory keeps what it held before the target. Why: Gran Turismo 7 (PPSA01317) reuses the memory of the 4-sample EQAA target it draws while loading the World Map. After the CB resolve, compute shader 0x1258c1fd00 (8x8 threads, wave64) stores to three images from the table at user data words 2-3: 1920x1080 at 0x1238ba0000 (the target's base, `0x1238ba00 0xc4200000 0x010dc1df 0x91b00fac 0 0x00700000 0 0`, 0xff0000 bytes), 1920x1080 at 0x1239b90000, and a one-channel image at 0x123ab80000. Each thread stores either zeros or texels it loads from three other images; it loads nothing from the three it stores to (replayed offline with `agc_shader_replay --asm`). The resource set was built before the target existed, so the run stopped in `Revalidate`: `compute shader 0x1258c1fd00: AGC graphics: a cached image access of 0x1238ba0000+0xff0000 overlaps multisampled color target 0x1238ba0000+0x200000 (4 samples), whose samples are only on the host: guest access to it is not implemented`. ### Tested - Refreshed onto `main` a4ef806cd7 (merge 73b8218e12, head 9b94901b30; conflicts in `ShaderResources.cpp`, `Recompiler.hpp` and `ShaderDiskCache.cpp`/`.hpp`, resolved as described in the comments: `imageRead` is an `ElementFlags`, `DescriptorBinding` 920 bytes, format 69; 9b94901b30 makes `chargeShaderKey` count 11 flag vectors). The binding size was measured on the box's libstdc++ (MinGW GCC 15.2.0): 864 on `main`, 920 here. RTX 4090 (NVIDIA 616.92, Windows 11 build 26200), `main` a4ef806cd7 and 9b94901b30 built in the same tree: - Focused set, 284 ctest entries of the 28 targets below, `--repeat until-fail:3`: on both, the same 276 pass three times, the same 4 skip and the same 4 fail with the same messages: `agc_driver_msaa_dcc_clear_2/4/8` (a same-value CPU color store did not invalidate multisampled DCC residency) and `agc_driver_native_depth_publication` (a native depth publication overwrote a byte the guest stored). `agc_driver_cached_image_multisample_guard` passes on both and runs 9 checks on this head against 5 on `main` (the four new `CheckOverwrittenTarget` cases: written 128x128, read and written 128x128, written 64x64, written 128x128 beside a sampled read). - Validation layer (Vulkan SDK 1.4.363.0, `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, `VK_LOADER_DEBUG=layer`, `ANYPS5_NO_SHADER_CACHE=1`, `ANYPS5_REQUIRE_VULKAN=1`, `ctest -V`) on the same 284: the same results on both, 1400 `Insert instance layer` lines on each side, no `VUID-` line and no `was not found but was requested by env var VK_INSTANCE_LAYERS`, and the same warnings (27 `Undefined-Value-ShaderOutputNotConsumed-DynamicRendering`, 1 `Undefined-Value-ShaderOutputNotConsumed`). - `ctest -R agc`, 1575 entries: 1553 pass, 15 skip and 7 fail on both, the same tests: the 4 above plus `agc_driver_image_plane_address_on_line` (67.50 vs 60, the NVIDIA LOD blend) and `agc_driver_image_sample_lod_clamp` / `agc_driver_image_sample_lod_clamp_shader_lane` (2 vs 1). - The refreshes onto `main` 3cb1cd29ec and 7383be1a19 (6f8593891f, f5b27d4d89) ran only on an Apple M5 Max under Rosetta 2 and MoltenVK, as described in the 11/06 comment, and the one onto `main` 4138defef7 (18bda85904) only in CI. The RTX 4090 run above is the 4090 rerun promised on 11/06. - Refreshed onto `main` ee9a9a66c (d500cd1ed; `main` had taken disk cache format 50, the number this branch used, so the merge kept it without a conflict and 70150798a takes 52) and onto `main` b1b5353cf (head bff3f2a07; `main`'s #6628 guarded-range generation now also counts this PR's retirement in `retireCovered`), RTX 4090 (NVIDIA 616.92, Windows 11), each test run three times: the 207 ctest entries of the focused set's executables pass 207/207 on bff3f2a07, and 207/207 under the validation layer (`VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, `VK_LOADER_DEBUG=layer`, `ANYPS5_NO_SHADER_CACHE=1`, `ANYPS5_REQUIRE_VULKAN=1`, `ctest -V`): 895 `Insert instance layer` lines, no `VUID-` line, and the same warnings as `main` in every test. `main` b1b5353cf: 207/207 in both runs. The first merge (70150798a, `main` ee9a9a66c) gave the same result. - Refreshed onto `main` bb04a4f1e (head 3974b1292; the `ShaderDiskCache` conflict resolved to `main`'s `RecompileResult` size 552, this PR's `DescriptorBinding` size 696 and format 50), RTX 4090, each test run three times: the 196 ctest entries of the focused set's executables pass 196/196, and 196/196 under the validation layer (`VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, `VK_LOADER_DEBUG=layer`, `ANYPS5_NO_SHADER_CACHE=1`, `ANYPS5_REQUIRE_VULKAN=1`, `ctest -V`), with 875 `Insert instance layer` lines and no `VUID-` line or `was not found but was requested by env var VK_INSTANCE_LAYERS`. `main` bb04a4f1e gives the same in both runs. `agc_host_import_cut_lifetime` (#10746) passes on both now. - Refreshed onto `main` ca6e29e83 (head 6d3bc5e2a; the `ShaderResources.cpp` and debt-file conflicts resolved as described in the comments): of the 183 ctest entries of the focused set's executables, 182 pass, and the same 182 under the validation layer (same settings as below), where the loader inserted the layer and the log has no `VUID-` line or `was not found but was requested by env var VK_INSTANCE_LAYERS`. The one failure, `agc_host_import_cut_lifetime` (`the larger side of an unmap of 1440 KiB at the start of the import's first 2 MiB run left the write watch`), fails the same way on `main` ca6e29e83, which otherwise gives the same results in both runs. - Gran Turismo 7 (PPSA01317 01.710.000) on the RTX 4090, with this change on a local integration branch of `main` f894ba69d plus the pull requests the title needs before this stop (#7978, #7243, #7256, #7550, #8564, #9020, #9335, #9068, #9700, #9721, #9743, #9806, a local form of #9988) and local diagnostics. In runs um-4 and um-5, compute shader 0x1258c1fd00's store retires the EQAA target (its color and FMASK ranges, logged by a local print) and the World Map's main pass draws on. Both runs then stop on a line list drawn into a multisampled target without `MSAA_ENABLE`, which `main` draws since #8871; the integration branch predates it. Windows 11 (build 26200), NVIDIA GeForce RTX 4090 (driver 616.92), MinGW GCC Release build with `BUILD_TESTING=ON`, all on one machine. - New cases in `agc_driver_cached_image_multisample_guard` (`CheckOverwrittenTarget`): a compute set built before a 4-sample 64x64 target appears at its memory, with one storage image element. A write-only 128x128 element (64 KiB, the target's whole guarded range) revalidates, retires the target, and a fresh build over a new target retires it too. A read-and-written element, a write-only 64x64 element (16 KiB of it) and a write-only element beside a sampled read of the same memory all still throw, in `Revalidate` and in a fresh build, and leave the target guarded. - `agc_shader_disk_cache` round-trips `imageRead`; `agc_driver_graphics` checks that the content key changes with the last `imageRead` bit; `agc_driver_key_miss` builds keys with 11 flag vectors. - Focused set: 82 ctest entries of 27 targets: the MSAA, CMASK, FMASK and journal tests of #9988's set, plus `agc_shader_disk_cache`, `agc_driver_key_miss` and the storage tests `depth_storage`, `depth_storage_dispatch`, `depth_storage_reuse`, `storage_cache_budget`, `storage_flush_ordering`, `image_table_reuse` and `draw_cache_reuse`. - This PR (177b85aa8 on `main` 0db47b263): 82/82 passed, each test run three times (`ctest --repeat until-fail:3`). - Control: the first commit alone with this PR's `CachedImageMultisampleGuard.cpp`, run before the branch moved to `main` 0db47b263 (951e93436 on `main` 9a030c2d5, the same change with cache format 45): the first new case fails with `main`'s refusal, `AGC graphics: a cached image access of 0x200000000+0x10000 overlaps multisampled color target 0x200000000+0x10000 (4 samples), whose samples are only on the host: guest access to it is not implemented`. - Validation layer: `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation` (Vulkan SDK 1.4.363.0), `ANYPS5_NO_SHADER_CACHE=1` and `ANYPS5_REQUIRE_VULKAN=1` with `ctest -V`, on `main` 0db47b263 (115/115, a set that includes these 82) and on this PR (82/82). Neither log has `was not found but was requested by env var VK_INSTANCE_LAYERS`, and neither has a `VUID-` line. Both have the same 16 `Undefined-Value-ShaderOutputNotConsumed-DynamicRendering` warnings, from tests in `main`. - After merging `main` 379b1dca3 (head 17b8f6682): the one code conflict, in `DescriptorBindingBuilder.cpp`, keeps this PR's `imageRead.push_back(true)` beside #8792's `imageAtomic.push_back(element.atomic)`. The disk cache format moves to 48 in its own commit, since `main`'s 46 line merged cleanly and the `imageRead` bits would otherwise have shipped under it. RTX 4090: the 85 ctest entries the same targets now select pass 85/85, three times each, and 85/85 under the validation layer with no `VUID-` line (the same 16 warnings, from tests in `main`). `main` 9c85790c9 passes the union of this run's sets, 109/109, under the same layer settings with no `VUID-` line. - After merging `main` 5b85225ef (807ec18eb) and the FMASK exclusion (8ea73d837), RTX 4090, each test run three times. The set is 178 ctest entries of 28 targets: the 27 above plus `agc_driver_recorder_tests`, which now checks in `agc_multisample_guest_access` that a write-only store over every byte of a one-fragment target's guarded FMASK is refused. - This PR (b4612f900, the same code before the new check's message was reworded): 177/178. 8ea73d837 reran `agc_multisample_guest_access` and `agc_driver_cached_image_multisample_guard`: 2/2. - `main` 5b85225ef: 177/178. The one failure on both is `agc_host_import_cut_lifetime` (`the larger side of an unmap of 1440 KiB at the start of the import's first 2 MiB run left the write watch`), #10746, which fails on `main` on every run here. - Control: this PR with the exemption switched off (`overwrittenTarget` returns false): `agc_driver_cached_image_multisample_guard` fails with `main`'s refusal, `a cached image access of 0x200000000+0x10000 overlaps multisampled color target 0x200000000+0x10000 (4 samples), whose samples are only on the host`. - Control: the merge commit alone with the new check: `agc_multisample_guest_access` fails with `a write-only storage store over every guarded byte of a host-drawn one-fragment target's FMASK did not throw`. - Validation layer (`VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, `VK_LOADER_DEBUG=layer`, `ANYPS5_NO_SHADER_CACHE=1`, `ANYPS5_REQUIRE_VULKAN=1`, `ctest -V`) on the 178 entries, on `main` 5b85225ef and on b4612f900: each log has 790 `Insert instance layer` lines, no `VUID-` line and no `was not found but was requested by env var VK_INSTANCE_LAYERS`; both fail only #10746's entry. - Not run on Linux, where the `sizeof(DescriptorBinding) == 920` assert applies (`main`'s 864 plus one `ElementFlags`, 56 bytes with libstdc++, the size the 4090 box's MinGW libstdc++ also gives). `tools/check_conventions.py --base origin/main` passes on 9b94901b30. ### 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 (#9020 has merged). Merge order with #15941 (EagleBearerYS), which also adds a parameter to `RequireNoMultisampleTarget` and changes the same storage-image call in `ShaderResources.cpp`: #15941 goes first, then this PR merges `main` and takes both parameters, `DepthReadCause cause = DepthReadCause::Access` before `overwritten`, with the storage-image call passing `DepthReadCause::Reuse` and its covered bytes. - [x] Fixes: none - [x] Unblocks: PPSA01317 #4697 (past this stop, to the line-list draw under Tested that `main` already draws) - [x] GPUs tested: NVIDIA GeForce RTX 4090, driver 616.92, Windows 11 build 26200 - [x] AI-assisted: yes (Claude Code)
XairRrR commented 2026-11-02 22:49:37 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-02T22:49:37Z.

Review: CHANGES_REQUESTED


Reviewed — changes requested

This pull request does not merge cleanly into main (5cb015caaa): head bff3f2a078 conflicts in

  • core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp
  • core/shader/recompiler/ShaderDiskCache.cpp
  • core/shader/recompiler/ShaderDiskCache.hpp

Please rebase it onto current main. I will review the change once it merges cleanly.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5744540140 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10049#pullrequestreview-5744540140). Originally posted by [XairRrR](https://github.com/XairRrR) on 2026-11-02T22:49:37Z. **Review:** CHANGES_REQUESTED --- # Reviewed — changes requested This pull request does not merge cleanly into `main` (5cb015caaaaf83f8ee431414ee6a457b5b307d49): head bff3f2a078d71a9a6bace661a13e7e31a77204b5 conflicts in - `core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp` - `core/shader/recompiler/ShaderDiskCache.cpp` - `core/shader/recompiler/ShaderDiskCache.hpp` Please rebase it onto current `main`. I will review the change once it merges cleanly. <!-- anyps5-bots job=2248 head=bff3f2a078d71a9a6bace661a13e7e31a77204b5 -->

Pull request closed

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!10049
No description provided.