feat(agc): write a multisampled color target through a storage image #5881

Merged
codingreapermaps merged 2 commits from upstream-pr/5881 into main 2026-10-16 19:05:26 +00:00
codingreapermaps commented 2026-10-14 14:39:56 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by codingreapermaps on 2026-10-14T14:39:56Z.


What

A program that stores to a 2D multisampled texture (T# type 14) stopped with storage image access to a multisampled texture is not implemented. PPSA12361 (Transport Fever 2: Console Edition) clears its multisampled color target from a compute program that way when a map loads.

  • A storage binding of a 2D multisampled T# now resolves to a storage view of the host multisampled color target at its address (MultisampleTargetStorageView). It requires the same format, size and sample count, as the sampled lookup of #4820 does. The program's stores reach the target's samples directly; nothing goes through guest memory.
  • Storage usage is added lazily. A multisampled target is created with the flags it has on main, plus TRANSFER_SRC. The first storage binding that resolves to it moves it to a new image with VK_IMAGE_USAGE_STORAGE_BIT, and with MUTABLE_FORMAT/EXTENDED_USAGE only when the storage format differs from the attachment format. Its samples are copied once with vkCmdCopyImage. The previous image, memory and view are kept until the target is released, so a cached framebuffer that names the old view stays valid. Targets nothing stores to keep their image and flags.
  • The storage image needs the device's shaderStorageImageMultisample feature, which now reaches Context, and the combined usage at the target's sample count, checked with vkGetPhysicalDeviceImageFormatProperties. Without either, a store throws.
  • A surface no draw rendered to is created the way #5445 creates it for sampling (createFilled): only when its color memory repeats one 32-bit value, cleared to that value. Other color memory, unmodeled footprints and values without an exact clear color still throw, now saying "writing" instead of "sampling".
  • A draw or sample after the stores waits for them (SettleStorageWrites). A target created from a T# takes the CMASK of the first draw that renders to it, instead of failing CheckAddress because it was created without one.
  • These still throw: storage atomics on a multisampled texture, a storage view in another format than the target's storage format, a target with a CMASK fast clear no draw has applied, and stores outside a recorded dispatch.

#4820 and #5445, which this PR built on, are merged; the branch is one commit on main.

Tested

Windows 11, MinGW-w64 GCC 15.2.0, NVIDIA GeForce MX450 (driver 581.83) and lavapipe (Mesa 26.2.4, mesa-dist-win).

  • agc_driver_sample_multisample_target_tests, extended with three cases:
    • a compute program stores a color into sample 1 of every pixel of the drawn 4x RGBA16F target; loading every sample back finds the color in sample 1 and the drawn triangle unchanged in samples 0, 2 and 3;
    • stores into samples 1 to 3 of the left half of a surface no draw rendered to, whose color memory is zero, are found there, and every other sample loads zero;
    • a store into a surface no draw rendered to whose color memory is not uniform is refused.
  • agc_driver_recorder_tests --multisample-only: a target nothing stored to has no storage usage, also after it is sampled. A storage binding moves it to an image with storage usage and a new view. Without the feature the store is refused. This replaces the check on main that expected the store to be refused.
  • Rebased on main at 44df21632: both tests pass on NVIDIA. The full agc_driver_recorder_tests stops at (9) a scan under a pending write was kept (Recorder.cpp:1332) on this machine, also on plain main at the same commit.
  • Before the rebase, on #5445's head without this commit, the test stops with storage image access to a multisampled texture is not implemented. With it, the suite passes twice in a row on NVIDIA and on lavapipe. agc_driver_graphics_tests passes.
  • PPSA12361: on main it stops with the error above while a map loads. On a local branch with this change, #5445, #4820 and the other changes the title still needs, the map loads and renders, and the camera moves. No store was refused: the surface the compute program clears held uniform color memory.

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 (#4820 and #5445 are merged)
  • Unblocks: PPSA12361 (no Game bring-up discussion yet)
  • GPUs tested: NVIDIA GeForce MX450, driver 581.83, Windows 11; lavapipe (Mesa 26.2.4), Windows 11
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4859598850 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5881). Originally posted by [codingreapermaps](https://github.com/codingreapermaps) on 2026-10-14T14:39:56Z. --- ### What A program that stores to a 2D multisampled texture (T# type 14) stopped with `storage image access to a multisampled texture is not implemented`. PPSA12361 (Transport Fever 2: Console Edition) clears its multisampled color target from a compute program that way when a map loads. - A storage binding of a 2D multisampled T# now resolves to a storage view of the host multisampled color target at its address (`MultisampleTargetStorageView`). It requires the same format, size and sample count, as the sampled lookup of #4820 does. The program's stores reach the target's samples directly; nothing goes through guest memory. - Storage usage is added lazily. A multisampled target is created with the flags it has on `main`, plus `TRANSFER_SRC`. The first storage binding that resolves to it moves it to a new image with `VK_IMAGE_USAGE_STORAGE_BIT`, and with `MUTABLE_FORMAT`/`EXTENDED_USAGE` only when the storage format differs from the attachment format. Its samples are copied once with `vkCmdCopyImage`. The previous image, memory and view are kept until the target is released, so a cached framebuffer that names the old view stays valid. Targets nothing stores to keep their image and flags. - The storage image needs the device's `shaderStorageImageMultisample` feature, which now reaches `Context`, and the combined usage at the target's sample count, checked with `vkGetPhysicalDeviceImageFormatProperties`. Without either, a store throws. - A surface no draw rendered to is created the way #5445 creates it for sampling (`createFilled`): only when its color memory repeats one 32-bit value, cleared to that value. Other color memory, unmodeled footprints and values without an exact clear color still throw, now saying "writing" instead of "sampling". - A draw or sample after the stores waits for them (`SettleStorageWrites`). A target created from a T# takes the CMASK of the first draw that renders to it, instead of failing `CheckAddress` because it was created without one. - These still throw: storage atomics on a multisampled texture, a storage view in another format than the target's storage format, a target with a CMASK fast clear no draw has applied, and stores outside a recorded dispatch. #4820 and #5445, which this PR built on, are merged; the branch is one commit on `main`. ### Tested Windows 11, MinGW-w64 GCC 15.2.0, NVIDIA GeForce MX450 (driver 581.83) and lavapipe (Mesa 26.2.4, mesa-dist-win). - `agc_driver_sample_multisample_target_tests`, extended with three cases: - a compute program stores a color into sample 1 of every pixel of the drawn 4x RGBA16F target; loading every sample back finds the color in sample 1 and the drawn triangle unchanged in samples 0, 2 and 3; - stores into samples 1 to 3 of the left half of a surface no draw rendered to, whose color memory is zero, are found there, and every other sample loads zero; - a store into a surface no draw rendered to whose color memory is not uniform is refused. - `agc_driver_recorder_tests --multisample-only`: a target nothing stored to has no storage usage, also after it is sampled. A storage binding moves it to an image with storage usage and a new view. Without the feature the store is refused. This replaces the check on `main` that expected the store to be refused. - Rebased on `main` at `44df21632`: both tests pass on NVIDIA. The full `agc_driver_recorder_tests` stops at `(9) a scan under a pending write was kept` (`Recorder.cpp:1332`) on this machine, also on plain `main` at the same commit. - Before the rebase, on #5445's head without this commit, the test stops with `storage image access to a multisampled texture is not implemented`. With it, the suite passes twice in a row on NVIDIA and on lavapipe. `agc_driver_graphics_tests` passes. - PPSA12361: on `main` it stops with the error above while a map loads. On a local branch with this change, #5445, #4820 and the other changes the title still needs, the map loads and renders, and the camera moves. No store was refused: the surface the compute program clears held uniform color memory. ### 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 (#4820 and #5445 are merged) - [x] Unblocks: PPSA12361 (no Game bring-up discussion yet) - [x] GPUs tested: NVIDIA GeForce MX450, driver 581.83, Windows 11; lavapipe (Mesa 26.2.4), Windows 11 - [x] AI-assisted: yes
CnRJay commented 2026-10-14 17:19:19 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by CnRJay on 2026-10-14T17:19:19Z.

Review: COMMENTED


Resolving the store to the host multisampled target, so nothing goes through guest memory, is the right model for a compute clear. The vkGetPhysicalDeviceImageFormatProperties check before adding the usage is careful.

My concern is cost on every title that renders MSAA, not only Transport Fever 2. In MultisampleTarget's constructor, VK_IMAGE_USAGE_STORAGE_BIT is added to every multisampled color target whose format the device can store at that sample count. MUTABLE_FORMAT_BIT | EXTENDED_USAGE_BIT is added as well whenever the storage format differs from the attachment format. This happens at creation, before anything is known to store to the target. Drivers commonly drop color compression for images created with storage usage or a mutable format: RADV on several GFX levels skips DCC for storage-capable or mutable images whose formats aren't DCC-compatible, and other vendors make similar choices. For MSAA targets that means more bandwidth on every draw and every resolve. The effect wouldn't show in this PR's tests, only as a lower frame rate in MSAA-heavy scenes.

Two ways to keep the default path unchanged:

  • Create the storage-capable image only on first use. When a storage binding first resolves to a target created without the usage, recreate (or alias) it with storage usage, copying the samples once. Targets that are never stored to keep their current flags.
  • Or measure it. A before/after aps5-summary.jsonl pair from an MSAA title that never stores to its targets, on AMD and NVIDIA, would show whether any driver here actually loses compression.

A smaller point: the image also gains SAMPLED_BIT whenever that is supported. If that comes from #4820/#5445, it's outside this PR's own commit. Otherwise it has the same compression question.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5521843376 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5881#pullrequestreview-5521843376). Originally posted by [CnRJay](https://github.com/CnRJay) on 2026-10-14T17:19:19Z. **Review:** COMMENTED --- Resolving the store to the host multisampled target, so nothing goes through guest memory, is the right model for a compute clear. The `vkGetPhysicalDeviceImageFormatProperties` check before adding the usage is careful. My concern is cost on every title that renders MSAA, not only Transport Fever 2. In `MultisampleTarget`'s constructor, `VK_IMAGE_USAGE_STORAGE_BIT` is added to *every* multisampled color target whose format the device can store at that sample count. `MUTABLE_FORMAT_BIT | EXTENDED_USAGE_BIT` is added as well whenever the storage format differs from the attachment format. This happens at creation, before anything is known to store to the target. Drivers commonly drop color compression for images created with storage usage or a mutable format: RADV on several GFX levels skips DCC for storage-capable or mutable images whose formats aren't DCC-compatible, and other vendors make similar choices. For MSAA targets that means more bandwidth on every draw and every resolve. The effect wouldn't show in this PR's tests, only as a lower frame rate in MSAA-heavy scenes. Two ways to keep the default path unchanged: - **Create the storage-capable image only on first use.** When a storage binding first resolves to a target created without the usage, recreate (or alias) it with storage usage, copying the samples once. Targets that are never stored to keep their current flags. - **Or measure it.** A before/after `aps5-summary.jsonl` pair from an MSAA title that never stores to its targets, on AMD and NVIDIA, would show whether any driver here actually loses compression. A smaller point: the image also gains `SAMPLED_BIT` whenever that is supported. If that comes from #4820/#5445, it's outside this PR's own commit. Otherwise it has the same compression question.
github-actions[bot] commented 2026-10-15 12:11:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-15T12:11:02Z.


Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 5939 core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp L92-107, L190-191, L335-336
PR 5987 core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp L85-86
PR 6215 core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp L92-107, L113-116, L133, L190-191, L278-279, L335-336
PR 6297 core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp L187, L336
core/libs/prx/libSceAgcDriver/tests/execution/SampleMultisampleTarget.cpp L220-221, L343
PR 6553 core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp L85-86
PR 6628 core/libs/prx/libSceAgcDriver/tests/execution/SampleMultisampleTarget.cpp L72, L343
PR 6635 core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp L128-129, L190-191, L481
core/libs/prx/libSceAgcDriver/tests/execution/SampleMultisampleTarget.cpp L72, L202, L208, L220-221
PR 6683 core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp L61, L65-66, L68, L91-107, L128, L195-198
PR 6808 core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp L187, L336
core/libs/prx/libSceAgcDriver/tests/execution/SampleMultisampleTarget.cpp L220-221, L343
PR 6869 core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp L92-107, L190-191, L335-336

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 1368 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 1395 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 1896 core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp
core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 4040 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 4072 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp
PR 4448 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 4472 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp
PR 4650 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 4891 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 5021 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 5431 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 5441 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 5480 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 5609 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 5761 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 5925 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 6038 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 6177 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 6188 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 6208 core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6222 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 6259 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
PR 6262 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp
PR 6292 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6312 core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 6320 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6373 core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 6412 core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 6473 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6481 core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp
core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6486 core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 6539 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6615 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6718 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp
core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6191729253 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5881#issuecomment-6191729253). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-15T12:11:02Z. --- <!-- pr-overlap --> Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in **Depends on**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | [PR 5939](https://www.github.com/boykopovar/AnyPS5/pull/5939) | `core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp` [L92-107](https://github.com/boykopovar/AnyPS5/blob/c84249186528cf14356f9fee51022c3f165ff262/core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp#L92-L107), [L190-191](https://github.com/boykopovar/AnyPS5/blob/c84249186528cf14356f9fee51022c3f165ff262/core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp#L190-L191), [L335-336](https://github.com/boykopovar/AnyPS5/blob/c84249186528cf14356f9fee51022c3f165ff262/core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp#L335-L336) | | | | [PR 5987](https://www.github.com/boykopovar/AnyPS5/pull/5987) | `core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp` [L85-86](https://github.com/boykopovar/AnyPS5/blob/c84249186528cf14356f9fee51022c3f165ff262/core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp#L85-L86) | | | | [PR 6215](https://www.github.com/boykopovar/AnyPS5/pull/6215) | `core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp` [L92-107](https://github.com/boykopovar/AnyPS5/blob/c84249186528cf14356f9fee51022c3f165ff262/core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp#L92-L107), [L113-116](https://github.com/boykopovar/AnyPS5/blob/c84249186528cf14356f9fee51022c3f165ff262/core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp#L113-L116), [L133](https://github.com/boykopovar/AnyPS5/blob/c84249186528cf14356f9fee51022c3f165ff262/core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp#L133), [L190-191](https://github.com/boykopovar/AnyPS5/blob/c84249186528cf14356f9fee51022c3f165ff262/core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp#L190-L191), [L278-279](https://github.com/boykopovar/AnyPS5/blob/c84249186528cf14356f9fee51022c3f165ff262/core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp#L278-L279), [L335-336](https://github.com/boykopovar/AnyPS5/blob/c84249186528cf14356f9fee51022c3f165ff262/core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp#L335-L336) | | | | [PR 6297](https://www.github.com/boykopovar/AnyPS5/pull/6297) | `core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp` [L187](https://github.com/boykopovar/AnyPS5/blob/c84249186528cf14356f9fee51022c3f165ff262/core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp#L187), [L336](https://github.com/boykopovar/AnyPS5/blob/c84249186528cf14356f9fee51022c3f165ff262/core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp#L336)<br>`core/libs/prx/libSceAgcDriver/tests/execution/SampleMultisampleTarget.cpp` [L220-221](https://github.com/boykopovar/AnyPS5/blob/c84249186528cf14356f9fee51022c3f165ff262/core/libs/prx/libSceAgcDriver/tests/execution/SampleMultisampleTarget.cpp#L220-L221), [L343](https://github.com/boykopovar/AnyPS5/blob/c84249186528cf14356f9fee51022c3f165ff262/core/libs/prx/libSceAgcDriver/tests/execution/SampleMultisampleTarget.cpp#L343) | | | | [PR 6553](https://www.github.com/boykopovar/AnyPS5/pull/6553) | `core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp` [L85-86](https://github.com/boykopovar/AnyPS5/blob/c84249186528cf14356f9fee51022c3f165ff262/core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp#L85-L86) | | | | [PR 6628](https://www.github.com/boykopovar/AnyPS5/pull/6628) | `core/libs/prx/libSceAgcDriver/tests/execution/SampleMultisampleTarget.cpp` [L72](https://github.com/boykopovar/AnyPS5/blob/c84249186528cf14356f9fee51022c3f165ff262/core/libs/prx/libSceAgcDriver/tests/execution/SampleMultisampleTarget.cpp#L72), [L343](https://github.com/boykopovar/AnyPS5/blob/c84249186528cf14356f9fee51022c3f165ff262/core/libs/prx/libSceAgcDriver/tests/execution/SampleMultisampleTarget.cpp#L343) | | | | [PR 6635](https://www.github.com/boykopovar/AnyPS5/pull/6635) | `core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp` [L128-129](https://github.com/boykopovar/AnyPS5/blob/c84249186528cf14356f9fee51022c3f165ff262/core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp#L128-L129), [L190-191](https://github.com/boykopovar/AnyPS5/blob/c84249186528cf14356f9fee51022c3f165ff262/core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp#L190-L191), [L481](https://github.com/boykopovar/AnyPS5/blob/c84249186528cf14356f9fee51022c3f165ff262/core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp#L481)<br>`core/libs/prx/libSceAgcDriver/tests/execution/SampleMultisampleTarget.cpp` [L72](https://github.com/boykopovar/AnyPS5/blob/c84249186528cf14356f9fee51022c3f165ff262/core/libs/prx/libSceAgcDriver/tests/execution/SampleMultisampleTarget.cpp#L72), [L202](https://github.com/boykopovar/AnyPS5/blob/c84249186528cf14356f9fee51022c3f165ff262/core/libs/prx/libSceAgcDriver/tests/execution/SampleMultisampleTarget.cpp#L202), [L208](https://github.com/boykopovar/AnyPS5/blob/c84249186528cf14356f9fee51022c3f165ff262/core/libs/prx/libSceAgcDriver/tests/execution/SampleMultisampleTarget.cpp#L208), [L220-221](https://github.com/boykopovar/AnyPS5/blob/c84249186528cf14356f9fee51022c3f165ff262/core/libs/prx/libSceAgcDriver/tests/execution/SampleMultisampleTarget.cpp#L220-L221) | | | | [PR 6683](https://www.github.com/boykopovar/AnyPS5/pull/6683) | `core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp` [L61](https://github.com/boykopovar/AnyPS5/blob/c84249186528cf14356f9fee51022c3f165ff262/core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp#L61), [L65-66](https://github.com/boykopovar/AnyPS5/blob/c84249186528cf14356f9fee51022c3f165ff262/core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp#L65-L66), [L68](https://github.com/boykopovar/AnyPS5/blob/c84249186528cf14356f9fee51022c3f165ff262/core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp#L68), [L91-107](https://github.com/boykopovar/AnyPS5/blob/c84249186528cf14356f9fee51022c3f165ff262/core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp#L91-L107), [L128](https://github.com/boykopovar/AnyPS5/blob/c84249186528cf14356f9fee51022c3f165ff262/core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp#L128), [L195-198](https://github.com/boykopovar/AnyPS5/blob/c84249186528cf14356f9fee51022c3f165ff262/core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp#L195-L198) | | | | [PR 6808](https://www.github.com/boykopovar/AnyPS5/pull/6808) | `core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp` [L187](https://github.com/boykopovar/AnyPS5/blob/c84249186528cf14356f9fee51022c3f165ff262/core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp#L187), [L336](https://github.com/boykopovar/AnyPS5/blob/c84249186528cf14356f9fee51022c3f165ff262/core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp#L336)<br>`core/libs/prx/libSceAgcDriver/tests/execution/SampleMultisampleTarget.cpp` [L220-221](https://github.com/boykopovar/AnyPS5/blob/c84249186528cf14356f9fee51022c3f165ff262/core/libs/prx/libSceAgcDriver/tests/execution/SampleMultisampleTarget.cpp#L220-L221), [L343](https://github.com/boykopovar/AnyPS5/blob/c84249186528cf14356f9fee51022c3f165ff262/core/libs/prx/libSceAgcDriver/tests/execution/SampleMultisampleTarget.cpp#L343) | | | | [PR 6869](https://www.github.com/boykopovar/AnyPS5/pull/6869) | `core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp` [L92-107](https://github.com/boykopovar/AnyPS5/blob/c84249186528cf14356f9fee51022c3f165ff262/core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp#L92-L107), [L190-191](https://github.com/boykopovar/AnyPS5/blob/c84249186528cf14356f9fee51022c3f165ff262/core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp#L190-L191), [L335-336](https://github.com/boykopovar/AnyPS5/blob/c84249186528cf14356f9fee51022c3f165ff262/core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp#L335-L336) | | | Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap. | Pull request | Shared files not compared | |---|---| | [PR 1368](https://www.github.com/boykopovar/AnyPS5/pull/1368) | `core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Recorder.cpp` | | [PR 1395](https://www.github.com/boykopovar/AnyPS5/pull/1395) | `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Recorder.cpp` | | [PR 1896](https://www.github.com/boykopovar/AnyPS5/pull/1896) | `core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Recorder.cpp` | | [PR 4040](https://www.github.com/boykopovar/AnyPS5/pull/4040) | `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp` | | [PR 4072](https://www.github.com/boykopovar/AnyPS5/pull/4072) | `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp` | | [PR 4448](https://www.github.com/boykopovar/AnyPS5/pull/4448) | `core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp` | | [PR 4472](https://www.github.com/boykopovar/AnyPS5/pull/4472) | `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp` | | [PR 4650](https://www.github.com/boykopovar/AnyPS5/pull/4650) | `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp` | | [PR 4891](https://www.github.com/boykopovar/AnyPS5/pull/4891) | `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp` | | [PR 5021](https://www.github.com/boykopovar/AnyPS5/pull/5021) | `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Recorder.cpp` | | [PR 5431](https://www.github.com/boykopovar/AnyPS5/pull/5431) | `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp` | | [PR 5441](https://www.github.com/boykopovar/AnyPS5/pull/5441) | `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp` | | [PR 5480](https://www.github.com/boykopovar/AnyPS5/pull/5480) | `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp` | | [PR 5609](https://www.github.com/boykopovar/AnyPS5/pull/5609) | `core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp` | | [PR 5761](https://www.github.com/boykopovar/AnyPS5/pull/5761) | `core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp` | | [PR 5925](https://www.github.com/boykopovar/AnyPS5/pull/5925) | `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Recorder.cpp` | | [PR 6038](https://www.github.com/boykopovar/AnyPS5/pull/6038) | `core/libs/prx/libSceAgcDriver/tests/Recorder.cpp` | | [PR 6177](https://www.github.com/boykopovar/AnyPS5/pull/6177) | `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp` | | [PR 6188](https://www.github.com/boykopovar/AnyPS5/pull/6188) | `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Recorder.cpp` | | [PR 6208](https://www.github.com/boykopovar/AnyPS5/pull/6208) | `core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp` | | [PR 6222](https://www.github.com/boykopovar/AnyPS5/pull/6222) | `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Recorder.cpp` | | [PR 6259](https://www.github.com/boykopovar/AnyPS5/pull/6259) | `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp` | | [PR 6262](https://www.github.com/boykopovar/AnyPS5/pull/6262) | `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp` | | [PR 6292](https://www.github.com/boykopovar/AnyPS5/pull/6292) | `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp` | | [PR 6312](https://www.github.com/boykopovar/AnyPS5/pull/6312) | `core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Recorder.cpp` | | [PR 6320](https://www.github.com/boykopovar/AnyPS5/pull/6320) | `core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp` | | [PR 6373](https://www.github.com/boykopovar/AnyPS5/pull/6373) | `core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Recorder.cpp` | | [PR 6412](https://www.github.com/boykopovar/AnyPS5/pull/6412) | `core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp` | | [PR 6473](https://www.github.com/boykopovar/AnyPS5/pull/6473) | `core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp` | | [PR 6481](https://www.github.com/boykopovar/AnyPS5/pull/6481) | `core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp` | | [PR 6486](https://www.github.com/boykopovar/AnyPS5/pull/6486) | `core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Recorder.cpp` | | [PR 6539](https://www.github.com/boykopovar/AnyPS5/pull/6539) | `core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp` | | [PR 6615](https://www.github.com/boykopovar/AnyPS5/pull/6615) | `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp` | | [PR 6718](https://www.github.com/boykopovar/AnyPS5/pull/6718) | `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp`<br>`core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp` |
adriadam10 commented 2026-10-15 14:11:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-15T14:11:11Z.

Review: CHANGES_REQUESTED


Checked on the PR rebased onto current main (only the last commit is new; conflict was adjacency with MaterializeMultisampleTargetClear): builds, agc_driver_sample_multisample_target passes and fails without the change.

One blocking point, the same one @CnRJay raised and that is still unanswered:

  • MultisampleTarget.cpp:74 adds VK_IMAGE_USAGE_STORAGE_BIT (and MUTABLE_FORMAT/EXTENDED_USAGE at :68/:77 when the storage format differs) to every multisampled color target at creation, before anything stores to it. Drivers may drop color compression for such images, which would cost bandwidth in every title that renders MSAA, and none of the tests would show it. Either create the storage-capable image only when a storage binding first resolves to the target (keeping the default path unchanged), or post a before/after frame-time comparison from an MSAA title that never stores to its targets, on AMD and NVIDIA.

Not covered by us: Transport Fever 2 and the Windows/MX450 runs. Happy to re-review once the usage is lazy or measured.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5534521296 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5881#pullrequestreview-5534521296). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-15T14:11:11Z. **Review:** CHANGES_REQUESTED --- Checked on the PR rebased onto current main (only the last commit is new; conflict was adjacency with `MaterializeMultisampleTargetClear`): builds, `agc_driver_sample_multisample_target` passes and fails without the change. One blocking point, the same one @CnRJay raised and that is still unanswered: - `MultisampleTarget.cpp:74` adds `VK_IMAGE_USAGE_STORAGE_BIT` (and `MUTABLE_FORMAT`/`EXTENDED_USAGE` at :68/:77 when the storage format differs) to every multisampled color target at creation, before anything stores to it. Drivers may drop color compression for such images, which would cost bandwidth in every title that renders MSAA, and none of the tests would show it. Either create the storage-capable image only when a storage binding first resolves to the target (keeping the default path unchanged), or post a before/after frame-time comparison from an MSAA title that never stores to its targets, on AMD and NVIDIA. Not covered by us: Transport Fever 2 and the Windows/MX450 runs. Happy to re-review once the usage is lazy or measured.
codingreapermaps commented 2026-10-15 19:22:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by codingreapermaps on 2026-10-15T19:22:55Z.


Thanks both. The storage usage is now lazy, and the branch is rebased onto current main (#4820 and #5445 are merged, so this PR is now only its own commit).

  • A multisampled target is created with the same flags as on main: no STORAGE_BIT, no MUTABLE_FORMAT/EXTENDED_USAGE. The only addition is TRANSFER_SRC_BIT, which the one-time copy below needs.
  • The first storage binding that resolves to a target moves it to a new image with storage usage (and the mutable flags when the storage format differs). Its samples are copied once with vkCmdCopyImage (same format and sample count on both sides). Targets that are never stored to keep their current image.
  • The old image, memory and view are kept until the target is released, as main already does for targets retired by an unmap. Cached framebuffers can still name the old view, so it is never destroyed while one of them could be used, and no recycled handle can match them. Sampled textures of the old image are kept by the recorder.
  • Creating a multisampled image with storage usage also needs shaderStorageImageMultisample, which the previous version did not check. The device's enabled value now reaches Context, and without it a storage access throws the device cannot write the multisampled color target's format as a storage image at its sample count.
  • @CnRJay, on SAMPLED_BIT: that comes from #4820 (now merged), so it is outside this PR.

Tests:

  • agc_driver_recorder_tests: a target nothing stored to has no storage usage. That stays true after it is sampled. After a storage binding resolves to it, it has storage usage and a new view. The test on main that expected storage access to a multisampled texture to be refused now checks this instead. Without the feature, the new refusal is checked.
  • agc_driver_sample_multisample_target_tests: the store into one sample of each pixel of a drawn target goes through the copy, and the samples it does not store to are compared with their drawn values.

On main at 44df21632, Windows 11, MinGW-w64 GCC 15.2.0, NVIDIA GeForce MX450 (driver 581.83): agc_driver_sample_multisample_target_tests and agc_driver_recorder_tests --multisample-only pass. tools/check_conventions.py passes. The full agc_driver_recorder_tests stops at (9) a scan under a pending write was kept (Recorder.cpp:1332, the DCC key scan) on this machine, both with this branch and with plain main at the same commit, so it is unrelated to this PR.

I have no AMD card here, so I can't post an AMD frame-time pair. With the default path unchanged apart from TRANSFER_SRC, I hope that isn't needed any more. If you'd rather drop TRANSFER_SRC from the default flags too, the copy could go through a sampled read instead. Tell me if you want that.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6200426185 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5881#issuecomment-6200426185). Originally posted by [codingreapermaps](https://github.com/codingreapermaps) on 2026-10-15T19:22:55Z. --- Thanks both. The storage usage is now lazy, and the branch is rebased onto current `main` (#4820 and #5445 are merged, so this PR is now only its own commit). - A multisampled target is created with the same flags as on `main`: no `STORAGE_BIT`, no `MUTABLE_FORMAT`/`EXTENDED_USAGE`. The only addition is `TRANSFER_SRC_BIT`, which the one-time copy below needs. - The first storage binding that resolves to a target moves it to a new image with storage usage (and the mutable flags when the storage format differs). Its samples are copied once with `vkCmdCopyImage` (same format and sample count on both sides). Targets that are never stored to keep their current image. - The old image, memory and view are kept until the target is released, as `main` already does for targets retired by an unmap. Cached framebuffers can still name the old view, so it is never destroyed while one of them could be used, and no recycled handle can match them. Sampled textures of the old image are kept by the recorder. - Creating a multisampled image with storage usage also needs `shaderStorageImageMultisample`, which the previous version did not check. The device's enabled value now reaches `Context`, and without it a storage access throws `the device cannot write the multisampled color target's format as a storage image at its sample count`. - @CnRJay, on `SAMPLED_BIT`: that comes from #4820 (now merged), so it is outside this PR. Tests: - `agc_driver_recorder_tests`: a target nothing stored to has no storage usage. That stays true after it is sampled. After a storage binding resolves to it, it has storage usage and a new view. The test on `main` that expected storage access to a multisampled texture to be refused now checks this instead. Without the feature, the new refusal is checked. - `agc_driver_sample_multisample_target_tests`: the store into one sample of each pixel of a drawn target goes through the copy, and the samples it does not store to are compared with their drawn values. On `main` at `44df21632`, Windows 11, MinGW-w64 GCC 15.2.0, NVIDIA GeForce MX450 (driver 581.83): `agc_driver_sample_multisample_target_tests` and `agc_driver_recorder_tests --multisample-only` pass. `tools/check_conventions.py` passes. The full `agc_driver_recorder_tests` stops at `(9) a scan under a pending write was kept` (`Recorder.cpp:1332`, the DCC key scan) on this machine, both with this branch and with plain `main` at the same commit, so it is unrelated to this PR. I have no AMD card here, so I can't post an AMD frame-time pair. With the default path unchanged apart from `TRANSFER_SRC`, I hope that isn't needed any more. If you'd rather drop `TRANSFER_SRC` from the default flags too, the copy could go through a sampled read instead. Tell me if you want that.
Amoenus commented 2026-10-15 20:35:21 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Amoenus on 2026-10-15T20:35:21Z.


Independent validation and a recorder-test correction

@codingreapermaps, tested your head 9666c3e102f46e4fa601e7c5c11712b3c83df858 on Windows 11 Enterprise 26200, WinLibs GCC15.2r7 Release, NVIDIA RTX5080 /32.0.16.1062 and AMD Radeon Graphics /32.0.21036.18. Shader cache disabled, Vulkan required, serial runs and a 30s limit.

  • Full app/libs and repository checks pass with the separately disclosed #6452 Windows test-build correction (6d427676f). Eleven related groups pass five iterations per GPU selector: 55 per selector, ten groups with physical GPU identity verified per selector and one CPU-only group. Maximum test 11.14s.
  • On current main ce991f1ec2eb71a1f30459b4442a0730a0a4861b, the same extended storage fixture fails 5/5 per GPU with storage image access to a multisampled texture is not implemented. Only test code and #6452 differ from main.
  • Current-main validation composition: your change + #6452 + the fixture changes below. Full app/libs, conventions and registration pass. The storage fixture passes 5/5 fresh processes per physical GPU, including a second draw after the lazy image upgrade: all 1024 samples match the original verified triangle coverage over the stored background, with both changed covered samples and preserved uncovered stores required. The restored head passes another 5/5 per GPU.

One test correction: tests/Recorder.cpp queries VkPhysicalDeviceFeatures, but neither enables shaderStorageImageMultisample nor propagates it to context.storageImageMultisample. Consequently the new if (context.storageImageMultisample) positive upgrade assertion is unreachable. A diagnostic-only control passes 5/5 NVIDIA runs with feature-enabled=0, taking the refusal branch. This two-line correction enables the supported feature and records the enabled value in the context; the positive view-replacement/storage-usage assertions then pass 5/5 with feature-enabled=1 (and again after restoration).

The private recorder fixture selects NVIDIA on this machine independently of ANYPS5_GPU, so its results above are NVIDIA-only. The end-to-end storage/redraw fixture separately verifies both vendors. No Linux, Transport Fever 2 launch, compression or frame-time claim. Cppcheck reports the same 45 advisories on the pinned baseline and corrected test files with matching messages/source contexts; clang-tidy reports none. Existing advisories remain unresolved. AI-assisted: Codex.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6201737684 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5881#issuecomment-6201737684). Originally posted by [Amoenus](https://github.com/Amoenus) on 2026-10-15T20:35:21Z. --- <!-- codex-pr5881-independent-validation-v1 --> ### Independent validation and a recorder-test correction @codingreapermaps, tested your head `9666c3e102f46e4fa601e7c5c11712b3c83df858` on Windows 11 Enterprise 26200, WinLibs GCC15.2r7 Release, NVIDIA RTX5080 /32.0.16.1062 and AMD Radeon Graphics /32.0.21036.18. Shader cache disabled, Vulkan required, serial runs and a 30s limit. - Full app/libs and repository checks pass with the separately disclosed #6452 Windows test-build correction (`6d427676f`). Eleven related groups pass five iterations per GPU selector: 55 per selector, ten groups with physical GPU identity verified per selector and one CPU-only group. Maximum test 11.14s. - On current main `ce991f1ec2eb71a1f30459b4442a0730a0a4861b`, the [same extended storage fixture](https://github.com/Amoenus/AnyPS5/commit/dd5c681c1047209438ef292609bda99a2e145c09) fails 5/5 per GPU with `storage image access to a multisampled texture is not implemented`. Only test code and #6452 differ from main. - [Current-main validation composition](https://github.com/Amoenus/AnyPS5/commit/d02ffff846d37aacb4a94fa06bb3740804980e2e): your change + #6452 + the fixture changes below. Full app/libs, conventions and registration pass. The storage fixture passes 5/5 fresh processes per physical GPU, including a second draw after the lazy image upgrade: all 1024 samples match the original verified triangle coverage over the stored background, with both changed covered samples and preserved uncovered stores required. The restored head passes another 5/5 per GPU. **One test correction:** `tests/Recorder.cpp` queries `VkPhysicalDeviceFeatures`, but neither enables `shaderStorageImageMultisample` nor propagates it to `context.storageImageMultisample`. Consequently the new `if (context.storageImageMultisample)` positive upgrade assertion is unreachable. A diagnostic-only control passes 5/5 NVIDIA runs with `feature-enabled=0`, taking the refusal branch. This [two-line correction](https://github.com/Amoenus/AnyPS5/commit/ae70f2837b36cca03125287b70ba244113fb16e3) enables the supported feature and records the enabled value in the context; the positive view-replacement/storage-usage assertions then pass 5/5 with `feature-enabled=1` (and again after restoration). The private recorder fixture selects NVIDIA on this machine independently of `ANYPS5_GPU`, so its results above are NVIDIA-only. The end-to-end storage/redraw fixture separately verifies both vendors. No Linux, Transport Fever 2 launch, compression or frame-time claim. Cppcheck reports the same 45 advisories on the pinned baseline and corrected test files with matching messages/source contexts; clang-tidy reports none. Existing advisories remain unresolved. AI-assisted: Codex. <!-- /codex-pr5881-independent-validation-v1 -->
screamm commented 2026-10-16 11:11:22 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-16T11:11:22Z.


Cross-validation on Windows 11 Pro 26220, NVIDIA RTX 4070 (596.21), WinLibs MinGW-w64 GCC 15.2, PR head 9666c3e10 merged on main 5d9dcc42d (clean). NVIDIA only; I have no AMD card either.

On the ask (lazy storage usage or a before/after from an MSAA title that never stores): the lazy part is in 9666c3e10, and here is the measurement.

  • Build: full build and libs pass except the known 64 KiB alignas AGC test (#6452/#6478).
  • agc_driver_sample_multisample_target and agc_multisample_guest_access, --repeat until-fail:3: 3 of 3 each. Negative control: with MultisampleTarget.cpp, ShaderResources.cpp and Texture.cpp reverted to main (headers and tests kept), agc_driver_sample_multisample_target fails 3 of 3 with AGC graphics: storage image access to a multisampled texture is not implemented; restored, it passes.
  • 86 related GPU tests (multisample, msaa, storage, cmask, dcc, sample mask, resolve, fills, agc_storage_*, agc_recorder_*, serial): 86 of 86 pass. Non-GPU suite (837 tests): 835 pass; conventions_function_bodies_shard_4 and hardware_oracle_compare time out under load and pass serially. tools/check_conventions.py and git diff --check pass.
  • Title: Middle Ages Ping Pong PPSA28319 creates one 1920x1080 2-sample color target and never stores to it (a throwaway print in the MultisampleTarget constructor and in the move to the storage image: one created, no move, 50 s). 3 runs of 120 s on main and 3 on the PR, interleaved, APS5_TRACE_SUMMARY_EVERY=10, no input, no stop line in any run. The title is paced at 60 FPS, so frame time is the same: p50 16.68 ms in all six runs; p90 16.91 ms (16.89 to 17.22) on main, 16.90 ms (16.88 to 16.91) with the PR; p99 17.38 ms (17.10 to 26.10) vs 17.25 ms (17.07 to 18.52). GPU busy per present, which is where a lost compression would show: 1.89 ms (1.51 to 1.95) on main, 1.76 ms (1.40 to 1.85) with the PR. Host CPU load (shared machine): main 81% median (47 to 85), PR 61% (52 to 73). The frame dumps match. So on NVIDIA the default path shows no cost; a 2-sample 1080p target is a weak test of the compression concern, and it says nothing about AMD.
  • No local title stores to an MSAA target. vkQuake with vid_fsaa 4 creates a 3840x2160 4-sample target and then stops after 14 s on main's AGC graphics: DCC over a multisampled color target is unsupported; Ruffle (idle and demo) creates none; ProsperoPuzzles stops earlier on #6301.
  • tests/Recorder.cpp never sets context.storageImageMultisample (the only use is the new if at line 6317), so the positive upgrade assertions in agc_multisample_guest_access are not reached and the refusal branch runs; this is what Amoenus described. agc_driver_sample_multisample_target covers the positive path.
  • Not checked: AMD, Intel, Linux, Transport Fever 2, any title that stores to an MSAA target.

Written with Claude Code assistance (validation by a subagent, reviewed in this session).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6214229582 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5881#issuecomment-6214229582). Originally posted by [screamm](https://github.com/screamm) on 2026-10-16T11:11:22Z. --- Cross-validation on Windows 11 Pro 26220, NVIDIA RTX 4070 (596.21), WinLibs MinGW-w64 GCC 15.2, PR head `9666c3e10` merged on main `5d9dcc42d` (clean). NVIDIA only; I have no AMD card either. On the ask (lazy storage usage or a before/after from an MSAA title that never stores): the lazy part is in `9666c3e10`, and here is the measurement. - Build: full build and `libs` pass except the known 64 KiB `alignas` AGC test (#6452/#6478). - `agc_driver_sample_multisample_target` and `agc_multisample_guest_access`, `--repeat until-fail:3`: 3 of 3 each. Negative control: with `MultisampleTarget.cpp`, `ShaderResources.cpp` and `Texture.cpp` reverted to main (headers and tests kept), `agc_driver_sample_multisample_target` fails 3 of 3 with `AGC graphics: storage image access to a multisampled texture is not implemented`; restored, it passes. - 86 related GPU tests (multisample, msaa, storage, cmask, dcc, sample mask, resolve, fills, `agc_storage_*`, `agc_recorder_*`, serial): 86 of 86 pass. Non-GPU suite (837 tests): 835 pass; `conventions_function_bodies_shard_4` and `hardware_oracle_compare` time out under load and pass serially. `tools/check_conventions.py` and `git diff --check` pass. - Title: Middle Ages Ping Pong PPSA28319 creates one 1920x1080 2-sample color target and never stores to it (a throwaway print in the `MultisampleTarget` constructor and in the move to the storage image: one `created`, no move, 50 s). 3 runs of 120 s on main and 3 on the PR, interleaved, `APS5_TRACE_SUMMARY_EVERY=10`, no input, no stop line in any run. The title is paced at 60 FPS, so frame time is the same: p50 16.68 ms in all six runs; p90 16.91 ms (16.89 to 17.22) on main, 16.90 ms (16.88 to 16.91) with the PR; p99 17.38 ms (17.10 to 26.10) vs 17.25 ms (17.07 to 18.52). GPU busy per present, which is where a lost compression would show: 1.89 ms (1.51 to 1.95) on main, 1.76 ms (1.40 to 1.85) with the PR. Host CPU load (shared machine): main 81% median (47 to 85), PR 61% (52 to 73). The frame dumps match. So on NVIDIA the default path shows no cost; a 2-sample 1080p target is a weak test of the compression concern, and it says nothing about AMD. - No local title stores to an MSAA target. vkQuake with `vid_fsaa 4` creates a 3840x2160 4-sample target and then stops after 14 s on main's `AGC graphics: DCC over a multisampled color target is unsupported`; Ruffle (idle and demo) creates none; ProsperoPuzzles stops earlier on #6301. - `tests/Recorder.cpp` never sets `context.storageImageMultisample` (the only use is the new `if` at line 6317), so the positive upgrade assertions in `agc_multisample_guest_access` are not reached and the refusal branch runs; this is what Amoenus described. `agc_driver_sample_multisample_target` covers the positive path. - Not checked: AMD, Intel, Linux, Transport Fever 2, any title that stores to an MSAA target. Written with Claude Code assistance (validation by a subagent, reviewed in this session).
MarcZX10 commented 2026-10-16 12:00:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-16T12:00:39Z.


Cross-PR test interaction to coordinate with #6590: nicolasfalesy reports that agc_driver_sample_multisample_target passes on main and on each PR head separately, but fails 2/2 on the combined tree at the final sample check after #6590's four refused native-index draws. Their report is on #6590. I confirmed the current #5881 (9666c3e) and #6590 (881facc4) heads merge cleanly; I have not localized the runtime cause. I asked for the exact base pin and composition details so we can determine whether the current heads still reproduce it.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6215030514 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5881#issuecomment-6215030514). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-16T12:00:39Z. --- Cross-PR test interaction to coordinate with #6590: nicolasfalesy reports that `agc_driver_sample_multisample_target` passes on main and on each PR head separately, but fails 2/2 on the combined tree at the final sample check after #6590's four refused native-index draws. Their report is on [#6590](https://github.com/boykopovar/AnyPS5/pull/6590#issuecomment-6211831736). I confirmed the current #5881 (`9666c3e`) and #6590 (`881facc4`) heads merge cleanly; I have not localized the runtime cause. I asked for the exact base pin and composition details so we can determine whether the current heads still reproduce it.
adriadam10 commented 2026-10-16 12:14:33 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-16T12:14:33Z.

Review: APPROVED


Re-checked on current main: the diff is unchanged and storage usage stays lazy.

Added on your branch (fix-merge):

  • tests/Recorder.cpp: the test device now enables shaderStorageImageMultisample and sets context.storageImageMultisample, so the if (context.storageImageMultisample) branch is reachable (found by @Amoenus).

Checked: build + ctest on the PR rebased onto main; agc_driver_sample_multisample_target passes, the only failure is agc_driver_tessellation, which also fails on main. Not verified here: the title run, AMD/NVIDIA frame times, and the interaction with #6590 reported by @MarcZX100. Merging.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5547616823 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5881#pullrequestreview-5547616823). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-16T12:14:33Z. **Review:** APPROVED --- Re-checked on current main: the diff is unchanged and storage usage stays lazy. Added on your branch (fix-merge): - `tests/Recorder.cpp`: the test device now enables `shaderStorageImageMultisample` and sets `context.storageImageMultisample`, so the `if (context.storageImageMultisample)` branch is reachable (found by @Amoenus). Checked: build + ctest on the PR rebased onto main; `agc_driver_sample_multisample_target` passes, the only failure is `agc_driver_tessellation`, which also fails on main. Not verified here: the title run, AMD/NVIDIA frame times, and the interaction with #6590 reported by @MarcZX100. Merging.
MarcZX10 commented 2026-10-16 12:15:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-16T12:15:39Z.


A composition report on #6590 points to a test-order interaction with this PR: the combined SampleMultisampleTarget.cpp runs StoreSamples against block and writes Written to sample 1 of every pixel, then #6590’s later CheckNativeIndices reuses block as its source while asserting every sample is still Ones. The reported first differing sample is exactly the value written by this PR’s test. This looks like the #6590 fixture should run before those stores or restore its input state, rather than a production-path regression. The combined tree is b8e65cb4e40e254c62f16ceb48608236b4672797. I could not run the test locally because this Linux host fails the project’s AVX2/BMI CPU guard.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6215294457 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5881#issuecomment-6215294457). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-16T12:15:39Z. --- A composition report on #6590 points to a test-order interaction with this PR: the combined `SampleMultisampleTarget.cpp` runs `StoreSamples` against `block` and writes `Written` to sample 1 of every pixel, then #6590’s later `CheckNativeIndices` reuses `block` as its source while asserting every sample is still `Ones`. The reported first differing sample is exactly the value written by this PR’s test. This looks like the #6590 fixture should run before those stores or restore its input state, rather than a production-path regression. The combined tree is `b8e65cb4e40e254c62f16ceb48608236b4672797`. I could not run the test locally because this Linux host fails the project’s AVX2/BMI CPU guard.
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!5881
No description provided.