fix(agc): enable VK_KHR_sampler_mirror_clamp_to_edge for mirror-once guest samplers #13145

Merged
Prophet069 merged 1 commit from upstream-pr/13145 into main 2026-11-04 20:00:32 +00:00
Prophet069 commented 2026-10-30 04:15:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Prophet069 on 2026-10-30T04:15:54Z.


What

Guest clamp modes 3, 5 and 7 (mirror once) decode to VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE, but the device never enabled VK_KHR_sampler_mirror_clamp_to_edge, so every such sampler is created invalidly (VUID-VkSamplerCreateInfo-addressModeU-01079 and the addressMode{U,V,W}-parameter VUIDs). The device now enables the extension when the physical device offers it and passes that to Context; on a device without it, Sampler::Validate refuses a mirror-once sampler instead of creating it. RunMirrorOnceTests in GuestSamplerResource.cpp checks each mirror-once mode on each axis with and without the extension.

Tested

  • With ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1 and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation (VVL vulkan-sdk-1.4.321.0; neither log contains was not found but was requested by env var VK_INSTANCE_LAYERS), ctest --test-dir build -R <the 63 tests of agc_shader_memory_tests, agc_driver_cmask_fast_clear_tests, agc_driver_graphics_tests and agc_driver_sample_multisample_target_tests> -V on main 8c8b998620 and on this branch, same machine and GPU: main 63/63 passed, 0 VUID-; this branch 63/63 passed (including the new mirror-once cases), 0 VUID-.
  • On an earlier base with the 3D gather series (#9183) applied, agc_driver_image_gather_volume logged 8 VUID- lines from these samplers without this change and 0 with it. On current main no test creates a mirror-once sampler on a real device, so main's own run does not show them.
  • The commit changes only the files listed in the diff; it no longer carries the pre-#12916/#12923 tree of the first push.

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 3080 Laptop GPU (8 GB), driver 616.64, Windows 10 Pro 19045
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5079377274 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13145). Originally posted by [Prophet069](https://github.com/Prophet069) on 2026-10-30T04:15:54Z. --- ### What Guest clamp modes 3, 5 and 7 (mirror once) decode to `VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE`, but the device never enabled `VK_KHR_sampler_mirror_clamp_to_edge`, so every such sampler is created invalidly (`VUID-VkSamplerCreateInfo-addressModeU-01079` and the `addressMode{U,V,W}-parameter` VUIDs). The device now enables the extension when the physical device offers it and passes that to `Context`; on a device without it, `Sampler::Validate` refuses a mirror-once sampler instead of creating it. `RunMirrorOnceTests` in `GuestSamplerResource.cpp` checks each mirror-once mode on each axis with and without the extension. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> - With `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1` and `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation` (VVL vulkan-sdk-1.4.321.0; neither log contains `was not found but was requested by env var VK_INSTANCE_LAYERS`), `ctest --test-dir build -R <the 63 tests of agc_shader_memory_tests, agc_driver_cmask_fast_clear_tests, agc_driver_graphics_tests and agc_driver_sample_multisample_target_tests> -V` on main `8c8b998620` and on this branch, same machine and GPU: main 63/63 passed, 0 `VUID-`; this branch 63/63 passed (including the new mirror-once cases), 0 `VUID-`. - On an earlier base with the 3D gather series (#9183) applied, `agc_driver_image_gather_volume` logged 8 `VUID-` lines from these samplers without this change and 0 with it. On current main no test creates a mirror-once sampler on a real device, so main's own run does not show them. - The commit changes only the files listed in the diff; it no longer carries the pre-#12916/#12923 tree of the first push. ### 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 3080 Laptop GPU (8 GB), driver 616.64, Windows 10 Pro 19045 - [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!13145
No description provided.