graphics: make minLod, buffer int64 atomics and cull distance optional on macOS #1082

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

@⁠overlordxrz-source on GitHub · 2026-10-05 21:56 UTC · original
overlordxrz-source:mac/optional-minlod-int64-cull → main · +93 −5 · 3 files · 2 commits · closed without merging

Fixes device-selection failure on Apple Silicon reported in #1068.

MoltenVK v1.4.2 (bundled release) never exposes:

  • image view minLod (extension not exposed at all)
  • shaderBufferInt64Atomics (hardcoded false in MVKDevice.mm)
  • shaderCullDistance (maxCullDistances = 0)

Previously all three were hard requirements on every platform, so VulkanFindPhysicalDevice rejected every Mac GPU with exit 65 before any game loaded.

This change, Apple-only:

  • logs instead of rejecting those three in VulkanFindPhysicalDevice
  • removes VK_EXT_IMAGE_VIEW_MIN_LOD from the common required list (non-Apple only now)
  • at creation, only chains/requests minLod when the extension is present, follows supported shaderBufferInt64Atomics / shaderCullDistance values
  • Image::FindView skips VkImageViewMinLodCreateInfoEXT when the device did not enable it (min-LOD approximated by base level)
  • adds GraphicContext flags: image_view_min_lod_enabled, shader_buffer_int64_atomics_enabled, shader_cull_distance_enabled

Complementary to #959 (barycentrics); does not yet add shader fallbacks for CullDistance outputs / 64-bit buffer atomics, nor the vertex-stage subgroup guard (supportedStages=0) noted as the next blocker in #1068.

Testing performed:

  • cmake no-Qt x86_64 configure OK (matches official macOS Rosetta target)
  • kyty_emulator x86_64 build succeeds, exit 0
  • ctest 34/50 pass; 16 GPU-harness tests abort with 'could not load the Vulkan loader' — reproduced on clean tree, environmental, not a regression

AI disclosure (per repo AI Use policy): AI tooling assisted with code exploration and patch drafting. Human reviewed the full diff, built kyty_emulator (x86_64) and ran ctest before submitting, and remains responsible for correctness.

**@⁠overlordxrz-source** on GitHub · 2026-10-05 21:56 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1082) `overlordxrz-source:mac/optional-minlod-int64-cull` → `main` · +93 −5 · 3 files · 2 commits · closed without merging Fixes device-selection failure on Apple Silicon reported in #1068. MoltenVK v1.4.2 (bundled release) never exposes: - image view minLod (extension not exposed at all) - shaderBufferInt64Atomics (hardcoded false in MVKDevice.mm) - shaderCullDistance (maxCullDistances = 0) Previously all three were hard requirements on every platform, so VulkanFindPhysicalDevice rejected every Mac GPU with exit 65 before any game loaded. This change, Apple-only: - logs instead of rejecting those three in VulkanFindPhysicalDevice - removes VK_EXT_IMAGE_VIEW_MIN_LOD from the common required list (non-Apple only now) - at creation, only chains/requests minLod when the extension is present, follows supported shaderBufferInt64Atomics / shaderCullDistance values - Image::FindView skips VkImageViewMinLodCreateInfoEXT when the device did not enable it (min-LOD approximated by base level) - adds GraphicContext flags: image_view_min_lod_enabled, shader_buffer_int64_atomics_enabled, shader_cull_distance_enabled Complementary to #959 (barycentrics); does not yet add shader fallbacks for CullDistance outputs / 64-bit buffer atomics, nor the vertex-stage subgroup guard (supportedStages=0) noted as the next blocker in #1068. Testing performed: - cmake no-Qt x86_64 configure OK (matches official macOS Rosetta target) - kyty_emulator x86_64 build succeeds, exit 0 - ctest 34/50 pass; 16 GPU-harness tests abort with 'could not load the Vulkan loader' — reproduced on clean tree, environmental, not a regression AI disclosure (per repo AI Use policy): AI tooling assisted with code exploration and patch drafting. Human reviewed the full diff, built kyty_emulator (x86_64) and ran ctest before submitting, and remains responsible for correctness.
MoltenVK v1.4.2 never exposes image view minLod,
shaderBufferInt64Atomics or shaderCullDistance, so device selection
rejected every Apple GPU. Log instead of rejecting on __APPLE__,
only request minLod when the extension is present, and follow
supported values at device creation. ImageView creation skips
VkImageViewMinLodCreateInfoEXT when the device did not enable it.
- Log honestly when shaderBufferInt64Atomics/shaderCullDistance are
  missing: no shader fallback exists yet, affected pipelines may fail.
- Enable VK_EXT_image_view_min_lod on Apple when advertised instead
  of never using it.
- Approximate an unavailable integer min-LOD by trimming whole mip
  levels from the view instead of ignoring the clamp entirely.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:42:21 +00:00
github-bot closed this pull request 2026-11-26 09:42:21 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-05 22:03 UTC · original · edited 2026-10-05 22:53 UTC

Review in Change Stack →

📝 Walkthrough

Walkthrough

Vulkan device setup now records support for image-view minimum LOD, shader-buffer int64 atomics, and shader cull distance. On macOS, missing support for these features no longer rejects device selection, and feature enablement follows reported availability. When the minimum-LOD extension is unavailable, image-view creation trims whole mip levels from the requested range and drops the fractional remainder.

Suggested reviewers: nmzik

Priority: ➖ Normal

Change: Bug fix

Merge Risk: 🟡 Moderate · up to e709e

Some Apple devices may still fail to start, and affected graphics pipelines may fail on devices lacking the optional shader features. Resolve these paths before merging unless their limitations are explicitly accepted.

Security Architecture Review

Security architecture risk: 🟡 Moderate · up to e709e

The new minimum-LOD fallback breaks image-view reuse: repeated valid texture bindings can accumulate host GPU resources until the image is destroyed. The demonstrated scope is the emulator and its rendering resources, not privilege escalation or remote access. Unsupported shader features also remain a compatibility limitation on newly accepted devices.

Retained concerns

  • Medium · security · inferred: On fallback devices, valid requests with nonzero minimum LOD and multiple mip levels are looked up using their original identity but inserted using a changed identity. Repeating the same guest texture binding therefore creates additional retained Vulkan image views instead of reusing one, enabling renderer resource exhaustion without varying the descriptor.
Security review details

Security Blast Radius

  • inferred — The resource-exhaustion path requires loaded guest content that repeatedly acquires a multi-mip texture view with nonzero minimum LOD on a fallback device. Its demonstrated resource scope is the emulator's host allocations and Vulkan view handles. Effects on other GPU clients or the operating system were not established.

Security Findings and Attack Paths

  • inferred — A valid two-mip request with relative minimum LOD 128 illustrates the introduced amplification: lookup compares 128 against cached entries, but fallback clears it to zero before insertion. Every identical acquisition can therefore create another view. This mechanism did not exist in the base, which cached the unchanged minimum-LOD identity.

Trust Boundaries and Controls

  • observed — Descriptor minimum LOD is checked against the last mip, and FindView validates image-view ranges before creation. TextureCache serializes acquisition with a lock. These controls do not prevent duplicate fallback entries for valid repeated requests. Dynamic-mip bindings explicitly clear minimum LOD and use single-level views, so they do not exercise this duplicate-entry condition.

Resilience and Maintainability Implications

  • observed — FindView publishes a cached entry only after successful creation, and Image destruction destroys retained views. Cleanup therefore exists, but it does not restore reuse during a live image's repeated acquisitions; the issue is accumulating retained resources rather than missing destructor ownership.

Hardening Proposals

  • proposed — Use the same canonical fallback identity for cache lookup and insertion, and consider explicit accounting or limits for per-image view resources. Derive optional feature requests and recorded capability state from the same supported-and-enabled decision.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 3 files. 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 summarizes the main change: making three graphics capabilities optional on macOS.
Description check ✅ Passed The description explains the Apple Silicon device-selection issue, the changes, and the reported testing. It is directly related to the changeset.
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.
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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-10-05 22:03 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1082#issuecomment-6004000548) · edited 2026-10-05 22:53 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/1082?scope=ghh_OusAJGA4HG8ljoOV0wJvVx8NmnZIjc2DdjmxOu0xZWA&amp;cs_source=review_comment"><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 --> <!-- walkthrough_start --> <details> <summary>📝 Walkthrough</summary> ## Walkthrough Vulkan device setup now records support for image-view minimum LOD, shader-buffer int64 atomics, and shader cull distance. On macOS, missing support for these features no longer rejects device selection, and feature enablement follows reported availability. When the minimum-LOD extension is unavailable, image-view creation trims whole mip levels from the requested range and drops the fractional remainder. **Suggested reviewers:** `nmzik` </details> <!-- walkthrough_end --> <!-- change_assessment_start --> **Priority:** ➖ Normal <!-- change_assessment_commit:"e709e9edd2b664ce5cfae341747f71b06710e974" --> **Change:** Bug fix <!-- change_assessment_end --> <!-- final_review_risk_start --> **Merge Risk:** _🟡 Moderate_ · up to `e709e` <!-- final_review_risk_coverage:{"sourceCommitId":"e709e9edd2b664ce5cfae341747f71b06710e974","coveredCommitId":"e709e9edd2b664ce5cfae341747f71b06710e974","kind":"reviewed"} --> Some Apple devices may still fail to start, and affected graphics pipelines may fail on devices lacking the optional shader features. Resolve these paths before merging unless their limitations are explicitly accepted. <!-- final_review_risk_end --> <!-- architecture_review_start --> ### Security Architecture Review **Security architecture risk:** _🟡 Moderate_ · up to `e709e` The new minimum-LOD fallback breaks image-view reuse: repeated valid texture bindings can accumulate host GPU resources until the image is destroyed. The demonstrated scope is the emulator and its rendering resources, not privilege escalation or remote access. Unsupported shader features also remain a compatibility limitation on newly accepted devices. **Retained concerns** - **Medium · security · inferred:** On fallback devices, valid requests with nonzero minimum LOD and multiple mip levels are looked up using their original identity but inserted using a changed identity. Repeating the same guest texture binding therefore creates additional retained Vulkan image views instead of reusing one, enabling renderer resource exhaustion without varying the descriptor. <details> <summary>Security review details</summary> **Security Blast Radius** - _inferred_ — The resource-exhaustion path requires loaded guest content that repeatedly acquires a multi-mip texture view with nonzero minimum LOD on a fallback device. Its demonstrated resource scope is the emulator's host allocations and Vulkan view handles. Effects on other GPU clients or the operating system were not established. **Security Findings and Attack Paths** - _inferred_ — A valid two-mip request with relative minimum LOD 128 illustrates the introduced amplification: lookup compares 128 against cached entries, but fallback clears it to zero before insertion. Every identical acquisition can therefore create another view. This mechanism did not exist in the base, which cached the unchanged minimum-LOD identity. **Trust Boundaries and Controls** - _observed_ — Descriptor minimum LOD is checked against the last mip, and FindView validates image-view ranges before creation. TextureCache serializes acquisition with a lock. These controls do not prevent duplicate fallback entries for valid repeated requests. Dynamic-mip bindings explicitly clear minimum LOD and use single-level views, so they do not exercise this duplicate-entry condition. **Resilience and Maintainability Implications** - _observed_ — FindView publishes a cached entry only after successful creation, and Image destruction destroys retained views. Cleanup therefore exists, but it does not restore reuse during a live image's repeated acquisitions; the issue is accumulating retained resources rather than missing destructor ownership. **Hardening Proposals** - _proposed_ — Use the same canonical fallback identity for cache lookup and insertion, and consider explicit accounting or limits for per-image view resources. Derive optional feature requests and recorded capability state from the same supported-and-enabled decision. </details> <!-- architecture_review_end --> <!-- pre_merge_checks_walkthrough_start --> <details> <summary>🚥 Pre-merge checks | ✅ 4 | ❌ 1</summary> ### ❌ Failed checks (1 warning) | Check name | Status | Explanation | Resolution | | :----------------: | :--------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------- | | Docstring Coverage | ⚠️ Warning | Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 3 files. | Write docstrings for the functions missing them to satisfy the coverage threshold. | <details> <summary>✅ Passed checks (4 passed)</summary> | Check name | Status | Explanation | | :------------------------: | :------- | :------------------------------------------------------------------------------------------------------------------------------------------------- | | Title check | ✅ Passed | The title clearly summarizes the main change: making three graphics capabilities optional on macOS. | | Description check | ✅ Passed | The description explains the Apple Silicon device-selection issue, the changes, and the reported testing. It is directly related to the changeset. | | 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. | </details> </details> <!-- pre_merge_checks_walkthrough_end --> <!-- autopilot:start --> - [ ] <!-- {"checkboxId":"2708ad07-9f24-4260-9c11-7dc76a49f2e3"} --> <strong title="Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts">Autopilot</strong> · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts <!-- autopilot:end --> <!-- tips_start --> --- Thanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=KytyPS5/KytyPS5&utm_content=1082)! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. <details> <summary>❤️ Share</summary> - [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) </details> <sub>Comment `@coderabbitai help` to get the list of available commands.</sub> <!-- tips_end -->
@ -363,2 +374,3 @@
}
vk::ImageViewMinLodCreateInfoEXT min_lod {};
if (normalized.min_lod != 0) {
if (normalized.min_lod != 0 && m_graphics.image_view_min_lod_enabled) {
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-05 22:03 UTC · original · edited 2026-10-05 22:54 UTC

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Apply the base-level approximation when min-LOD is unavailable.

If a texture descriptor requests MinLod above BaseLevel, TextureViewInfo records the difference in normalized.min_lod. This branch then omits the clamp without changing normalized.base_level, so the view still exposes mip levels below the requested minimum. Adjust the base level and level count to a valid integer-mip approximation, or provide another fallback. The min-LOD structure is what otherwise clamps sampling to the requested level. (docs.vulkan.org)

✅ Addressed in commit e709e9e

**@⁠coderabbitai[bot]** on GitHub · 2026-10-05 22:03 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1082#discussion_r4189318292) · edited 2026-10-05 22:54 UTC _🎯 Functional Correctness_ | _🟡 Minor_ | _⚡ Quick win_ **Apply the base-level approximation when min-LOD is unavailable.** If a texture descriptor requests `MinLod` above `BaseLevel`, `TextureViewInfo` records the difference in `normalized.min_lod`. This branch then omits the clamp without changing `normalized.base_level`, so the view still exposes mip levels below the requested minimum. Adjust the base level and level count to a valid integer-mip approximation, or provide another fallback. The min-LOD structure is what otherwise clamps sampling to the requested level. ([docs.vulkan.org](https://docs.vulkan.org/refpages/latest/refpages/source/VkImageViewMinLodCreateInfoEXT.html?utm_source=openai)) <!-- fingerprinting:phantom:poseidon:wombat --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:7e18d2df9b6b69b27f9ddea1 --> <!-- This is an auto-generated reply by CodeRabbit --> ✅ Addressed in commit e709e9e
@ -493,0 +550,4 @@
#if defined(__APPLE__)
// MoltenVK hardcodes shaderBufferInt64Atomics=false; request only what is supported.
features12.shaderBufferInt64Atomics = supported_features12.shaderBufferInt64Atomics;
#endif
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-05 22:03 UTC · original · edited 2026-10-05 22:54 UTC

🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

🔎 Supported by static analysis

🏁 Script executed:

#!/bin/bash
set -u
base=cdb64bfd4fb4d5312b2542a41a0070f25663166a
head=af7c92d8619e7e0d737af2e09e7a78f77acf8930

printf '%s\n' '--- revision availability ---'
git rev-parse --verify "$base^{commit}" 2>&1
git rev-parse --verify "$head^{commit}" 2>&1

printf '%s\n' '--- PR diff for Vulkan window ---'
git diff --unified=18 "$base" "$head" -- src/graphics/presentation/window/vulkanWindow.cpp

printf '%s\n' '--- head source around device selection / creation ---'
git show "$head:src/graphics/presentation/window/vulkanWindow.cpp" | nl -ba | sed -n '440,575p'

printf '%s\n' '--- shader/atomic references ---'
rg -n -i --glob '!vendor/**' --glob '!build/**' --glob '!dist/**' \
  'shaderBufferInt64Atomics|Int64Atomics|Atomic(Add|Min|Max|Exchange|And|Or|Xor|CompareExchange)|atomic.*(int64|uint64|long)|int64.*atomic|uint64.*atomic' \
  src shaders 2>&1 || test "$?" -eq 1

Repository: KytyPS5/KytyPS5

Length of output: 42855


🏁 Script executed:

#!/bin/bash
head=af7c92d8619e7e0d737af2e09e7a78f77acf8930

printf '%s\n' '--- feature-flag references at reviewed head ---'
git grep -n -F 'shader_buffer_int64_atomics_enabled' "$head" -- src

printf '%s\n' '--- guest buffer atomic translation ---'
git show "$head:src/graphics/shader/recompiler/frontend/translate/Memory.cpp" | nl -ba | sed -n '930,1010p'

printf '%s\n' '--- SPIR-V buffer atomic requirement analysis ---'
git show "$head:src/graphics/shader/recompiler/backend/spirv/SpirvEmitter.cpp" | nl -ba | sed -n '165,220p'

printf '%s\n' '--- SPIR-V analysis capability requirements ---'
git show "$head:src/graphics/shader/recompiler/backend/spirv/spirvEmitterAnalysis.cpp" | nl -ba | sed -n '95,150p'

printf '%s\n' '--- SPIR-V buffer atomic emission ---'
git show "$head:src/graphics/shader/recompiler/backend/spirv/spirvEmitterMemoryHelpers.cpp" | nl -ba | sed -n '330,435p'

printf '%s\n' '--- SPIR-V module capability emission ---'
git show "$head:src/graphics/shader/recompiler/backend/spirv/spirvEmitterModule.cpp" | nl -ba | sed -n '670,710p'

printf '%s\n' '--- buffer atomic instruction emitter mapping ---'
git show "$head:src/graphics/shader/recompiler/backend/spirv/spirvEmitterInstructions.h" | nl -ba | sed -n '265,330p'

Repository: KytyPS5/KytyPS5

Length of output: 23752


🏁 Script executed:

#!/bin/bash
head=af7c92d8619e7e0d737af2e09e7a78f77acf8930
printf '%s\n' '--- 64-bit buffer-atomic emitter bindings ---'
git grep -n -F 'EmitBufferAtomic64' "$head" -- src/graphics/shader/recompiler
printf '%s\n' '--- emitter implementation context ---'
git show "$head:src/graphics/shader/recompiler/backend/spirv/spirvEmitterMemoryHelpers.cpp" | nl -ba | sed -n '430,520p'
printf '%s\n' '--- emitter instruction mapping context ---'
git show "$head:src/graphics/shader/recompiler/backend/spirv/spirvEmitterInstructions.h" | nl -ba | sed -n '230,305p'

Repository: KytyPS5/KytyPS5

Length of output: 12360


🏁 Script executed:

head=af7c92d8619e7e0d737af2e09e7a78f77acf8930
git show "$head:src/graphics/shader/recompiler/backend/spirv/spirvEmitterMemory.cpp" | nl -ba | sed -n '1145,1205p'

Repository: KytyPS5/KytyPS5

Length of output: 3642


🌐 Web query:

site:docs.vulkan.org/spec/latest/appendices/spirvenv.html Int64Atomics StorageBuffer shaderBufferInt64Atomics requirement

💡 Result:

For 64-bit integer atomic operations on a SPIR-V pointer with `StorageBuffer` **or `Uniform`** storage class, Vulkan requires `VkPhysicalDeviceVulkan12Features::shaderBufferInt64Atomics` to be enabled (VUID `RuntimeSpirv-None-06278`). ([docs.vulkan.org](https://docs.vulkan.org/spec/latest/appendices/spirvenv.html?utm_source=openai))

The feature indicates whether shaders can perform signed and unsigned 64-bit integer atomics on buffers. ([docs.vulkan.org](https://docs.vulkan.org/spec/latest/chapters/features.html?utm_source=openai))

Citations:

- 1: https://docs.vulkan.org/spec/latest/appendices/spirvenv.html?utm_source=openai
- 2: https://docs.vulkan.org/spec/latest/chapters/features.html?utm_source=openai

Gate 64-bit buffer-atomic shaders when the device feature is disabled.

On Apple, a device can be accepted with shaderBufferInt64Atomics unsupported, and device creation then disables the feature. Guest BUFFER_ATOMIC_SWAP_X2, BUFFER_ATOMIC_AND_X2, and BUFFER_ATOMIC_OR_X2 instructions lower to native 64-bit storage-buffer atomics without checking shader_buffer_int64_atomics_enabled. Vulkan requires this feature for those operations, so the resulting pipeline may be rejected. Reject these shaders when the feature is disabled, or add a legal fallback. Update the log so it does not claim a fallback exists before one is implemented.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-05 22:03 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1082#discussion_r4189318299) · edited 2026-10-05 22:54 UTC _🎯 Functional Correctness_ | _🟠 Major_ | _🏗️ Heavy lift_ <details> <summary>🔎 Supported by static analysis</summary> 🏁 Script executed: ```bash #!/bin/bash set -u base=cdb64bfd4fb4d5312b2542a41a0070f25663166a head=af7c92d8619e7e0d737af2e09e7a78f77acf8930 printf '%s\n' '--- revision availability ---' git rev-parse --verify "$base^{commit}" 2>&1 git rev-parse --verify "$head^{commit}" 2>&1 printf '%s\n' '--- PR diff for Vulkan window ---' git diff --unified=18 "$base" "$head" -- src/graphics/presentation/window/vulkanWindow.cpp printf '%s\n' '--- head source around device selection / creation ---' git show "$head:src/graphics/presentation/window/vulkanWindow.cpp" | nl -ba | sed -n '440,575p' printf '%s\n' '--- shader/atomic references ---' rg -n -i --glob '!vendor/**' --glob '!build/**' --glob '!dist/**' \ 'shaderBufferInt64Atomics|Int64Atomics|Atomic(Add|Min|Max|Exchange|And|Or|Xor|CompareExchange)|atomic.*(int64|uint64|long)|int64.*atomic|uint64.*atomic' \ src shaders 2>&1 || test "$?" -eq 1 ``` Repository: KytyPS5/KytyPS5 Length of output: 42855 --- 🏁 Script executed: ```bash #!/bin/bash head=af7c92d8619e7e0d737af2e09e7a78f77acf8930 printf '%s\n' '--- feature-flag references at reviewed head ---' git grep -n -F 'shader_buffer_int64_atomics_enabled' "$head" -- src printf '%s\n' '--- guest buffer atomic translation ---' git show "$head:src/graphics/shader/recompiler/frontend/translate/Memory.cpp" | nl -ba | sed -n '930,1010p' printf '%s\n' '--- SPIR-V buffer atomic requirement analysis ---' git show "$head:src/graphics/shader/recompiler/backend/spirv/SpirvEmitter.cpp" | nl -ba | sed -n '165,220p' printf '%s\n' '--- SPIR-V analysis capability requirements ---' git show "$head:src/graphics/shader/recompiler/backend/spirv/spirvEmitterAnalysis.cpp" | nl -ba | sed -n '95,150p' printf '%s\n' '--- SPIR-V buffer atomic emission ---' git show "$head:src/graphics/shader/recompiler/backend/spirv/spirvEmitterMemoryHelpers.cpp" | nl -ba | sed -n '330,435p' printf '%s\n' '--- SPIR-V module capability emission ---' git show "$head:src/graphics/shader/recompiler/backend/spirv/spirvEmitterModule.cpp" | nl -ba | sed -n '670,710p' printf '%s\n' '--- buffer atomic instruction emitter mapping ---' git show "$head:src/graphics/shader/recompiler/backend/spirv/spirvEmitterInstructions.h" | nl -ba | sed -n '265,330p' ``` Repository: KytyPS5/KytyPS5 Length of output: 23752 --- 🏁 Script executed: ```bash #!/bin/bash head=af7c92d8619e7e0d737af2e09e7a78f77acf8930 printf '%s\n' '--- 64-bit buffer-atomic emitter bindings ---' git grep -n -F 'EmitBufferAtomic64' "$head" -- src/graphics/shader/recompiler printf '%s\n' '--- emitter implementation context ---' git show "$head:src/graphics/shader/recompiler/backend/spirv/spirvEmitterMemoryHelpers.cpp" | nl -ba | sed -n '430,520p' printf '%s\n' '--- emitter instruction mapping context ---' git show "$head:src/graphics/shader/recompiler/backend/spirv/spirvEmitterInstructions.h" | nl -ba | sed -n '230,305p' ``` Repository: KytyPS5/KytyPS5 Length of output: 12360 --- 🏁 Script executed: ```bash head=af7c92d8619e7e0d737af2e09e7a78f77acf8930 git show "$head:src/graphics/shader/recompiler/backend/spirv/spirvEmitterMemory.cpp" | nl -ba | sed -n '1145,1205p' ``` Repository: KytyPS5/KytyPS5 Length of output: 3642 --- 🌐 Web query: `site:docs.vulkan.org/spec/latest/appendices/spirvenv.html Int64Atomics StorageBuffer shaderBufferInt64Atomics requirement` 💡 Result: ``` For 64-bit integer atomic operations on a SPIR-V pointer with `StorageBuffer` **or `Uniform`** storage class, Vulkan requires `VkPhysicalDeviceVulkan12Features::shaderBufferInt64Atomics` to be enabled (VUID `RuntimeSpirv-None-06278`). ([docs.vulkan.org](https://docs.vulkan.org/spec/latest/appendices/spirvenv.html?utm_source=openai)) The feature indicates whether shaders can perform signed and unsigned 64-bit integer atomics on buffers. ([docs.vulkan.org](https://docs.vulkan.org/spec/latest/chapters/features.html?utm_source=openai)) Citations: - 1: https://docs.vulkan.org/spec/latest/appendices/spirvenv.html?utm_source=openai - 2: https://docs.vulkan.org/spec/latest/chapters/features.html?utm_source=openai ``` --- </details> **Gate 64-bit buffer-atomic shaders when the device feature is disabled.** On Apple, a device can be accepted with `shaderBufferInt64Atomics` unsupported, and device creation then disables the feature. Guest `BUFFER_ATOMIC_SWAP_X2`, `BUFFER_ATOMIC_AND_X2`, and `BUFFER_ATOMIC_OR_X2` instructions lower to native 64-bit storage-buffer atomics without checking `shader_buffer_int64_atomics_enabled`. Vulkan requires this feature for those operations, so the resulting pipeline may be rejected. Reject these shaders when the feature is disabled, or add a legal fallback. Update the log so it does not claim a fallback exists before one is implemented. <!-- fingerprinting:phantom:poseidon:wombat --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:798207da388d86562db1b81f --> <!-- This is an auto-generated reply by CodeRabbit -->
@ -574,1 +635,4 @@
device_features.shaderClipDistance = VK_TRUE;
#if defined(__APPLE__)
device_features.shaderCullDistance =
graphics.shader_cull_distance_enabled ? VK_TRUE : VK_FALSE;
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-05 22:03 UTC · original · edited 2026-10-05 22:58 UTC

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

git diff --no-ext-diff --unified=50 cdb64bfd4fb4d5312b2542a41a0070f25663166a af7c92d8619e7e0d737af2e09e7a78f77acf8930 -- src/graphics/presentation/window/vulkanWindow.cpp
printf '\n--- shader references ---\n'
rg -n -i --hidden -g '!build/**' -g '!dist/**' -g '!*.spv' 'CullDistance|cull_distance|shaderCullDistance' .
printf '\n--- shader-related files ---\n'
rg --files | rg '(^|/)(shader|shaders|.*\\.glsl|.*\\.vert|.*\\.frag|.*\\.geom|.*\\.hlsl|.*\\.spv|.*shader.*)$' | head -200

Repository: KytyPS5/KytyPS5

Length of output: 40066


🏁 Script executed:

printf '%s\n' '--- feature selection and device creation ---'
nl -ba src/graphics/presentation/window/vulkanWindow.cpp | sed -n '225,250p;304,323p;520,541p;620,635p'
printf '%s\n' '--- shader output collection ---'
nl -ba src/graphics/shader/recompiler/ir/passes/ShaderInfoCollection.cpp | sed -n '360,390p'
printf '%s\n' '--- SPIR-V output declaration and capability ---'
nl -ba src/graphics/shader/recompiler/backend/spirv/spirvEmitterModule.cpp | sed -n '530,610p;695,710p'
printf '%s\n' '--- SPIR-V output assignment ---'
nl -ba src/graphics/shader/recompiler/backend/spirv/spirvEmitterFlow.cpp | sed -n '345,390p'
printf '%s\n' '--- feature-flag references ---'
rg -n -F -- 'shader_cull_distance_enabled' src

Repository: KytyPS5/KytyPS5

Length of output: 14251


Require shaderCullDistance on Apple until the shader fallback exists.

When translated shader metadata includes a cull-distance export, the SPIR-V backend emits BuiltInCullDistance and declares CapabilityCullDistance. Apple device selection can accept a device without shaderCullDistance, then create the device with that feature disabled. The backend does not check graphics.shader_cull_distance_enabled, so it can still generate a shader that requires the disabled feature. The log claiming that cull-distance outputs “will be dropped” does not describe an implemented fallback.

🐛 Suggested fix
-#if defined(__APPLE__)
-		if (device_features2.features.shaderCullDistance != VK_TRUE) {
-			LOGF("shaderCullDistance is not supported\n");
-		} else {
-			check_feature(device_features2.features.shaderCullDistance, "shaderCullDistance");
-		}
-#else
 		check_feature(device_features2.features.shaderCullDistance, "shaderCullDistance");
-#endif
**@⁠coderabbitai[bot]** on GitHub · 2026-10-05 22:03 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1082#discussion_r4189318311) · edited 2026-10-05 22:58 UTC _🎯 Functional Correctness_ | _🟠 Major_ | _⚡ Quick win_ <details> <summary>🔎 Supported by static analysis</summary> 🏁 Script executed: ```bash git diff --no-ext-diff --unified=50 cdb64bfd4fb4d5312b2542a41a0070f25663166a af7c92d8619e7e0d737af2e09e7a78f77acf8930 -- src/graphics/presentation/window/vulkanWindow.cpp printf '\n--- shader references ---\n' rg -n -i --hidden -g '!build/**' -g '!dist/**' -g '!*.spv' 'CullDistance|cull_distance|shaderCullDistance' . printf '\n--- shader-related files ---\n' rg --files | rg '(^|/)(shader|shaders|.*\\.glsl|.*\\.vert|.*\\.frag|.*\\.geom|.*\\.hlsl|.*\\.spv|.*shader.*)$' | head -200 ``` Repository: KytyPS5/KytyPS5 Length of output: 40066 --- 🏁 Script executed: ```bash printf '%s\n' '--- feature selection and device creation ---' nl -ba src/graphics/presentation/window/vulkanWindow.cpp | sed -n '225,250p;304,323p;520,541p;620,635p' printf '%s\n' '--- shader output collection ---' nl -ba src/graphics/shader/recompiler/ir/passes/ShaderInfoCollection.cpp | sed -n '360,390p' printf '%s\n' '--- SPIR-V output declaration and capability ---' nl -ba src/graphics/shader/recompiler/backend/spirv/spirvEmitterModule.cpp | sed -n '530,610p;695,710p' printf '%s\n' '--- SPIR-V output assignment ---' nl -ba src/graphics/shader/recompiler/backend/spirv/spirvEmitterFlow.cpp | sed -n '345,390p' printf '%s\n' '--- feature-flag references ---' rg -n -F -- 'shader_cull_distance_enabled' src ``` Repository: KytyPS5/KytyPS5 Length of output: 14251 --- </details> **Require `shaderCullDistance` on Apple until the shader fallback exists.** When translated shader metadata includes a cull-distance export, the SPIR-V backend emits `BuiltInCullDistance` and declares `CapabilityCullDistance`. Apple device selection can accept a device without `shaderCullDistance`, then create the device with that feature disabled. The backend does not check `graphics.shader_cull_distance_enabled`, so it can still generate a shader that requires the disabled feature. The log claiming that cull-distance outputs “will be dropped” does not describe an implemented fallback. <details> <summary>🐛 Suggested fix</summary> ```diff -#if defined(__APPLE__) - if (device_features2.features.shaderCullDistance != VK_TRUE) { - LOGF("shaderCullDistance is not supported\n"); - } else { - check_feature(device_features2.features.shaderCullDistance, "shaderCullDistance"); - } -#else check_feature(device_features2.features.shaderCullDistance, "shaderCullDistance"); -#endif ``` </details> <!-- fingerprinting:phantom:poseidon:wombat --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:b5fb2d8fa7c5163ae8ce46d1 --> <!-- This is an auto-generated reply by CodeRabbit -->
@ -949,6 +1014,7 @@ void WindowContext::CreateVulkan() {
device_extensions.push_back(VK_EXT_DEPTH_CLIP_ENABLE_EXTENSION_NAME);
device_extensions.push_back(VK_EXT_COLOR_WRITE_ENABLE_EXTENSION_NAME);
device_extensions.push_back(VK_KHR_FRAGMENT_SHADER_BARYCENTRIC_EXTENSION_NAME);
device_extensions.push_back(VK_EXT_IMAGE_VIEW_MIN_LOD_EXTENSION_NAME);
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-05 22:03 UTC · original · edited 2026-10-05 22:55 UTC

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Request min-LOD as an optional extension on Apple.

If an Apple device advertises VK_EXT_image_view_min_lod, this extension list still omits it. The later optional-extension scan also omits it, so min_lod_extension stays false and the application never uses the available feature. Add it when the selected Apple device advertises it; keep the existing requirement on other platforms. The Vulkan specification defines it as a device extension. (docs.vulkan.org)

✅ Addressed in commit e709e9e

**@⁠coderabbitai[bot]** on GitHub · 2026-10-05 22:03 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1082#discussion_r4189318318) · edited 2026-10-05 22:55 UTC _🎯 Functional Correctness_ | _🟡 Minor_ | _⚡ Quick win_ **Request min-LOD as an optional extension on Apple.** If an Apple device advertises `VK_EXT_image_view_min_lod`, this extension list still omits it. The later optional-extension scan also omits it, so `min_lod_extension` stays false and the application never uses the available feature. Add it when the selected Apple device advertises it; keep the existing requirement on other platforms. The Vulkan specification defines it as a device extension. ([docs.vulkan.org](https://docs.vulkan.org/refpages/latest/refpages/source/VK_EXT_image_view_min_lod.html?utm_source=openai)) <!-- fingerprinting:phantom:poseidon:wombat --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:aa9af51e224a9e67280d760f --> <!-- This is an auto-generated reply by CodeRabbit --> ✅ Addressed in commit e709e9e
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-05 22:03 UTC · original · reviewed

Actionable comments posted: 4


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5c042136-6287-40a1-bf96-a0310ddf1a7d
📥 Commits

Reviewing files that changed from the base of the PR and between cdb64bfd4f and af7c92d861.

📒 Files selected for processing (3)
  • src/graphics/host_gpu/graphicContext.h
  • src/graphics/host_gpu/renderer/image/imageView.cpp
  • src/graphics/presentation/window/vulkanWindow.cpp

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-05 22:03 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1082#pullrequestreview-5421144083) · **reviewed** **Actionable comments posted: 4** --- <details> <summary>ℹ️ Review info</summary> <details> <summary>⚙️ Run configuration</summary> - **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `5c042136-6287-40a1-bf96-a0310ddf1a7d` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between cdb64bfd4fb4d5312b2542a41a0070f25663166a and af7c92d8619e7e0d737af2e09e7a78f77acf8930. </details> <details> <summary>📒 Files selected for processing (3)</summary> * `src/graphics/host_gpu/graphicContext.h` * `src/graphics/host_gpu/renderer/image/imageView.cpp` * `src/graphics/presentation/window/vulkanWindow.cpp` </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review. </details> <!-- This is an auto-generated comment by CodeRabbit for review status --> <!-- coderabbit-review-publication v1 publication=b8df3bb9-6987-4373-9b77-ad4fe0fb27b4 attempt=ddce1dc7-b18f-4306-8c37-1db1747b1c4b batch=1/1 -->
@ -363,2 +374,3 @@
}
vk::ImageViewMinLodCreateInfoEXT min_lod {};
if (normalized.min_lod != 0) {
if (normalized.min_lod != 0 && m_graphics.image_view_min_lod_enabled) {
Author
Owner

@⁠overlordxrz-source on GitHub · 2026-10-05 22:44 UTC · original

Taken - when min-LOD is unavailable the view now trims whole mip levels (integer part of the U4.8 clamp) instead of exposing mips below the requested minimum. Fractional remainder still dropped; exact clamp needs the extension. In e709e9e, emulator + shader_cfg/memory_tracker/texture_cache_depth_readback green.

**@⁠overlordxrz-source** on GitHub · 2026-10-05 22:44 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1082#discussion_r4189635320) Taken - when min-LOD is unavailable the view now trims whole mip levels (integer part of the U4.8 clamp) instead of exposing mips below the requested minimum. Fractional remainder still dropped; exact clamp needs the extension. In e709e9e, emulator + shader_cfg/memory_tracker/texture_cache_depth_readback green.
@ -574,1 +635,4 @@
device_features.shaderClipDistance = VK_TRUE;
#if defined(__APPLE__)
device_features.shaderCullDistance =
graphics.shader_cull_distance_enabled ? VK_TRUE : VK_FALSE;
Author
Owner

@⁠overlordxrz-source on GitHub · 2026-10-05 22:44 UTC · original

Same treatment as the int64-atomics note: log is now honest that cull-distance-exporting shaders may fail without the feature, fallback marked as follow-up. Keeping device creation permissive on Apple is intentional - requiring the feature would re-reject every Mac (the bug being fixed). In e709e9e.

**@⁠overlordxrz-source** on GitHub · 2026-10-05 22:44 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1082#discussion_r4189635321) Same treatment as the int64-atomics note: log is now honest that cull-distance-exporting shaders may fail without the feature, fallback marked as follow-up. Keeping device creation permissive on Apple is intentional - requiring the feature would re-reject every Mac (the bug being fixed). In e709e9e.
@ -493,0 +550,4 @@
#if defined(__APPLE__)
// MoltenVK hardcodes shaderBufferInt64Atomics=false; request only what is supported.
features12.shaderBufferInt64Atomics = supported_features12.shaderBufferInt64Atomics;
#endif
Author
Owner

@⁠overlordxrz-source on GitHub · 2026-10-05 22:44 UTC · original

Fair - the log claimed a fallback that doesn't exist. Fixed to warn that shaders using 64-bit storage-buffer atomics may fail pipeline creation without the feature (citing the same VUID), with a comment marking drop/emulation fallbacks as follow-up work. Deliberately not gating device creation: the PR's purpose is letting MoltenVK devices boot at all. In e709e9e.

**@⁠overlordxrz-source** on GitHub · 2026-10-05 22:44 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1082#discussion_r4189635541) Fair - the log claimed a fallback that doesn't exist. Fixed to warn that shaders using 64-bit storage-buffer atomics may fail pipeline creation without the feature (citing the same VUID), with a comment marking drop/emulation fallbacks as follow-up work. Deliberately not gating device creation: the PR's purpose is letting MoltenVK devices boot at all. In e709e9e.
@ -949,6 +1014,7 @@ void WindowContext::CreateVulkan() {
device_extensions.push_back(VK_EXT_DEPTH_CLIP_ENABLE_EXTENSION_NAME);
device_extensions.push_back(VK_EXT_COLOR_WRITE_ENABLE_EXTENSION_NAME);
device_extensions.push_back(VK_KHR_FRAGMENT_SHADER_BARYCENTRIC_EXTENSION_NAME);
device_extensions.push_back(VK_EXT_IMAGE_VIEW_MIN_LOD_EXTENSION_NAME);
Author
Owner

@⁠overlordxrz-source on GitHub · 2026-10-05 22:44 UTC · original

Good spot - fixed. The Apple optional-extension scan now picks up VK_EXT_image_view_min_lod when advertised, so a newer MoltenVK with the extension gets it requested and used instead of always falling back. In e709e9e.

**@⁠overlordxrz-source** on GitHub · 2026-10-05 22:44 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1082#discussion_r4189635542) Good spot - fixed. The Apple optional-extension scan now picks up VK_EXT_image_view_min_lod when advertised, so a newer MoltenVK with the extension gets it requested and used instead of always falling back. In e709e9e.
@ -1014,0 +1081,4 @@
// VK_EXT_image_view_min_lod is required on other platforms but optional here;
// enable it when a (newer) MoltenVK advertises it so the feature gets used.
if (HasExtension(available_extensions, VK_EXT_IMAGE_VIEW_MIN_LOD_EXTENSION_NAME)) {
device_extensions.push_back(VK_EXT_IMAGE_VIEW_MIN_LOD_EXTENSION_NAME);
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-05 22:48 UTC · original

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Enable min-LOD only when its feature is supported.

On Apple, a device can advertise VK_EXT_image_view_min_lod but report minLod = VK_FALSE. This branch adds the extension, and VulkanCreateDevice then requests minLod = VK_TRUE. vkCreateDevice must fail for an unsupported requested feature, so the device cannot reach the image-view fallback. Query minLod before setting the creation feature; leave it disabled when support is false. (docs.vulkan.org)

As per the retrieved learning, optional runtime capabilities must be requested with the capabilities they depend on.

Source: Learnings

**@⁠coderabbitai[bot]** on GitHub · 2026-10-05 22:48 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1082#discussion_r4189662511) **🩺 Stability & Availability** | **🟠 Major** | **⚡ Quick win** **Enable min-LOD only when its feature is supported.** On Apple, a device can advertise `VK_EXT_image_view_min_lod` but report `minLod = VK_FALSE`. This branch adds the extension, and `VulkanCreateDevice` then requests `minLod = VK_TRUE`. `vkCreateDevice` must fail for an unsupported requested feature, so the device cannot reach the image-view fallback. Query `minLod` before setting the creation feature; leave it disabled when support is false. ([docs.vulkan.org](https://docs.vulkan.org/refpages/latest/refpages/source/VkPhysicalDeviceImageViewMinLodFeaturesEXT.html?utm_source=openai)) As per the retrieved learning, optional runtime capabilities must be requested with the capabilities they depend on. <!-- fingerprinting:phantom:poseidon:wombat --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:b579e2b5b943ff65645d08ee --> _Source: Learnings_ <!-- This is an auto-generated comment by CodeRabbit -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-05 22:48 UTC · original · reviewed

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 39f0a946-af2a-4256-aa98-f11647165216
📥 Commits

Reviewing files that changed from the base of the PR and between af7c92d861 and e709e9edd2.

📒 Files selected for processing (2)
  • src/graphics/host_gpu/renderer/image/imageView.cpp
  • src/graphics/presentation/window/vulkanWindow.cpp
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/graphics/host_gpu/renderer/image/imageView.cpp

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 4 remain after this review.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-05 22:48 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1082#pullrequestreview-5421588696) · **reviewed** **Actionable comments posted: 1** --- <details> <summary>ℹ️ Review info</summary> <details> <summary>⚙️ Run configuration</summary> - **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `39f0a946-af2a-4256-aa98-f11647165216` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between af7c92d8619e7e0d737af2e09e7a78f77acf8930 and e709e9edd2b664ce5cfae341747f71b06710e974. </details> <details> <summary>📒 Files selected for processing (2)</summary> * `src/graphics/host_gpu/renderer/image/imageView.cpp` * `src/graphics/presentation/window/vulkanWindow.cpp` </details> <details> <summary>🚧 Files skipped from review as they are similar to previous changes (1)</summary> * src/graphics/host_gpu/renderer/image/imageView.cpp </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 4 remain after this review. </details> <!-- This is an auto-generated comment by CodeRabbit for review status --> <!-- coderabbit-review-publication v1 publication=71a52c90-7914-4b97-88ec-a305260562be attempt=2a7fad74-cc22-4dda-a5ac-b10f25ddf4fa batch=1/1 -->
@ -363,2 +374,3 @@
}
vk::ImageViewMinLodCreateInfoEXT min_lod {};
if (normalized.min_lod != 0) {
if (normalized.min_lod != 0 && m_graphics.image_view_min_lod_enabled) {
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-05 22:54 UTC · original

@overlordxrz-source Thanks for the fix. The supplied code now trims whole mip levels and keeps at least one mip level in the view. This addresses the requested integer-mip approximation. Exact fractional clamping still requires VK_EXT_image_view_min_lod.


If you found this review helpful, would you consider giving us a shout-out on X?

Thank you for using CodeRabbit!

✅ Review thread resolved.

You are interacting with an AI system.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-05 22:54 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1082#discussion_r4189707345) `@overlordxrz-source` Thanks for the fix. The supplied code now trims whole mip levels and keeps at least one mip level in the view. This addresses the requested integer-mip approximation. Exact fractional clamping still requires `VK_EXT_image_view_min_lod`. --- <!-- This is an auto-generated comment: tweet message by coderabbit.ai --> If you found this review helpful, would you consider giving us a shout-out on [X](https://twitter.com/intent/tweet?related=CodeRabbitAI&text=When%20Vulkan%20min-LOD%20isn%E2%80%99t%20available%2C%20%40coderabbitai%20caught%20views%20exposing%20lower%20mips.%20Integer-mip%20trimming%20now%20approximates%20the%20clamp%E2%80%94try%20CodeRabbit%20for%20sharper%20reviews%20%F0%9F%94%8D&url=https%3A%2F%2Fgithub.com%2FKytyPS5%2FKytyPS5%2Fpull%2F1082%23discussion_r4189318292)? Thank you for using CodeRabbit! <!-- end of auto-generated comment: tweet message by coderabbit.ai --> ✅ Review thread resolved. _You are interacting with an AI system._ <!-- This is an auto-generated reply by CodeRabbit -->
@ -493,0 +550,4 @@
#if defined(__APPLE__)
// MoltenVK hardcodes shaderBufferInt64Atomics=false; request only what is supported.
features12.shaderBufferInt64Atomics = supported_features12.shaderBufferInt64Atomics;
#endif
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-05 22:54 UTC · original

@overlordxrz-source Thanks for the clarification. The updated warning in e709e9e correctly states that no fallback exists.

Keeping device creation permissive matches this PR’s boot objective. My original request concerned gating affected shaders, not rejecting the device. The warning fixes the misleading log, but the unsupported shader path remains follow-up work.

Would you like me to open a follow-up issue for shader-level handling of unsupported 64-bit buffer atomics?


✏️ Learnings added
Learnt from: overlordxrz-source
Repo: KytyPS5/KytyPS5 PR: 1082
File: src/graphics/presentation/window/vulkanWindow.cpp:550-553
Timestamp: 2026-10-05T22:54:50.215Z
Learning: In KytyPS5, macOS Vulkan device setup must allow MoltenVK devices without shaderBufferInt64Atomics to boot. Do not recommend rejecting the entire device solely because this optional feature is unavailable. Distinguish device-level acceptance from handling shaders that require the feature.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


If you found this review helpful, would you consider giving us a shout-out on X?

Thank you for using CodeRabbit!

You are interacting with an AI system.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-05 22:54 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1082#discussion_r4189709693) `@overlordxrz-source` Thanks for the clarification. The updated warning in `e709e9e` correctly states that no fallback exists. Keeping device creation permissive matches this PR’s boot objective. My original request concerned gating affected shaders, not rejecting the device. The warning fixes the misleading log, but the unsupported shader path remains follow-up work. Would you like me to open a follow-up issue for shader-level handling of unsupported 64-bit buffer atomics? --- <details> <summary>✏️ Learnings added</summary> ``` Learnt from: overlordxrz-source Repo: KytyPS5/KytyPS5 PR: 1082 File: src/graphics/presentation/window/vulkanWindow.cpp:550-553 Timestamp: 2026-10-05T22:54:50.215Z Learning: In KytyPS5, macOS Vulkan device setup must allow MoltenVK devices without shaderBufferInt64Atomics to boot. Do not recommend rejecting the entire device solely because this optional feature is unavailable. Distinguish device-level acceptance from handling shaders that require the feature. ``` > Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure [review instructions](https://docs.coderabbit.ai/guides/review-instructions). You can manage existing learnings in the [app](https://app.coderabbit.ai/learnings). </details> --- <!-- This is an auto-generated comment: tweet message by coderabbit.ai --> If you found this review helpful, would you consider giving us a shout-out on [X](https://twitter.com/intent/tweet?related=CodeRabbitAI&text=%40coderabbitai%20caught%20a%20Vulkan%20compatibility%20issue%3A%2064-bit%20buffer%20atomics%20need%20feature%20checks%20or%20a%20valid%20fallback%2C%20or%20pipeline%20creation%20may%20fail.%20Sharp%20review%E2%80%94try%20%40coderabbitai%20on%20your%20PRs!%20%F0%9F%9B%A0%EF%B8%8F&url=https%3A%2F%2Fgithub.com%2FKytyPS5%2FKytyPS5%2Fpull%2F1082%23discussion_r4189318299)? Thank you for using CodeRabbit! <!-- end of auto-generated comment: tweet message by coderabbit.ai --> _You are interacting with an AI system._ <!-- This is an auto-generated reply by CodeRabbit -->
@ -949,6 +1014,7 @@ void WindowContext::CreateVulkan() {
device_extensions.push_back(VK_EXT_DEPTH_CLIP_ENABLE_EXTENSION_NAME);
device_extensions.push_back(VK_EXT_COLOR_WRITE_ENABLE_EXTENSION_NAME);
device_extensions.push_back(VK_KHR_FRAGMENT_SHADER_BARYCENTRIC_EXTENSION_NAME);
device_extensions.push_back(VK_EXT_IMAGE_VIEW_MIN_LOD_EXTENSION_NAME);
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-05 22:55 UTC · original

@overlordxrz-source Thanks for the fix. The Apple optional-extension scan now requests VK_EXT_image_view_min_lod when advertised. Non-Apple platforms still require the extension. This addresses the finding.


If you found this review helpful, would you consider giving us a shout-out on X?

Thank you for using CodeRabbit!

✅ Review thread resolved.

You are interacting with an AI system.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-05 22:55 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1082#discussion_r4189716788) `@overlordxrz-source` Thanks for the fix. The Apple optional-extension scan now requests `VK_EXT_image_view_min_lod` when advertised. Non-Apple platforms still require the extension. This addresses the finding. --- <!-- This is an auto-generated comment: tweet message by coderabbit.ai --> If you found this review helpful, would you consider giving us a shout-out on [X](https://twitter.com/intent/tweet?related=CodeRabbitAI&text=On%20Apple%2C%20request%20%60VK_EXT_image_view_min_lod%60%20when%20the%20device%20advertises%20it%E2%80%94so%20newer%20MoltenVK%20builds%20can%20use%20the%20feature%20instead%20of%20falling%20back.%20A%20quick%20win%20for%20Vulkan%20support%20%F0%9F%8D%8E%20Try%20%40coderabbitai&url=https%3A%2F%2Fgithub.com%2FKytyPS5%2FKytyPS5%2Fpull%2F1082%23discussion_r4189318318)? Thank you for using CodeRabbit! <!-- end of auto-generated comment: tweet message by coderabbit.ai --> ✅ Review thread resolved. _You are interacting with an AI system._ <!-- This is an auto-generated reply by CodeRabbit -->
@ -574,1 +635,4 @@
device_features.shaderClipDistance = VK_TRUE;
#if defined(__APPLE__)
device_features.shaderCullDistance =
graphics.shader_cull_distance_enabled ? VK_TRUE : VK_FALSE;
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-05 22:58 UTC · original

@overlordxrz-source Thanks for the clarification. I withdraw the recommendation to require shaderCullDistance on Apple. That requirement would defeat the device-selection fix.

The supplied code now warns that shaders exporting cull distance may fail pipeline creation. It also identifies the missing fallback as follow-up work. Device acceptance and support for those shaders are separate concerns.

Would you like me to open a follow-up issue for the cull-distance shader fallback?


✏️ Learnings added
Learnt from: overlordxrz-source
Repo: KytyPS5/KytyPS5 PR: 1082
File: src/graphics/presentation/window/vulkanWindow.cpp:636-638
Timestamp: 2026-10-05T22:58:24.177Z
Learning: In KytyPS5, Apple Vulkan device selection and creation intentionally permit devices without shaderCullDistance. Do not recommend rejecting the device solely because this optional feature is unavailable. In src/graphics/presentation/window/vulkanWindow.cpp, warnings describe possible pipeline-creation failures for shaders exporting cull distance; implementing a shader fallback is separate follow-up work.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


🧠 Learnings used
Learnt from: overlordxrz-source
Repo: KytyPS5/KytyPS5 PR: 1082
File: src/graphics/presentation/window/vulkanWindow.cpp:550-553
Timestamp: 2026-10-05T22:54:53.940Z
Learning: In KytyPS5, macOS Vulkan device setup must allow MoltenVK devices without shaderBufferInt64Atomics to boot. Do not recommend rejecting the entire device solely because this optional feature is unavailable. Distinguish device-level acceptance from handling shaders that require the feature.

✅ Review thread resolved.

You are interacting with an AI system.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-05 22:58 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1082#discussion_r4189733829) `@overlordxrz-source` Thanks for the clarification. I withdraw the recommendation to require `shaderCullDistance` on Apple. That requirement would defeat the device-selection fix. The supplied code now warns that shaders exporting cull distance may fail pipeline creation. It also identifies the missing fallback as follow-up work. Device acceptance and support for those shaders are separate concerns. Would you like me to open a follow-up issue for the cull-distance shader fallback? --- <details> <summary>✏️ Learnings added</summary> ``` Learnt from: overlordxrz-source Repo: KytyPS5/KytyPS5 PR: 1082 File: src/graphics/presentation/window/vulkanWindow.cpp:636-638 Timestamp: 2026-10-05T22:58:24.177Z Learning: In KytyPS5, Apple Vulkan device selection and creation intentionally permit devices without shaderCullDistance. Do not recommend rejecting the device solely because this optional feature is unavailable. In src/graphics/presentation/window/vulkanWindow.cpp, warnings describe possible pipeline-creation failures for shaders exporting cull distance; implementing a shader fallback is separate follow-up work. ``` > Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure [review instructions](https://docs.coderabbit.ai/guides/review-instructions). You can manage existing learnings in the [app](https://app.coderabbit.ai/learnings). </details> --- <details> <summary>🧠 Learnings used</summary> ``` Learnt from: overlordxrz-source Repo: KytyPS5/KytyPS5 PR: 1082 File: src/graphics/presentation/window/vulkanWindow.cpp:550-553 Timestamp: 2026-10-05T22:54:53.940Z Learning: In KytyPS5, macOS Vulkan device setup must allow MoltenVK devices without shaderBufferInt64Atomics to boot. Do not recommend rejecting the entire device solely because this optional feature is unavailable. Distinguish device-level acceptance from handling shaders that require the feature. ``` </details> ✅ Review thread resolved. _You are interacting with an AI system._ <!-- This is an auto-generated reply by CodeRabbit -->
Author
Owner

@⁠juanfariasdev on GitHub · 2026-10-05 23:10 UTC · original

Hey @⁠overlordxrz-source, here's my full review of #1082 as of e709e9e, as promised. Your follow-up already fixed the log wording, so I left that out.

  1. Min-LOD trimming defeats the view cache (imageView.cpp): the trim runs after the cached.info == normalized lookup, but views.push_back({normalized, view}) stores the trimmed info (min_lod = 0, shifted base_level). The next call with the same untrimmed info never matches, so every FindView with a non-zero min_lod creates a new VkImageView, and the cache grows without bound.
  2. Trimming isn't equivalent to the clamp: shrinking the view changes what OpImageQuerySizeLod, OpImageQueryLevels and OpImageFetch return in the recompiled shaders, while VK_EXT_image_view_min_lod only clamps sampling LOD selection. Dropping the clamp seems safer than shifting the view.
  3. Shared code paths for a macOS-only problem: the min-LOD feature query, the runtime flags and the FindView checks also run on Windows and Linux. They should behave the same there, but I'd keep this behind __APPLE__.
  4. Flags with no real consumer: shader_buffer_int64_atomics_enabled is only read by the log line right after it's set. shader_cull_distance_enabled is only read for device creation, a few lines later.
  5. Redundant branches: in VulkanFindPhysicalDevice, the else { check_feature(...) } on __APPLE__ only runs when the feature is supported, so the check always passes.
  6. Enabling min LOD "when advertised" is dead code today: no MoltenVK release exposes the extension.
  7. Not enough to boot a game on its own: after device creation, Dead Cells fails on Subgroup builtins are not available in this type of function (the same next blocker #1068 reports for GRIS), and on MoltenVK 1.4.1+ push descriptors corrupt rendering. #1083 handles both, so I'd suggest closing this one in favor of #1083 to avoid conflicting changes in vulkanWindow.cpp.
**@⁠juanfariasdev** on GitHub · 2026-10-05 23:10 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1082#issuecomment-6005118979) Hey @⁠overlordxrz-source, here's my full review of #1082 as of e709e9e, as promised. Your follow-up already fixed the log wording, so I left that out. 1. **Min-LOD trimming defeats the view cache** (`imageView.cpp`): the trim runs after the `cached.info == normalized` lookup, but `views.push_back({normalized, view})` stores the trimmed info (`min_lod = 0`, shifted `base_level`). The next call with the same untrimmed info never matches, so every `FindView` with a non-zero `min_lod` creates a new `VkImageView`, and the cache grows without bound. 2. **Trimming isn't equivalent to the clamp**: shrinking the view changes what `OpImageQuerySizeLod`, `OpImageQueryLevels` and `OpImageFetch` return in the recompiled shaders, while `VK_EXT_image_view_min_lod` only clamps sampling LOD selection. Dropping the clamp seems safer than shifting the view. 3. **Shared code paths for a macOS-only problem**: the min-LOD feature query, the runtime flags and the `FindView` checks also run on Windows and Linux. They should behave the same there, but I'd keep this behind `__APPLE__`. 4. **Flags with no real consumer**: `shader_buffer_int64_atomics_enabled` is only read by the log line right after it's set. `shader_cull_distance_enabled` is only read for device creation, a few lines later. 5. **Redundant branches**: in `VulkanFindPhysicalDevice`, the `else { check_feature(...) }` on `__APPLE__` only runs when the feature is supported, so the check always passes. 6. **Enabling min LOD "when advertised"** is dead code today: no MoltenVK release exposes the extension. 7. **Not enough to boot a game on its own**: after device creation, Dead Cells fails on `Subgroup builtins are not available in this type of function` (the same next blocker #1068 reports for GRIS), and on MoltenVK 1.4.1+ push descriptors corrupt rendering. #1083 handles both, so I'd suggest closing this one in favor of #1083 to avoid conflicting changes in `vulkanWindow.cpp`.
Author
Owner

@⁠overlordxrz-source on GitHub · 2026-10-06 00:32 UTC · original

Replying to @⁠juanfariasdev's review: all seven points taken - point 1 is a genuine cache-coherence bug I introduced (lookup-before-trim, store-after-trim), and point 2 settles it semantically (dropping beats shifting for query/fetch correctness). Rather than rework this PR into a worse #1083, I'm closing it in favor of yours: yours is behind APPLE throughout, honestly states the atomics/cull limitations, covers the next two real blockers (push descriptors, vertex subgroups), and is tested against actual games. Thanks for the thorough review - it made the right call obvious.

**@⁠overlordxrz-source** on GitHub · 2026-10-06 00:32 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1082#issuecomment-6006561286) Replying to @⁠juanfariasdev's review: all seven points taken - point 1 is a genuine cache-coherence bug I introduced (lookup-before-trim, store-after-trim), and point 2 settles it semantically (dropping beats shifting for query/fetch correctness). Rather than rework this PR into a worse #1083, I'm closing it in favor of yours: yours is behind __APPLE__ throughout, honestly states the atomics/cull limitations, covers the next two real blockers (push descriptors, vertex subgroups), and is tested against actual games. Thanks for the thorough review - it made the right call obvious.
Author
Owner

@⁠overlordxrz-source on GitHub · 2026-10-06 00:32 UTC · original

Superseded by #1083, which covers this PR's device-selection fix plus the next two macOS blockers (push descriptors, vertex subgroup builtins), all behind APPLE and tested against real games. See discussion above for the review points that decided it.

**@⁠overlordxrz-source** on GitHub · 2026-10-06 00:32 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1082#issuecomment-6006562278) Superseded by #1083, which covers this PR's device-selection fix plus the next two macOS blockers (push descriptors, vertex subgroup builtins), all behind __APPLE__ and tested against real games. See discussion above for the review points that decided it.

Pull request closed

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