fix(agc): sample multisampled targets in read-only layout #6971

Closed
MarcZX10 wants to merge 3 commits from upstream-pr/6971 into main
MarcZX10 commented 2026-10-16 22:56:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-16T22:56:38Z.


What

Fixes #6957 by tracking a borrowed multisampled target's current image layout. After storage writes, sampled reads transition the image from GENERAL to SHADER_READ_ONLY_OPTIMAL; before later attachment or storage use, it transitions back to GENERAL. This targets the Intel UHD 770 behavior reported in the issue while leaving other image access paths intact.

The sampled view keeps the requested VkImageViewType in its cache key and supports a restricted view usage, so this change composes with #6635's multisampled array views and #6683's sample-order storage view. Their sample-order pass writes through the tracked storage path, so the next sampled read uses the read-only transition. The author of #6635 requested that it land first; this PR remains draft until then. New PR #6973 also changes MultisampleTarget.cpp and the sampled view path to initialize native multisample color contents. I have flagged the overlap there and will verify that the layout tracking preserves its initial upload before marking this PR ready.

Tested

  • Linux, GCC 12.2 Release: built agc_driver_graphics_tests, agc_driver_recorder_tests, and agc_driver_sample_multisample_target_tests. GCC 12 required a temporary template keyword workaround in unrelated SrtDescriptorEvaluation.cpp; I restored that file, and the workaround is not part of this PR.
  • In a local merge preview with #6635 and #6683, compiled the changed MultisampleTarget.cpp, Texture.cpp, SampleOrder.cpp, and Recorder.cpp array-view regression, and linked the graphics, recorder, multisample-target, and sample-order test executables.
  • CTest for agc_driver_sample_multisample_target, agc_multisample_guest_access, agc_driver_sample_order, and agc_driver_sample_order_planning aborts before assertions on this host because its Xeon E5-1620 v2 lacks LZCNT, BMI1/2, MOVBE, AVX2, and FMA. No runtime or Intel UHD 770 result is claimed.
  • python3 tools/check_conventions.py --base upstream/main and git diff --check pass.

Checklist

  • Based on current main; no duplicate PR implements this layout fix
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw; no silent stubs added
  • No notes, investigation files, or images added
  • No third-party code added
  • Generic behavior, not title-specific
  • Depends on: #6635 (requested merge order); #6973 composition review pending
  • Unblocks: Intel UHD 770 sampled multisample failure #6957
  • GPUs tested: no local GPU run; see the issue's Intel UHD 770 and RX 9070 XT report
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4895207517 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6971). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-16T22:56:38Z. --- ### What Fixes #6957 by tracking a borrowed multisampled target's current image layout. After storage writes, sampled reads transition the image from `GENERAL` to `SHADER_READ_ONLY_OPTIMAL`; before later attachment or storage use, it transitions back to `GENERAL`. This targets the Intel UHD 770 behavior reported in the issue while leaving other image access paths intact. The sampled view keeps the requested `VkImageViewType` in its cache key and supports a restricted view usage, so this change composes with #6635's multisampled array views and #6683's sample-order storage view. Their sample-order pass writes through the tracked storage path, so the next sampled read uses the read-only transition. The author of #6635 requested that it land first; this PR remains draft until then. New PR #6973 also changes `MultisampleTarget.cpp` and the sampled view path to initialize native multisample color contents. I have flagged the overlap there and will verify that the layout tracking preserves its initial upload before marking this PR ready. ### Tested - Linux, GCC 12.2 Release: built `agc_driver_graphics_tests`, `agc_driver_recorder_tests`, and `agc_driver_sample_multisample_target_tests`. GCC 12 required a temporary `template` keyword workaround in unrelated `SrtDescriptorEvaluation.cpp`; I restored that file, and the workaround is not part of this PR. - In a local merge preview with #6635 and #6683, compiled the changed `MultisampleTarget.cpp`, `Texture.cpp`, `SampleOrder.cpp`, and `Recorder.cpp` array-view regression, and linked the graphics, recorder, multisample-target, and sample-order test executables. - CTest for `agc_driver_sample_multisample_target`, `agc_multisample_guest_access`, `agc_driver_sample_order`, and `agc_driver_sample_order_planning` aborts before assertions on this host because its Xeon E5-1620 v2 lacks LZCNT, BMI1/2, MOVBE, AVX2, and FMA. No runtime or Intel UHD 770 result is claimed. - `python3 tools/check_conventions.py --base upstream/main` and `git diff --check` pass. ### Checklist - [x] Based on current `main`; no duplicate PR implements this layout fix - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except technical debt - [x] Unimplemented paths throw; no silent stubs added - [x] No notes, investigation files, or images added - [x] No third-party code added - [x] Generic behavior, not title-specific - [x] Depends on: #6635 (requested merge order); #6973 composition review pending - [x] Unblocks: Intel UHD 770 sampled multisample failure #6957 - [x] GPUs tested: no local GPU run; see the issue's Intel UHD 770 and RX 9070 XT report - [x] AI-assisted: yes
MarcZX10 commented 2026-10-16 23:42:47 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-16T23:42:47Z.


Thanks for confirming the composition and preserved authorship. I verified that #6973 carries the #6971 commits, while #6635 and #6973 remain open. I will keep #6971 in draft pending the requested #6635 order and the composition review. The reported validation is useful for the combined changes, but does not establish the Intel UHD 770 result for #6957.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6226770844 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6971#issuecomment-6226770844). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-16T23:42:47Z. --- Thanks for confirming the composition and preserved authorship. I verified that #6973 carries the #6971 commits, while #6635 and #6973 remain open. I will keep #6971 in draft pending the requested #6635 order and the composition review. The reported validation is useful for the combined changes, but does not establish the Intel UHD 770 result for #6957.
savvaniss commented 2026-10-17 08:42:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by savvaniss on 2026-10-17T08:42:36Z.


UHD 770 result, as asked in #6957: this fixes agc_driver_sample_multisample_target on the device that reported it.

Windows 11 Pro 26300, WinLibs GCC 15.2.0 r7, Release, every execution test built, ANYPS5_NO_SHADER_CACHE=1. This head f65cecdda merged into main 5f61879a9. Intel UHD Graphics 770 (8086:a780), driver 32.0.101.7088. AMD Radeon RX 9070 XT (1002:7550), driver 32.0.31041.1004, with VkCache emptied first.

Tests: the 14 multisample tests on main and agc_driver_graphics. The multisample tests are agc_multisample_guest_access, agc_tiled_resolve, agc_driver_msaa_dcc_state, agc_driver_msaa_dcc_clear_2/_4/_8, agc_driver_msaa_enable_single_sample, agc_driver_multisample_fill_host_only, agc_driver_native_multisample_depth, agc_driver_sample_mask_draw/_depth_stencil/_multisample, agc_driver_sample_multisample_target and image_msaa_load.

GPU main, ×3 This PR, ×5
UHD 770 sample_multisample_target fails (sample 1 of pixel (0, 0) does not hold the stored color into one sample of each pixel of the drawn target); the other 14 pass 15 of 15 pass
RX 9070 XT 15 of 15 pass 15 of 15 pass

Full CTest with this PR, --parallel 4: UHD 770 1365 of 1373, RX 9070 XT 1369 of 1373. None of the failures involve multisample targets:

  • Both: select_tests (symlink privilege, #6961).
  • UHD 770: the five image-table tests (#6647). Also agc_import_watch (the Windows import probe failed at the settle queue (0)) and agc_sample_dumps (access violation in igvk64.dll). Both fail the same way on main adb0e7a8c without this PR.
  • RX 9070 XT: agc_driver_quad_pixel_mask (#6255), and agc_driver_layered_volume_draw and agc_driver_layered_volume_vertex (the GPL cache swap of #4768, #6436).

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6231873480 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6971#issuecomment-6231873480). Originally posted by [savvaniss](https://github.com/savvaniss) on 2026-10-17T08:42:36Z. --- UHD 770 result, as asked in #6957: this fixes `agc_driver_sample_multisample_target` on the device that reported it. Windows 11 Pro 26300, WinLibs GCC 15.2.0 r7, Release, every execution test built, `ANYPS5_NO_SHADER_CACHE=1`. This head `f65cecdda` merged into `main` `5f61879a9`. Intel UHD Graphics 770 (`8086:a780`), driver 32.0.101.7088. AMD Radeon RX 9070 XT (`1002:7550`), driver 32.0.31041.1004, with `VkCache` emptied first. Tests: the 14 multisample tests on `main` and `agc_driver_graphics`. The multisample tests are `agc_multisample_guest_access`, `agc_tiled_resolve`, `agc_driver_msaa_dcc_state`, `agc_driver_msaa_dcc_clear_2`/`_4`/`_8`, `agc_driver_msaa_enable_single_sample`, `agc_driver_multisample_fill_host_only`, `agc_driver_native_multisample_depth`, `agc_driver_sample_mask_draw`/`_depth_stencil`/`_multisample`, `agc_driver_sample_multisample_target` and `image_msaa_load`. | GPU | `main`, ×3 | This PR, ×5 | |---|---|---| | UHD 770 | `sample_multisample_target` fails (`sample 1 of pixel (0, 0) does not hold the stored color into one sample of each pixel of the drawn target`); the other 14 pass | 15 of 15 pass | | RX 9070 XT | 15 of 15 pass | 15 of 15 pass | Full CTest with this PR, `--parallel 4`: UHD 770 1365 of 1373, RX 9070 XT 1369 of 1373. None of the failures involve multisample targets: - Both: `select_tests` (symlink privilege, #6961). - UHD 770: the five image-table tests (#6647). Also `agc_import_watch` (`the Windows import probe failed at the settle queue (0)`) and `agc_sample_dumps` (access violation in `igvk64.dll`). Both fail the same way on `main` `adb0e7a8c` without this PR. - RX 9070 XT: `agc_driver_quad_pixel_mask` (#6255), and `agc_driver_layered_volume_draw` and `agc_driver_layered_volume_vertex` (the GPL cache swap of #4768, #6436). AI-assisted: yes (Claude Code)
tibzejoker commented 2026-10-17 09:46:34 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by tibzejoker on 2026-10-17T09:46:34Z.


Retest on the affected GPU (#6957): Intel UHD Graphics 770 (driver 32.0.101.6129), with an RTX 4090 (NVIDIA 616.92) in the same machine for comparison. Windows 11, WinLibs GCC 15.2, Release. This PR merged onto main bf2053816; GPU picked with ANYPS5_GPU.

agc_driver_sample_multisample_target:

UHD 770 RTX 4090
main bf2053816 fails: sample 1 of pixel (0, 0) does not hold the stored color into one sample of each pixel of the drawn target passes
main + #6971 (f65cecdda) passes passes
#6973 head b64742f86 passes passes

Multisample-related group (ctest -R 'multisample\|msaa\|resolve\|sample_mask\|image_msaa', 16 tests):

UHD 770 RTX 4090
main 15/16 (only sample_multisample_target fails) 16/16
main + #6971 16/16 16/16

So the read-only layout transition fixes the Intel failure, with nothing newly broken in that group on either GPU.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6232449159 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6971#issuecomment-6232449159). Originally posted by [tibzejoker](https://github.com/tibzejoker) on 2026-10-17T09:46:34Z. --- Retest on the affected GPU (#6957): **Intel UHD Graphics 770** (driver 32.0.101.6129), with an RTX 4090 (NVIDIA 616.92) in the same machine for comparison. Windows 11, WinLibs GCC 15.2, Release. This PR merged onto main `bf2053816`; GPU picked with `ANYPS5_GPU`. `agc_driver_sample_multisample_target`: | | UHD 770 | RTX 4090 | |---|---|---| | main `bf2053816` | **fails**: `sample 1 of pixel (0, 0) does not hold the stored color into one sample of each pixel of the drawn target` | passes | | main + #6971 (`f65cecdda`) | passes | passes | | #6973 head `b64742f86` | passes | passes | Multisample-related group (`ctest -R 'multisample\|msaa\|resolve\|sample_mask\|image_msaa'`, 16 tests): | | UHD 770 | RTX 4090 | |---|---|---| | main | 15/16 (only `sample_multisample_target` fails) | 16/16 | | main + #6971 | 16/16 | 16/16 | So the read-only layout transition fixes the Intel failure, with nothing newly broken in that group on either GPU. AI-assisted (Claude Code).
MarcZX10 commented 2026-10-17 13:18:05 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-17T13:18:05Z.


Thanks for the two independent UHD 770 results. Both show the reported agc_driver_sample_multisample_target failure on main and a pass with this change; the broader multisample groups also pass on UHD 770 and the comparison GPUs. This validates the issue-specific fix across the reported driver versions. I’ll keep the dependency/order with #6635 and the combined #6973 review explicit before changing this PR’s merge state.

AI-assisted: yes (Codex); reports reviewed.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6234347487 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6971#issuecomment-6234347487). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-17T13:18:05Z. --- Thanks for the two independent UHD 770 results. Both show the reported `agc_driver_sample_multisample_target` failure on main and a pass with this change; the broader multisample groups also pass on UHD 770 and the comparison GPUs. This validates the issue-specific fix across the reported driver versions. I’ll keep the dependency/order with #6635 and the combined #6973 review explicit before changing this PR’s merge state. AI-assisted: yes (Codex); reports reviewed.
MarcZX10 commented 2026-10-20 10:15:20 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-20T10:15:20Z.


Status update: #6635 is merged, and open #6973 now contains the multisampled-array support and the read-only sampled-layout commits from this PR, with their authorship preserved. Its current head cafd4f749 is clean. The latest reports cover initial-color preservation on Intel UHD 770 and RX 9070 XT; the separate readback-layout follow-up is tracked in Amoenus/AnyPS5#3. I’m leaving this branch unchanged while that composed series and its follow-up remain active, to avoid publishing duplicate code.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6288640843 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6971#issuecomment-6288640843). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-20T10:15:20Z. --- Status update: #6635 is merged, and open #6973 now contains the multisampled-array support and the read-only sampled-layout commits from this PR, with their authorship preserved. Its current head `cafd4f749` is clean. The latest reports cover initial-color preservation on Intel UHD 770 and RX 9070 XT; the separate readback-layout follow-up is tracked in Amoenus/AnyPS5#3. I’m leaving this branch unchanged while that composed series and its follow-up remain active, to avoid publishing duplicate code.

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