macOS: allow startup without optional Vulkan shader features #633

Closed
github-bot wants to merge 2 commits from gh-pr/633/head into gh-pr/633/base
Owner

@⁠carbonimax on GitHub · 2026-09-16 11:33 UTC · original
carbonimax:fix/macos-optional-vulkan-features → main · +553 −385 · 10 files · 2 commits · closed without merging

On Apple M4 Pro with MoltenVK 1.4.2, Kyty rejects the GPU with
“Could not find suitable device” because shaderBufferInt64Atomics and
shaderCullDistance are required unconditionally.

Make these features optional during macOS device selection and enable
them only when supported. Pass the enabled features to the shader
compiler, which explicitly rejects shaders requiring an unavailable
feature rather than emitting unsupported SPIR-V.

Windows/Linux device-selection requirements remain unchanged.
Related to #398.

Validation

  • Built kyty_emulator and shader_cfg_tests for macOS x86_64.
  • Passed all five selected CTest targets, including shader regressions
    covering supported and unsupported feature combinations.
  • Passed the project's clang-format 22.1.3 pre-commit hook. The hook also
    normalized existing formatting in the touched source files.
  • On M4 Pro, device selection, VkDevice creation and swapchain
    initialization now succeed.

Limitations

This does not emulate either feature or establish compatibility with
the game. The game proceeds past graphics initialization, then encounters
a separate CPU exception at an SSE4a instruction.

Windows/Linux builds have not been tested. The additional GPU test target
could not be built because of an existing uintptr_t/uint64_t initializer
list mismatch in ShaderRecompilerComputeTests.cpp.

AI assistance

AI assistance was used for implementation, tests and this description.
Human code review is pending.

**@⁠carbonimax** on GitHub · 2026-09-16 11:33 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/633) `carbonimax:fix/macos-optional-vulkan-features` → `main` · +553 −385 · 10 files · 2 commits · closed without merging On Apple M4 Pro with MoltenVK 1.4.2, Kyty rejects the GPU with “Could not find suitable device” because `shaderBufferInt64Atomics` and `shaderCullDistance` are required unconditionally. Make these features optional during macOS device selection and enable them only when supported. Pass the enabled features to the shader compiler, which explicitly rejects shaders requiring an unavailable feature rather than emitting unsupported SPIR-V. Windows/Linux device-selection requirements remain unchanged. Related to #398. ### Validation - Built `kyty_emulator` and `shader_cfg_tests` for macOS x86_64. - Passed all five selected CTest targets, including shader regressions covering supported and unsupported feature combinations. - Passed the project's clang-format 22.1.3 pre-commit hook. The hook also normalized existing formatting in the touched source files. - On M4 Pro, device selection, `VkDevice` creation and swapchain initialization now succeed. ### Limitations This does not emulate either feature or establish compatibility with the game. The game proceeds past graphics initialization, then encounters a separate CPU exception at an SSE4a instruction. Windows/Linux builds have not been tested. The additional GPU test target could not be built because of an existing `uintptr_t`/`uint64_t` initializer list mismatch in `ShaderRecompilerComputeTests.cpp`. ### AI assistance AI assistance was used for implementation, tests and this description. Human code review is pending.
Apply the repository's pinned clang-format 22.1.3 hook to the source files modified by this pull request.

Assisted-by: OpenAI GPT-6.1 Sol
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:27:33 +00:00
github-bot closed this pull request 2026-11-26 09:27:33 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-09-16 11:33 UTC · original · edited 2026-10-13 22:44 UTC

Review in Change Stack →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 29e6beab-3184-4083-893d-d49df537ad07

📥 Commits

Reviewing files that changed from the base of the PR and between d584eb78076b94edba79ea9240bb7a36b8fbf93d and bd71c6f5719e6bd9e3cd1cc1cef6fbecb25eacca.

📒 Files selected for processing (4)
  • src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp
  • src/graphics/shader/recompiler/backend/spirv/SpirvEmitter.cpp
  • src/graphics/shader/shader.h
  • tests/shaderCfgTests.cpp
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/graphics/shader/shader.h

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.

📝 Walkthrough

Walkthrough

The change adds Vulkan capability flags for shader buffer 64-bit atomics and cull distance. Device creation queries and records feature support. ProgramCache passes these capabilities into shader compilation. SPIR-V emission rejects unsupported shader requirements. Image-view minimum-LOD requests now require recorded support. Tests cover supported and unsupported shader features.

Suggested reviewers: nmzik

Priority: ➖ Normal

Change: Bug fix

Merge Risk: ⚪ Minimal · up to bd71c

The change allows supported macOS devices to start while rejecting shaders that require unavailable Vulkan features. Current evidence supports merge readiness.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 15.15% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 33 functions across 9 files. (1 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: allowing macOS startup when optional Vulkan shader features are unavailable.
Description check ✅ Passed The description directly explains the macOS Vulkan feature changes, shader compiler handling, validation, and limitations.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 15.15% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 33 functions across 9 files. (1 skipped: 1 too large.)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

**@⁠coderabbitai[bot]** on GitHub · 2026-09-16 11:33 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/633#issuecomment-5696763933) · edited 2026-10-13 22:44 UTC <!-- This is an auto-generated comment: summarize by coderabbit.ai --> <!-- review_stack_entry_start --> <a href="https://app.coderabbit.ai/change-stack/KytyPS5/KytyPS5/pull/633"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui-dark.svg?v=2" alt="Review in Change Stack →" width="220" height="32"></a> <!-- review_stack_entry_end --> <!-- This is an auto-generated comment: review paused by coderabbit.ai --> > [!NOTE] > ## Reviews paused > > It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the `reviews.auto_review.auto_pause_after_reviewed_commits` setting. > > Use the following commands to manage reviews: > - `@coderabbitai resume` to resume automatic reviews. > - `@coderabbitai review` to trigger a single review. > > Use the checkboxes below for quick actions: > - [ ] <!-- {"checkboxId":"7f6cc2e2-2e4e-497a-8c31-c9e4573e93d1"} --> ▶️ Resume reviews > - [ ] <!-- {"checkboxId":"e9bb8d72-00e8-4f67-9cb2-caf3b22574fe"} --> 🔍 Trigger review <!-- end of auto-generated comment: review paused by coderabbit.ai --> <!-- recent_review_start --> No actionable comments were generated in the recent review. 🎉 <details> <summary><strong>ℹ️ Recent review info</strong></summary> <dl> <dd> <details> <summary><strong>⚙️ Run configuration</strong></summary> <dl> <dd> **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml **Review profile**: CHILL **Plan**: Advanced **Run ID**: `29e6beab-3184-4083-893d-d49df537ad07` </dd> </dl> </details> <details> <summary><strong>📥 Commits</strong></summary> <dl> <dd> Reviewing files that changed from the base of the PR and between d584eb78076b94edba79ea9240bb7a36b8fbf93d and bd71c6f5719e6bd9e3cd1cc1cef6fbecb25eacca. </dd> </dl> </details> <details> <summary><strong>📒 Files selected for processing (4)</strong></summary> <dl> <dd> * `src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp` * `src/graphics/shader/recompiler/backend/spirv/SpirvEmitter.cpp` * `src/graphics/shader/shader.h` * `tests/shaderCfgTests.cpp` </dd> </dl> </details> <details> <summary><strong>🚧 Files skipped from review as they are similar to previous changes (1)</strong></summary> <dl> <dd> * src/graphics/shader/shader.h </dd> </dl> </details> **Included review availability:** Your plan provides up to 10 included reviews per hour; 9 remain after this review. </dd> </dl> </details> <!-- recent_review_end --> <!-- walkthrough_start --> <details> <summary><strong>📝 Walkthrough</strong></summary> <dl> <dd> ## Walkthrough The change adds Vulkan capability flags for shader buffer 64-bit atomics and cull distance. Device creation queries and records feature support. `ProgramCache` passes these capabilities into shader compilation. SPIR-V emission rejects unsupported shader requirements. Image-view minimum-LOD requests now require recorded support. Tests cover supported and unsupported shader features. **Suggested reviewers:** `nmzik` </dd> </dl> </details> <!-- walkthrough_end --> <!-- change_assessment_start --> **Priority:** ➖ Normal <!-- change_assessment_commit:"bd71c6f5719e6bd9e3cd1cc1cef6fbecb25eacca" --> **Change:** Bug fix <!-- change_assessment_end --> <details> <summary><strong>Merge Risk:</strong> <strong>⚪ Minimal</strong> · up to <code>bd71c</code></summary> <dl> <dd> <!-- final_review_risk_start --> <!-- final_review_risk_label **Merge Risk:** _⚪ Minimal_ · up to `bd71c` --> <!-- final_review_risk_coverage:{"sourceCommitId":"bd71c6f5719e6bd9e3cd1cc1cef6fbecb25eacca","coveredCommitId":"bd71c6f5719e6bd9e3cd1cc1cef6fbecb25eacca","kind":"reviewed"} --> The change allows supported macOS devices to start while rejecting shaders that require unavailable Vulkan features. Current evidence supports merge readiness. <!-- final_review_risk_end --> </dd> </dl> </details> <!-- pre_merge_checks_walkthrough_start --> <details> <summary><strong>🚥 Pre-merge checks | ✅ 4 | ❌ 1</strong></summary> <dl> <dd> ### ❌ Failed checks (1 warning) | Check name | Status | Explanation | Resolution | | :---------------- | :--------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------- | | Docstring Coverage | ⚠️ Warning | Docstring coverage is 15.15% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 33 functions across 9 files. (1 skipped: … | Write docstrings for the functions missing them to satisfy the coverage threshold. | <details> <summary><strong>✅ Passed checks (4 passed)</strong></summary> <dl> <dd> | Check name | Status | Explanation | | :------------------------ | :------- | :-------------------------------------------------------------------------------------------------------------------------------------- | | Title check | ✅ Passed | The title clearly and concisely describes the main change: allowing macOS startup when optional Vulkan shader features are unavailable. | | Description check | ✅ Passed | The description directly explains the macOS Vulkan feature changes, shader compiler handling, validation, and limitations. | | Linked Issues check | ✅ Passed | Check skipped because no linked issues were found for this pull request. | | Out of Scope Changes check | ✅ Passed | Check skipped because no linked issues were found for this pull request. | </dd> </dl> </details> <details> <summary><strong>Full details: Docstring Coverage</strong></summary> <dl> <dd> **Explanation** Docstring coverage is 15.15% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 33 functions across 9 files. (1 skipped: 1 too large.) </dd> </dl> </details> </dd> </dl> </details> <!-- pre_merge_checks_walkthrough_end --> <!-- tips_start --> Thanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=KytyPS5/KytyPS5&utm_content=633)! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. <details> <summary><strong>❤️ Share</strong></summary> <dl> <dd> - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code) </dd> </dl> </details> <sub>Comment `@coderabbitai help` to get the list of available commands.</sub> <!-- tips_end -->
Author
Owner

@⁠carbonimax on GitHub · 2026-10-01 17:39 UTC · original

CI update: Windows and Linux builds pass. The macOS job builds successfully, then fails in the unchanged memory_tracker test (fixed VirtualAlloc failed), with 12/13 tests passing. Local x86_64 Release build and shader_cfg_tests pass for this head. The macOS job on main 44798085 also fails in page_manager on fixed low mach_vm_allocate. These PRs do not modify the reservation tests or their implementation.

I tried rerunning the failed job, but GitHub requires repository admin rights. Could a maintainer rerun the failed macOS job? No reservation-code workaround is included in this PR.

**@⁠carbonimax** on GitHub · 2026-10-01 17:39 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/633#issuecomment-5937013320) CI update: Windows and Linux builds pass. The macOS job builds successfully, then fails in the unchanged `memory_tracker` test (`fixed VirtualAlloc failed`), with 12/13 tests passing. Local x86_64 Release build and shader_cfg_tests pass for this head. The macOS job on main 44798085 also fails in `page_manager` on fixed low mach_vm_allocate. These PRs do not modify the reservation tests or their implementation. I tried rerunning the failed job, but GitHub requires repository admin rights. Could a maintainer rerun [the failed macOS job](https://github.com/KytyPS5/KytyPS5/actions/runs/36897663129)? No reservation-code workaround is included in this PR.
Author
Owner

@⁠carbonimax on GitHub · 2026-10-01 19:58 UTC · original

The macOS CI reservation failure is now addressed by a test-only fix. The tests no longer assume that the low address 0x200010000 is free: Mach chooses available memory while preserving the offset within the 4 MiB tracker region and checking that the allocation remains in the valid low guest range. The extended-range test keeps its fixed address.

A regression case deliberately occupies the preferred address, verifies relocation without overwriting that mapping, and retains the existing protection and region-boundary assertions. Both memory_tracker and page_manager fail with the fixed-address allocator and pass with the corrected allocator (2/2), on the same tests. The tested memory sources and helper are identical across #633, #643 and #741. No emulator runtime or submission protocol change is included.

The updated head triggers a fresh CI run; local success is not being reported as a GitHub CI result.

**@⁠carbonimax** on GitHub · 2026-10-01 19:58 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/633#issuecomment-5939454018) The macOS CI reservation failure is now addressed by a test-only fix. The tests no longer assume that the low address 0x200010000 is free: Mach chooses available memory while preserving the offset within the 4 MiB tracker region and checking that the allocation remains in the valid low guest range. The extended-range test keeps its fixed address. A regression case deliberately occupies the preferred address, verifies relocation without overwriting that mapping, and retains the existing protection and region-boundary assertions. Both memory_tracker and page_manager fail with the fixed-address allocator and pass with the corrected allocator (2/2), on the same tests. The tested memory sources and helper are identical across #633, #643 and #741. No emulator runtime or submission protocol change is included. The updated head triggers a fresh CI run; local success is not being reported as a GitHub CI result.
Author
Owner

@⁠Nmzik on GitHub · 2026-10-21 19:42 UTC · original

Duplicate of #1547.

**@⁠Nmzik** on GitHub · 2026-10-21 19:42 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/633#issuecomment-6324943624) Duplicate of #1547.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.