fix(agc): name every layer in whole-image storage texture barriers #15438

Merged
CodingBreadd merged 1 commit from upstream-pr/15438 into main 2026-11-07 12:38:32 +00:00
CodingBreadd commented 2026-11-03 09:51:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by CodingBreadd on 2026-11-03T09:51:42Z.


What

Whole-image barriers and clears on storage textures in Texture.cpp passed geometry.imageLayers as layerCount. A 3D storage image is created with VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT and one array layer, so the count is 1. Without maintenance9 that means every depth slice. With maintenance9 it means one slice, and the rest of the volume would not be synchronised. The validation layer reports WARNING-VkImageSubresourceRange-layerCount-compatibility for these calls.

The 14 whole-image ranges in StorageTexture (upload, writeBackWindows, writeBackLayers, FlushDumpSelected and the other barrier and clear sites using {COLOR, 0, mipCount, 0, imageLayers}) now use VK_REMAINING_ARRAY_LAYERS. These ranges are only passed to vkCmdPipelineBarrier and vkCmdClearColorImage, never read as a number. For 2D and array images the result is unchanged. The two barrier-pair sites also cover all layers of the source image instead of assuming the destination's count.

Sampled Texture images are not created 2D_ARRAY_COMPATIBLE and are left unchanged.

Tested

Arch Linux, main 4f41f4c375 vs this branch, same machine, Release build. Command: ctest --test-dir build -R '^agc_|shader|recompiler|spirv|video_out|videoout' with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1 and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation. Neither log contains was not found but was requested by env var VK_INSTANCE_LAYERS.

  • NVIDIA (ANYPS5_GPU=NVIDIA): 1323/1323 passed on both main and this branch. layerCount-compatibility warnings went from 100 (11 tests) to 0. No new VUID-. The only VUID- on both is VkPipelineColorBlendStateCreateInfo-pAttachments-00605 in agc_driver_prepared_exports and agc_driver_srgb8_color_target, which is #11990.
  • lavapipe (ANYPS5_GPU=llvmpipe), the 11 affected tests (agc_driver_image_store_array_through_volume, agc_driver_layered_volume_{draw,submit,mesh,vertex,vertex_no_gpl}, agc_driver_mesh_provoking_layer, agc_driver_storage_write_back_no_window, agc_driver_volume_mip_targets, agc_driver_volume_direct_readback, agc_storage_idle_writeback_race): 11/11 passed, no warnings, no VUID-.
  • The call sites were found by breaking on the warning (VK_KHRONOS_VALIDATION_DEBUG_ACTION=VK_DBG_LAYER_ACTION_BREAK) under gdb for each affected test.

Overlap: draft #6280 changes the mip-level argument of the same lines (descriptor.mipCount to geometry.imageLevels). The two changes touch different arguments, so whichever lands second resolves to {..., 0, geometry.imageLevels, 0, VK_REMAINING_ARRAY_LAYERS}.

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
  • Fixes: none
  • Unblocks: none
  • GPUs tested: NVIDIA GeForce RTX 4060 Laptop GPU, driver 615.78.08, Arch Linux (Vulkan 1.4.351); lavapipe (llvmpipe, Mesa 26.2.5, LLVM 23.1.3), Arch Linux
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5135158410 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15438). Originally posted by [CodingBreadd](https://github.com/CodingBreadd) on 2026-11-03T09:51:42Z. --- ### What Whole-image barriers and clears on storage textures in `Texture.cpp` passed `geometry.imageLayers` as `layerCount`. A 3D storage image is created with `VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT` and one array layer, so the count is 1. Without `maintenance9` that means every depth slice. With `maintenance9` it means one slice, and the rest of the volume would not be synchronised. The validation layer reports `WARNING-VkImageSubresourceRange-layerCount-compatibility` for these calls. The 14 whole-image ranges in `StorageTexture` (`upload`, `writeBackWindows`, `writeBackLayers`, `FlushDumpSelected` and the other barrier and clear sites using `{COLOR, 0, mipCount, 0, imageLayers}`) now use `VK_REMAINING_ARRAY_LAYERS`. These ranges are only passed to `vkCmdPipelineBarrier` and `vkCmdClearColorImage`, never read as a number. For 2D and array images the result is unchanged. The two barrier-pair sites also cover all layers of the source image instead of assuming the destination's count. Sampled `Texture` images are not created `2D_ARRAY_COMPATIBLE` and are left unchanged. ### Tested Arch Linux, `main` 4f41f4c375 vs this branch, same machine, Release build. Command: `ctest --test-dir build -R '^agc_|shader|recompiler|spirv|video_out|videoout'` with `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1` and `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`. Neither log contains `was not found but was requested by env var VK_INSTANCE_LAYERS`. - NVIDIA (`ANYPS5_GPU=NVIDIA`): 1323/1323 passed on both `main` and this branch. `layerCount-compatibility` warnings went from 100 (11 tests) to 0. No new `VUID-`. The only `VUID-` on both is `VkPipelineColorBlendStateCreateInfo-pAttachments-00605` in `agc_driver_prepared_exports` and `agc_driver_srgb8_color_target`, which is #11990. - lavapipe (`ANYPS5_GPU=llvmpipe`), the 11 affected tests (`agc_driver_image_store_array_through_volume`, `agc_driver_layered_volume_{draw,submit,mesh,vertex,vertex_no_gpl}`, `agc_driver_mesh_provoking_layer`, `agc_driver_storage_write_back_no_window`, `agc_driver_volume_mip_targets`, `agc_driver_volume_direct_readback`, `agc_storage_idle_writeback_race`): 11/11 passed, no warnings, no `VUID-`. - The call sites were found by breaking on the warning (`VK_KHRONOS_VALIDATION_DEBUG_ACTION=VK_DBG_LAYER_ACTION_BREAK`) under gdb for each affected test. Overlap: draft #6280 changes the mip-level argument of the same lines (`descriptor.mipCount` to `geometry.imageLevels`). The two changes touch different arguments, so whichever lands second resolves to `{..., 0, geometry.imageLevels, 0, VK_REMAINING_ARRAY_LAYERS}`. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [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 - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: NVIDIA GeForce RTX 4060 Laptop GPU, driver 615.78.08, Arch Linux (Vulkan 1.4.351); lavapipe (llvmpipe, Mesa 26.2.5, LLVM 23.1.3), Arch Linux - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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!15438
No description provided.