fix(agc): sample a multisampled 11_11_10 float texture in its sampled format #11691

Merged
hugodearaujo merged 2 commits from upstream-pr/11691 into main 2026-10-28 03:57:03 +00:00
hugodearaujo commented 2026-10-27 02:59:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by hugodearaujo on 2026-10-27T02:59:09Z.


What

Since #8898, ResolveTextureFormat gives format 36 (11_11_10_FLOAT) its storage form, R32_UINT, which the shader packs and unpacks. A sampled format 36 image is still read through its native B10G11R11_UFLOAT view (SampledTextureFormat, and nativeRepacked in ResourceMaterializer). MultisampleTargetTexture and MultisampleTargetFirstSample kept matching the resident multisampled target by ResolveTextureFormat, so a 4x COLOR_10_11_11 float target, which DecodeColorBuffer renders as B10G11R11_UFLOAT (the same bits as format 36), is refused when it is read through a format 36 texture descriptor of the same shape:

compute shader 0x10b4e03d00: AGC graphics: sampling multisampled color target 0x10e0720000 (960x540, 4 samples, vk format 122) as a 960x540 texture of 4 samples and guest format 36 (vk 98) is not implemented

Assassin's Creed Mirage (PPSA13960) stops on this line 86 to 91 s after start on main.

Both functions now match and fill a multisampled texture in SampledTextureFormat. The repacked format 43 keeps ResolveTextureFormat, as before: its sampled view needs repacked words, which the multisampled path does not produce. For every other format the two give the same Vulkan format, except the 8 and 8_8 sRGB formats on a device that cannot sample them, which were refused before and still are.

agc_driver_sample_multisample_target gains a case that draws a 4x COLOR_10_11_11 float target (0.25, 0.5, 0.125) and reads every sample through format 36 Dim2DMsaa and Dim2DMsaaArray descriptors, and sample 0 through DIM 2D image_load, image_sample_lz and image_sample_l.

Tested

Linux 7.2.11, GCC 16.2.1, Ninja, Release, AMD Radeon RX 9070 XT (RADV, Mesa 26.2.5). The tests ran on main abed035468 and this branch on top of it; MultisampleTarget.cpp and the test file are the same on main a120df3486, where the title runs below were made.

  • ctest -V -R '^agc_driver_sample_multisample_target$' with VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, VK_LOADER_DEBUG=layer, ANYPS5_NO_SHADER_CACHE=1, ANYPS5_REQUIRE_VULKAN=1:
result VUID- lines validation layer inserted
main passed 0 yes
main + the new case only failed: AGC graphics: sampling multisampled color target 0x55eec24a0000 (16x16, 4 samples, vk format 122) as a 16x16 texture of 4 samples and guest format 36 (vk 98) is not implemented 0 yes
this branch passed 0 yes

No run printed was not found but was requested by env var VK_INSTANCE_LAYERS.

  • The same settings over 34 multisample, FMASK and converted-format tests (agc_driver_msaa_layout, agc_driver_msaa_dcc_clear_{2,4,8}, agc_driver_msaa_dcc_compared_import_{2,4,8}, agc_driver_multisample_* including the readback variants, agc_driver_native_fmask, agc_driver_native_msaa_vertex_input, agc_driver_native_multisample_depth, agc_driver_fmask_image_reads, agc_driver_cached_image_multisample_guard, agc_driver_image_msaa_address_on_plane, agc_driver_msaa_enable_single_sample, agc_driver_multisampled_pass_order, agc_driver_packed_unorm4444_multisample_partial_write, agc_driver_sample_mask_multisample, agc_driver_sample_multisample_target, agc_driver_image_converted_unorm, agc_driver_image_repacked_float, image_msaa_load): 34 of 34 pass on main and on this branch, 0 VUID- lines in both; the loader inserted the layer in the 32 tests that open a Vulkan device (agc_driver_msaa_layout and image_msaa_load don't).

  • Assassin's Creed Mirage (PPSA13960), main a120df3486 and main + this change, otherwise the same build, Cross every 30 s: main stops at 87 s on the line above. With this change that line is gone, and the title stops at 83 s on the next refusal: presenting reads the 0x1fe0000-byte surface at 0x10dfd20000, which overlaps the same 4x target:

    AGC graphics: a CPU read of 0x10dfd20000+0x1fe0000 overlaps multisampled color target 0x10e0720000+0x870000 (4 samples), whose samples are only on the host: guest access to it is not implemented
    

    That is the overlap #8223 and #10049 work on. With #8223 (head 331399d903) merged on top, that read passes too, and the title stops at 87 s on the partial clear described in #8223's thread: compute shader 0x1000810a00: AGC graphics: a cached image access of 0x10dc1d0000+0x480000 overlaps multisampled color target 0x10dc450000+0x480000 (4 samples), whose samples are only on the host: guest access to it is not implemented. Two other runs with this change (one of them with #8223 merged too) segfaulted on the main thread 3 s after start, before any GPU work: the start-up crash #7532 addresses.

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 in their library's technical debt file
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none (regression from #8898)
  • Unblocks: PPSA13960 #7534 (Assassin's Creed Mirage), the stop above
  • GPUs tested: AMD Radeon RX 9070 XT (RADV, Mesa 26.2.5)
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5027891523 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11691). Originally posted by [hugodearaujo](https://github.com/hugodearaujo) on 2026-10-27T02:59:09Z. --- ### What Since #8898, `ResolveTextureFormat` gives format 36 (`11_11_10_FLOAT`) its storage form, `R32_UINT`, which the shader packs and unpacks. A sampled format 36 image is still read through its native `B10G11R11_UFLOAT` view (`SampledTextureFormat`, and `nativeRepacked` in `ResourceMaterializer`). `MultisampleTargetTexture` and `MultisampleTargetFirstSample` kept matching the resident multisampled target by `ResolveTextureFormat`, so a 4x `COLOR_10_11_11` float target, which `DecodeColorBuffer` renders as `B10G11R11_UFLOAT` (the same bits as format 36), is refused when it is read through a format 36 texture descriptor of the same shape: compute shader 0x10b4e03d00: AGC graphics: sampling multisampled color target 0x10e0720000 (960x540, 4 samples, vk format 122) as a 960x540 texture of 4 samples and guest format 36 (vk 98) is not implemented Assassin's Creed Mirage (PPSA13960) stops on this line 86 to 91 s after start on `main`. Both functions now match and fill a multisampled texture in `SampledTextureFormat`. The repacked format 43 keeps `ResolveTextureFormat`, as before: its sampled view needs repacked words, which the multisampled path does not produce. For every other format the two give the same Vulkan format, except the 8 and 8_8 sRGB formats on a device that cannot sample them, which were refused before and still are. `agc_driver_sample_multisample_target` gains a case that draws a 4x `COLOR_10_11_11` float target (0.25, 0.5, 0.125) and reads every sample through format 36 `Dim2DMsaa` and `Dim2DMsaaArray` descriptors, and sample 0 through `DIM 2D` `image_load`, `image_sample_lz` and `image_sample_l`. ### Tested Linux 7.2.11, GCC 16.2.1, Ninja, Release, AMD Radeon RX 9070 XT (RADV, Mesa 26.2.5). The tests ran on `main` abed035468 and this branch on top of it; `MultisampleTarget.cpp` and the test file are the same on `main` a120df3486, where the title runs below were made. - `ctest -V -R '^agc_driver_sample_multisample_target$'` with `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, `VK_LOADER_DEBUG=layer`, `ANYPS5_NO_SHADER_CACHE=1`, `ANYPS5_REQUIRE_VULKAN=1`: | | result | `VUID-` lines | validation layer inserted | |---|---|---|---| | `main` | passed | 0 | yes | | `main` + the new case only | failed: `AGC graphics: sampling multisampled color target 0x55eec24a0000 (16x16, 4 samples, vk format 122) as a 16x16 texture of 4 samples and guest format 36 (vk 98) is not implemented` | 0 | yes | | this branch | passed | 0 | yes | No run printed `was not found but was requested by env var VK_INSTANCE_LAYERS`. - The same settings over 34 multisample, FMASK and converted-format tests (`agc_driver_msaa_layout`, `agc_driver_msaa_dcc_clear_{2,4,8}`, `agc_driver_msaa_dcc_compared_import_{2,4,8}`, `agc_driver_multisample_*` including the readback variants, `agc_driver_native_fmask`, `agc_driver_native_msaa_vertex_input`, `agc_driver_native_multisample_depth`, `agc_driver_fmask_image_reads`, `agc_driver_cached_image_multisample_guard`, `agc_driver_image_msaa_address_on_plane`, `agc_driver_msaa_enable_single_sample`, `agc_driver_multisampled_pass_order`, `agc_driver_packed_unorm4444_multisample_partial_write`, `agc_driver_sample_mask_multisample`, `agc_driver_sample_multisample_target`, `agc_driver_image_converted_unorm`, `agc_driver_image_repacked_float`, `image_msaa_load`): 34 of 34 pass on `main` and on this branch, 0 `VUID-` lines in both; the loader inserted the layer in the 32 tests that open a Vulkan device (`agc_driver_msaa_layout` and `image_msaa_load` don't). - Assassin's Creed Mirage (PPSA13960), `main` a120df3486 and `main` + this change, otherwise the same build, Cross every 30 s: `main` stops at 87 s on the line above. With this change that line is gone, and the title stops at 83 s on the next refusal: presenting reads the 0x1fe0000-byte surface at 0x10dfd20000, which overlaps the same 4x target: AGC graphics: a CPU read of 0x10dfd20000+0x1fe0000 overlaps multisampled color target 0x10e0720000+0x870000 (4 samples), whose samples are only on the host: guest access to it is not implemented That is the overlap #8223 and #10049 work on. With #8223 (head 331399d903) merged on top, that read passes too, and the title stops at 87 s on the partial clear described in #8223's thread: `compute shader 0x1000810a00: AGC graphics: a cached image access of 0x10dc1d0000+0x480000 overlaps multisampled color target 0x10dc450000+0x480000 (4 samples), whose samples are only on the host: guest access to it is not implemented`. Two other runs with this change (one of them with #8223 merged too) segfaulted on the main thread 3 s after start, before any GPU work: the start-up crash #7532 addresses. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except technical debt - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in their library's technical debt file - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none (regression from #8898) - [x] Unblocks: PPSA13960 #7534 (Assassin's Creed Mirage), the stop above - [x] GPUs tested: AMD Radeon RX 9070 XT (RADV, Mesa 26.2.5) - [x] AI-assisted: yes
jotitadev commented 2026-10-27 05:08:45 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-27T05:08:45Z.

Review: COMMENTED


Linux run on NVIDIA and lavapipe, since the description covers RADV only. Head f4274307ec on main b986c11a34 (patch applies cleanly). Ubuntu 26.04, GCC 15.2, Release. ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1, -j1. lavapipe selected with VK_ICD_FILENAMES=.../lvp_icd.json.

agc_driver_sample_multisample_target:

RTX 3070 (NVIDIA 595.99.02) lavapipe (Mesa 26.0.3)
main + the new case only fails: sampling multisampled color target ... (16x16, 4 samples, vk format 122) as a 16x16 texture of 4 samples and guest format 36 (vk 98) is not implemented same failure
this head passes passes

Full ^agc suite (without agc_display_buffer_dcc, agc_driver_flip, agc_driver_lds_atomics64, --timeout 30) with #11692 and #11691 applied together on main: 1041/1042 on both devices. The one failure on each also fails on unmodified main on this machine, with the same message: agc_driver_pipeline_journal on the 3070 (the oversized record was not counted as a write failure; it passes when only the NVIDIA ICD is visible), and agc_driver_multisample_retirement on lavapipe (MSAA storage promotion did not retain its source image).

GPUs tested: NVIDIA GeForce RTX 3070 (proprietary 595.99.02, Linux), lavapipe (Mesa 26.0.3, LLVM 21).

Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5662475296 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11691#pullrequestreview-5662475296). Originally posted by [jotitadev](https://github.com/jotitadev) on 2026-10-27T05:08:45Z. **Review:** COMMENTED --- Linux run on NVIDIA and lavapipe, since the description covers RADV only. Head `f4274307ec` on `main` `b986c11a34` (patch applies cleanly). Ubuntu 26.04, GCC 15.2, Release. `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1`, `-j1`. lavapipe selected with `VK_ICD_FILENAMES=.../lvp_icd.json`. `agc_driver_sample_multisample_target`: | | RTX 3070 (NVIDIA 595.99.02) | lavapipe (Mesa 26.0.3) | |---|---|---| | `main` + the new case only | fails: `sampling multisampled color target ... (16x16, 4 samples, vk format 122) as a 16x16 texture of 4 samples and guest format 36 (vk 98) is not implemented` | same failure | | this head | passes | passes | Full `^agc` suite (without `agc_display_buffer_dcc`, `agc_driver_flip`, `agc_driver_lds_atomics64`, `--timeout 30`) with #11692 and #11691 applied together on `main`: 1041/1042 on both devices. The one failure on each also fails on unmodified `main` on this machine, with the same message: `agc_driver_pipeline_journal` on the 3070 (`the oversized record was not counted as a write failure`; it passes when only the NVIDIA ICD is visible), and `agc_driver_multisample_retirement` on lavapipe (`MSAA storage promotion did not retain its source image`). GPUs tested: NVIDIA GeForce RTX 3070 (proprietary 595.99.02, Linux), lavapipe (Mesa 26.0.3, LLVM 21). Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
MarcZX10 commented 2026-10-27 05:27:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-27T05:27:53Z.

Review: APPROVED


Reviewed exact head f4274307ecd56b995e43983780601bf6f70f2670; approve.

The format selection is consistent with the resource materializer: non-repacked descriptors use SampledTextureFormat, including format 36's native B10G11R11_UFLOAT view, while repacked formats retain ResolveTextureFormat. Both target matching paths (multisample sampling and first-sample reads) use the same selection. The regression covers 4x COLOR_10_11_11 rendered storage read through format 36 using both Dim2DMsaa and Dim2DMsaaArray, plus sample-0 image load/sample operations. I found no conflicting change to these comparisons in the manually checked overlap cases.

Validation evidence: the author reports the focused main/new-case/change comparison and 34 related MSAA tests on RADV with Khronos validation and zero VUIDs. An independent reviewer reports the focused failing-main/passing-change reproduction and an AGC suite run on both RTX 3070 and lavapipe; the sole suite failures also reproduce on unchanged main. Hosted product jobs are skipped by path policy. I could not run a fresh local GPU test here because this environment exposes no GPU device.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5662613713 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11691#pullrequestreview-5662613713). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-27T05:27:53Z. **Review:** APPROVED --- Reviewed exact head `f4274307ecd56b995e43983780601bf6f70f2670`; approve. The format selection is consistent with the resource materializer: non-repacked descriptors use `SampledTextureFormat`, including format 36's native `B10G11R11_UFLOAT` view, while repacked formats retain `ResolveTextureFormat`. Both target matching paths (multisample sampling and first-sample reads) use the same selection. The regression covers 4x `COLOR_10_11_11` rendered storage read through format 36 using both `Dim2DMsaa` and `Dim2DMsaaArray`, plus sample-0 image load/sample operations. I found no conflicting change to these comparisons in the manually checked overlap cases. Validation evidence: the author reports the focused main/new-case/change comparison and 34 related MSAA tests on RADV with Khronos validation and zero VUIDs. An independent reviewer reports the focused failing-main/passing-change reproduction and an AGC suite run on both RTX 3070 and lavapipe; the sole suite failures also reproduce on unchanged main. Hosted product jobs are skipped by path policy. I could not run a fresh local GPU test here because this environment exposes no GPU device.
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!11691
No description provided.