fix(agc): typed image heaps on devices without nullDescriptor #2015

Merged
arvindfroi merged 1 commit from upstream-pr/2015 into main 2026-10-11 08:48:40 +00:00
arvindfroi commented 2026-10-09 05:07:37 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by arvindfroi on 2026-10-09T05:07:37Z.


What

The typed descriptor heaps (dccfa08d) write a null descriptor for a null guest image, so VulkanDevice required VK_EXT_robustness2's nullDescriptor. MoltenVK has the extension but not the feature (KhronosGroup/MoltenVK#2650). On macOS no Vulkan device opens (shader runtime requires nullDescriptor), and every GPU test is skipped. jamesst20 reported this in #1.

  • nullDescriptor is enabled when the device has it. Nothing changes on such a device: no placeholders are made, and a null image is still a null descriptor.
  • Without it, the device makes PlaceholderImages at setup: one image per typed image heap, 1×1 and cleared to zero, with the heap's dimension, sample count, numeric class (float, uint, sint or depth) and access (sampled, storage or atomic). A null guest image binds its heap's placeholder.
    • A heap whose placeholder the device cannot create throws when a null image reaches it.
  • ShaderDeviceProfile no longer requires nullDescriptor.
  • TechnicalDebt.md lists where a placeholder differs from a null descriptor: writes to a null storage image are kept, and depth comparisons compare against 0.
  • agc_placeholder_images (no GPU needed) maps every image resource through the recompiler's DescriptorBindingForImage and checks the placeholder of each of the 56 heaps against it, so the two cannot drift apart.

#293 binds a 1×1 zero texture for an all-zero sampled descriptor, written before the typed heaps. This PR only covers devices without nullDescriptor; on other devices it keeps main's null descriptors.

Tested

macOS 27.0, Apple M3 Pro, Homebrew's MoltenVK 1.4.2 and Vulkan loader 1.4.363.0. main does not build on macOS yet, so I tested this commit on main merged locally with the arm64 macOS libraries (mugurc/AnyPS5#3). I resolved that merge's conflicts for the test only; they are not part of this PR.

  • Before: all 248 agc_* tests were skipped with shader runtime requires nullDescriptor.
  • After, run one at a time with --timeout 30, without agc_driver_lds_atomics64 and the flip/display tests: 208 pass, 25 skip and 15 fail. None of the failures involves null images:
    • device limits of Metal and MoltenVK: 64-bit buffer atomics (buffer_unaligned_base), Float64 (interpolation_f16), and vertex-stage subgroups (exec_host_lanes, ngg_vertex_wave_info);
    • SPIRV-Cross's fma(l, r, 0) turning -0.0 into +0.0 (sdwa_float_selectors, f32_denormal_flush, f32_output_modifier, packed_alu);
    • a pipeline MoltenVK refuses (lds_src2), and the descriptor and interlock limits already known on macOS (many_buffers, pixel_interlock);
    • prepared_shaders and its 3 variants, which need multisampled storage. A separate PR fixes the test.
  • agc_driver_typed_heaps reads a null image and expects zeros. It passes through a placeholder.
  • agc_placeholder_images and agc_shader_device_profile pass.
  • Linux and Windows: not tested here. A device with nullDescriptor takes the same path as before.

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 TechnicalDebt
  • 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 (none is added)
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes (Claude Code, Claude Opus 5.5)

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4796245010 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2015). Originally posted by [arvindfroi](https://github.com/arvindfroi) on 2026-10-09T05:07:37Z. --- ### What The typed descriptor heaps (dccfa08d) write a null descriptor for a null guest image, so `VulkanDevice` required `VK_EXT_robustness2`'s `nullDescriptor`. MoltenVK has the extension but not the feature (KhronosGroup/MoltenVK#2650). On macOS no Vulkan device opens (`shader runtime requires nullDescriptor`), and every GPU test is skipped. jamesst20 reported this in #1. - `nullDescriptor` is enabled when the device has it. Nothing changes on such a device: no placeholders are made, and a null image is still a null descriptor. - Without it, the device makes `PlaceholderImages` at setup: one image per typed image heap, 1×1 and cleared to zero, with the heap's dimension, sample count, numeric class (float, uint, sint or depth) and access (sampled, storage or atomic). A null guest image binds its heap's placeholder. - A heap whose placeholder the device cannot create throws when a null image reaches it. - `ShaderDeviceProfile` no longer requires `nullDescriptor`. - `TechnicalDebt.md` lists where a placeholder differs from a null descriptor: writes to a null storage image are kept, and depth comparisons compare against 0. - `agc_placeholder_images` (no GPU needed) maps every image resource through the recompiler's `DescriptorBindingForImage` and checks the placeholder of each of the 56 heaps against it, so the two cannot drift apart. #293 binds a 1×1 zero texture for an all-zero sampled descriptor, written before the typed heaps. This PR only covers devices without `nullDescriptor`; on other devices it keeps main's null descriptors. ### Tested macOS 27.0, Apple M3 Pro, Homebrew's MoltenVK 1.4.2 and Vulkan loader 1.4.363.0. `main` does not build on macOS yet, so I tested this commit on `main` merged locally with the arm64 macOS libraries (mugurc/AnyPS5#3). I resolved that merge's conflicts for the test only; they are not part of this PR. - Before: all 248 `agc_*` tests were skipped with `shader runtime requires nullDescriptor`. - After, run one at a time with `--timeout 30`, without `agc_driver_lds_atomics64` and the flip/display tests: 208 pass, 25 skip and 15 fail. None of the failures involves null images: - device limits of Metal and MoltenVK: 64-bit buffer atomics (`buffer_unaligned_base`), Float64 (`interpolation_f16`), and vertex-stage subgroups (`exec_host_lanes`, `ngg_vertex_wave_info`); - SPIRV-Cross's `fma(l, r, 0)` turning -0.0 into +0.0 (`sdwa_float_selectors`, `f32_denormal_flush`, `f32_output_modifier`, `packed_alu`); - a pipeline MoltenVK refuses (`lds_src2`), and the descriptor and interlock limits already known on macOS (`many_buffers`, `pixel_interlock`); - `prepared_shaders` and its 3 variants, which need multisampled storage. A separate PR fixes the test. - `agc_driver_typed_heaps` reads a null image and expects zeros. It passes through a placeholder. - `agc_placeholder_images` and `agc_shader_device_profile` pass. - Linux and Windows: not tested here. A device with `nullDescriptor` takes the same path as before. ### 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 in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [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 (none is added) - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes (Claude Code, Claude Opus 5.5) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Zheorgyan commented 2026-10-09 09:47:04 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Zheorgyan on 2026-10-09T09:47:04Z.


tested on an M1 Pro, x86-64 under Rosetta, MoltenVK from Vulkan SDK 1.4.363.0, on macos-port merged with main, this PR, #2016 and #2099. agc_driver_typed_heaps, agc_placeholder_images and agc_shader_device_profile pass, and the whole agc_* set gives 213 pass, 25 skip, 12 fail. the failures are the 11 from your list plus vop1_float_unary, which #1571 fixes, none involves null images

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6078483481 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2015#issuecomment-6078483481). Originally posted by [Zheorgyan](https://github.com/Zheorgyan) on 2026-10-09T09:47:04Z. --- tested on an M1 Pro, x86-64 under Rosetta, MoltenVK from Vulkan SDK 1.4.363.0, on `macos-port` merged with `main`, this PR, #2016 and #2099. `agc_driver_typed_heaps`, `agc_placeholder_images` and `agc_shader_device_profile` pass, and the whole `agc_*` set gives 213 pass, 25 skip, 12 fail. the failures are the 11 from your list plus `vop1_float_unary`, which #1571 fixes, none involves null images
popcoder565 commented 2026-10-09 15:23:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by popcoder565 on 2026-10-09T15:23:53Z.


Native Windows run, since no Windows results were posted. Setup: Windows 10 (19045), RTX 3060 Laptop (NVIDIA 616.92), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release. Head 17713d1c, merged onto main d70b8998 in one build with 33 other AGC/shader PRs that had no Windows run.

  • This PR's tests pass: agc_placeholder_images, agc_shader_device_profile. None of them reported skipping a case.
  • Full ctest in that build: 514 of 515. The one failure is #2257's new test, which is registered without the Windows PATH setup.

No title was run.

🤖 Addressed by Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6083897668 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2015#issuecomment-6083897668). Originally posted by [popcoder565](https://github.com/popcoder565) on 2026-10-09T15:23:53Z. --- Native Windows run, since no Windows results were posted. Setup: Windows 10 (19045), RTX 3060 Laptop (NVIDIA 616.92), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release. Head `17713d1c`, merged onto `main` d70b8998 in one build with 33 other AGC/shader PRs that had no Windows run. - This PR's tests pass: `agc_placeholder_images`, `agc_shader_device_profile`. None of them reported skipping a case. - Full ctest in that build: 514 of 515. The one failure is #2257's new test, which is registered without the Windows `PATH` setup. No title was run. _🤖 Addressed by [Claude Code](https://claude.com/claude-code)_
Mouhand-Kaddo commented 2026-10-10 10:11:57 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Mouhand-Kaddo on 2026-10-10T10:11:57Z.


Additional platform validation on standalone PR head b288aa84eca4ebfce7000f741e32b7d65c865e34:

Linux: passed — Arch Linux in WSL2 (kernel 6.6.87.2), GCC 16.2.1 20260810; CMake 4.3.1 / Ninja.

Release / BUILD_TESTING=ON: built the selected test targets; 3 CTest cases, 0 failures, 0 CTest skips.

Tests: agc_shader_device_profile, agc_placeholder_images, agc_driver_typed_heaps.

Reproduce after building the test targets: ctest --test-dir <build> --verbose --no-tests=error --timeout 30 -R "^agc_(placeholder_images|shader_device_profile|driver_typed_heaps)$".

Vulkan: Mesa lavapipe 26.2.4 software Vulkan; no native Linux GPU/retail-title validation.

Integration limitation: a local merge against main 948a526c2 has source conflicts; these results validate the standalone PR head, not a resolved merge.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6096444740 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2015#issuecomment-6096444740). Originally posted by [Mouhand-Kaddo](https://github.com/Mouhand-Kaddo) on 2026-10-10T10:11:57Z. --- <!-- anyps5-platform-validation:b288aa84eca4ebfce7000f741e32b7d65c865e34 --> Additional platform validation on standalone PR head `b288aa84eca4ebfce7000f741e32b7d65c865e34`: **Linux: passed** — Arch Linux in WSL2 (kernel 6.6.87.2), GCC 16.2.1 20260810; CMake 4.3.1 / Ninja. Release / `BUILD_TESTING=ON`: built the selected test targets; 3 CTest cases, 0 failures, 0 CTest skips. Tests: `agc_shader_device_profile`, `agc_placeholder_images`, `agc_driver_typed_heaps`. Reproduce after building the test targets: `ctest --test-dir <build> --verbose --no-tests=error --timeout 30 -R "^agc_(placeholder_images|shader_device_profile|driver_typed_heaps)$"`. Vulkan: Mesa lavapipe 26.2.4 software Vulkan; no native Linux GPU/retail-title validation. Integration limitation: a local merge against main `948a526c2` has source conflicts; these results validate the standalone PR head, not a resolved merge.
adriadam10 commented 2026-10-11 08:45:05 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T08:45:05Z.


Rebased onto current main (mechanical conflicts in libSceAgcDriver/CMakeLists.txt test list, VulkanDevice.cpp and TechnicalDebt.md; no logic changes).

Checked on Linux (RADV): build + ctest of libSceAgcDriver, libSceAgc, libkernel, libSceRtc all green (409 tests), including agc_placeholder_images, agc_shader_device_profile and agc_driver_typed_heaps. Without the change the new test does not build. The placeholder path itself is covered by the macOS/MoltenVK, Windows and WSL runs above in the thread; merging once CI is green.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6107256860 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2015#issuecomment-6107256860). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T08:45:05Z. --- Rebased onto current `main` (mechanical conflicts in `libSceAgcDriver/CMakeLists.txt` test list, `VulkanDevice.cpp` and `TechnicalDebt.md`; no logic changes). Checked on Linux (RADV): build + ctest of `libSceAgcDriver`, `libSceAgc`, `libkernel`, `libSceRtc` all green (409 tests), including `agc_placeholder_images`, `agc_shader_device_profile` and `agc_driver_typed_heaps`. Without the change the new test does not build. The placeholder path itself is covered by the macOS/MoltenVK, Windows and WSL runs above in the thread; merging once CI is green.
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!2015
No description provided.