graphics: make VK_KHR_fragment_shader_barycentric optional for GPUs without native support #1346

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

@⁠Olavo635 on GitHub · 2026-10-10 00:20 UTC · original
Olavo635:fix/barycentric-gpu-support → main · +46 −30 · 3 files · 2 commits · closed without merging

Problem

vulkanWindow.cpp rejects every device that lacks fragmentShaderBarycentric on non-Apple platforms (#if !defined(__APPLE__)), causing the emulator to exit immediately at startup on GPUs without native barycentrics (e.g. AMD Radeon RX 5700 XT / RDNA 1 on Windows: #1340). Meanwhile, macOS already runs without this requirement because MoltenVK does not expose it.

Changes

  • Remove VK_KHR_FRAGMENT_SHADER_BARYCENTRIC_EXTENSION_NAME from mandatory device_extensions and probe it among optional device extensions instead.
  • In VulkanFindPhysicalDevice, do not reject devices that lack fragmentShaderBarycentric.
  • In VulkanCreateDevice, probe supported_barycentric.fragmentShaderBarycentric and record GraphicContext::supports_fragment_barycentric. If supported, enable fragmentShaderBarycentric = VK_TRUE in the device features pNext chain; if unsupported, omit the struct, log a warning, and proceed.
  • Update README.md to note that modern GPUs supporting VK_KHR_fragment_shader_barycentric (such as AMD RDNA 2+) are recommended for full shader fidelity.

Fixes #1340

**@⁠Olavo635** on GitHub · 2026-10-10 00:20 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1346) `Olavo635:fix/barycentric-gpu-support` → `main` · +46 −30 · 3 files · 2 commits · closed without merging ## Problem `vulkanWindow.cpp` rejects every device that lacks `fragmentShaderBarycentric` on non-Apple platforms (`#if !defined(__APPLE__)`), causing the emulator to exit immediately at startup on GPUs without native barycentrics (e.g. AMD Radeon RX 5700 XT / RDNA 1 on Windows: #1340). Meanwhile, macOS already runs without this requirement because MoltenVK does not expose it. ## Changes - Remove `VK_KHR_FRAGMENT_SHADER_BARYCENTRIC_EXTENSION_NAME` from mandatory `device_extensions` and probe it among optional device extensions instead. - In `VulkanFindPhysicalDevice`, do not reject devices that lack `fragmentShaderBarycentric`. - In `VulkanCreateDevice`, probe `supported_barycentric.fragmentShaderBarycentric` and record `GraphicContext::supports_fragment_barycentric`. If supported, enable `fragmentShaderBarycentric = VK_TRUE` in the device features `pNext` chain; if unsupported, omit the struct, log a warning, and proceed. - Update `README.md` to note that modern GPUs supporting `VK_KHR_fragment_shader_barycentric` (such as AMD RDNA 2+) are recommended for full shader fidelity. Fixes #1340
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:54:00 +00:00
github-bot closed this pull request 2026-11-26 09:54:00 +00:00
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-10-10 00:22 UTC · original

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-10T00:22:30.905684Z ddba4a0 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@⁠codex review" or "@⁠codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-10-10 00:22 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1346#issuecomment-6091553963) <!-- codex-pull-request-review-summary --> ## Codex Review Summary This comment shows the latest Codex review activity on this pull request. | Review | Status | Commit | Review trigger | | --- | --- | --- | --- | | 📝 **Code Review** | ⚠️ **Failed** <relative-time datetime="2026-10-10T00:22:30.905684Z">2026-10-10T00:22:30.905684Z</relative-time> | `ddba4a0` | PR opened | <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@⁠codex review" or "@⁠codex security review". Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. </details>
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-10 00:23 UTC · original · edited 2026-10-10 00:38 UTC

Review in Change Stack →

📝 Walkthrough

Walkthrough

Vulkan device selection no longer rejects devices that lack VK_KHR_fragment_shader_barycentric or its feature. Device creation records support when both are available and enables the feature only in that case. The GraphicContext struct adds a support flag. The README recommends an AMD RDNA 2-or-newer GPU or a modern GPU with barycentric support for full shader fidelity.


Priority: ➖ Normal

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: 🟡 Moderate · up to 8c74c

Games using affected shaders may still exit on GPUs the change is intended to support. Provide a shader fallback before merging, or explicitly accept that limitation.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 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 and concisely describes the main change: making VK_KHR_fragment_shader_barycentric optional for unsupported GPUs.
Description check Passed The description directly explains the startup failure, the optional-extension changes, device capability handling, and README update.
Linked Issues check Passed Issue #1340 requires the emulator to start when a GPU does not report fragmentShaderBarycentric, or to document the requirement. VulkanFindPhysicalDevice now enumerates available_extensions befo…
Out of Scope Changes check Passed The changes stay within issue #1340. vulkanWindow.cpp makes barycentric support optional, graphicContext.h records the capability, and README.md documents the hardware recommendation. These chan…


  • Autofix · 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-10 00:23 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1346#issuecomment-6091566129) · edited 2026-10-10 00:38 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/1346?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><strong>📝 Walkthrough</strong></summary> ## Walkthrough Vulkan device selection no longer rejects devices that lack `VK_KHR_fragment_shader_barycentric` or its feature. Device creation records support when both are available and enables the feature only in that case. The `GraphicContext` struct adds a support flag. The README recommends an AMD RDNA 2-or-newer GPU or a modern GPU with barycentric support for full shader fidelity. <hr> </details> <!-- walkthrough_end --> <!-- change_assessment_start --> **Priority:** ➖ Normal <!-- change_assessment_commit:"8c74ca5e51d63ea82ba64881ffa35a5a43636c06" --> **Change:** Bug fix · **Severity of issue fixed:** Medium <!-- change_assessment_end --> <!-- final_review_risk_start --> **Merge Risk:** **🟡 Moderate** · up to `8c74c` <!-- final_review_risk_coverage:{"sourceCommitId":"8c74ca5e51d63ea82ba64881ffa35a5a43636c06","coveredCommitId":"8c74ca5e51d63ea82ba64881ffa35a5a43636c06","kind":"reviewed"} --> Games using affected shaders may still exit on GPUs the change is intended to support. Provide a shader fallback before merging, or explicitly accept that limitation. <!-- final_review_risk_end --> <!-- pre_merge_checks_walkthrough_start --> <details> <summary><strong>Pre-merge checks | <sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-passed-14-v1.svg" width="14" height="17" align="middle" alt="Passed" title="Passed"></picture></sup> 4 | <sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-failed-14-v1.svg" width="14" height="17" align="middle" alt="Failed" title="Failed"></picture></sup> 1</strong></summary> ### ❌ Failed checks (1 warning) | Check name | Status | Explanation | Resolution | | :---------------- | :----------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------- | | Docstring Coverage | ![Warning](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-warning.svg) | Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. | Write docstrings for the functions missing them to satisfy the coverage threshold. | <details> <summary><strong>✅ Passed checks (4 passed)</strong></summary> | Check name | Status | Explanation | | :------------------------ | :--------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Title check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The title clearly and concisely describes the main change: making VK_KHR_fragment_shader_barycentric optional for unsupported GPUs. | | Description check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The description directly explains the startup failure, the optional-extension changes, device capability handling, and README update. | | Linked Issues check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | Issue `#1340` requires the emulator to start when a GPU does not report `fragmentShaderBarycentric`, or to document the requirement. `VulkanFindPhysicalDevice` now enumerates `available_extensions` befo… | | Out of Scope Changes check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The changes stay within issue `#1340`. `vulkanWindow.cpp` makes barycentric support optional, `graphicContext.h` records the capability, and `README.md` documents the hardware recommendation. These chan… | <hr> </details> <hr> </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">Autofix</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=1346)! 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> - [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) <hr> </details> <sub>Comment `@coderabbitai help` to get the list of available commands.</sub> <!-- tips_end -->
@ -223,2 +226,2 @@
features12.pNext = &fragment_barycentric;
#endif
const bool has_barycentric_ext =
HasExtension(available_extensions, VK_KHR_FRAGMENT_SHADER_BARYCENTRIC_EXTENSION_NAME);
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-10 00:23 UTC · original · edited 2026-10-10 00:34 UTC

🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win

Enumerate device extensions before checking barycentric support.

available_extensions is not in scope at Line 220. Its later declaration is inside a separate block at Lines 323-343. This prevents vulkanWindow.cpp from compiling. Enumerate extensions for the current device before the feature query, then reuse that result for the required-extension check.

✅ Addressed in commit 8c74ca5

**@⁠coderabbitai[bot]** on GitHub · 2026-10-10 00:23 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1346#discussion_r4235604460) · edited 2026-10-10 00:34 UTC **🎯 Functional Correctness** | **🔴 Critical** | **⚡ Quick win** **Enumerate device extensions before checking barycentric support.** `available_extensions` is not in scope at Line 220. Its later declaration is inside a separate block at Lines 323-343. This prevents `vulkanWindow.cpp` from compiling. Enumerate extensions for the current `device` before the feature query, then reuse that result for the required-extension check. <!-- fingerprinting:phantom:poseidon:wombat --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:f885615c72f7af644d94af09 --> <!-- This is an auto-generated comment by CodeRabbit --> ✅ Addressed in commit 8c74ca5
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-10 00:23 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: 785ba77e-d309-4041-b82d-7c83dc62f5b1
📥 Commits

Reviewing files that changed from the base of the PR and between 59183dbfa8 and ddba4a0f29.

📒 Files selected for processing (3)
  • README.md
  • src/graphics/host_gpu/graphicContext.h
  • 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-10 00:23 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1346#pullrequestreview-5476586293) · **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**: `785ba77e-d309-4041-b82d-7c83dc62f5b1` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 59183dbfa81ed7efdff6069177fed50de0552725 and ddba4a0f296095965773b152dbdfd85399f83975. </details> <details> <summary>📒 Files selected for processing (3)</summary> * `README.md` * `src/graphics/host_gpu/graphicContext.h` * `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=2aa72a98-ed67-4853-9cd5-d8968de5a5ea attempt=4ed41d01-8052-406a-a605-ed980564d058 batch=1/1 -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-10 00:38 UTC · original · reviewed

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

🟠 Major · Thread barycentric support into shader lowering. · vulkanWindow.cpp:500-502

src/graphics/presentation/window/vulkanWindow.cpp:500-502
🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift

Thread barycentric support into shader lowering.

When a selected device lacks VK_KHR_fragment_shader_barycentric, an affected pixel shader can still emit CapabilityFragmentBarycentricKHR and SPV_KHR_fragment_shader_barycentric. Vulkan requires the extension and enabled fragmentShaderBarycentric feature for these constructs. Shader-module or graphics-pipeline creation can therefore fail, and the pipeline path treats that failure as fatal.

Apply the optional-device boundary in the recompiler. Use a lower-fidelity non-barycentric lowering for these inputs, or otherwise handle the affected shader without a fatal pipeline failure. Do not only omit the device feature. This path affects shaders that use non-flat per-vertex inputs, not all games.


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: de68e7ba-8662-4a9e-a7f6-fae4ffb062f3
📥 Commits

Reviewing files that changed from the base of the PR and between ddba4a0f29 and 8c74ca5e51.

📒 Files selected for processing (1)
  • src/graphics/presentation/window/vulkanWindow.cpp
🚧 Files skipped from review as they are similar to previous changes (1)
  • 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; 6 remain after this review.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-10 00:38 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1346#pullrequestreview-5476653253) · **reviewed** > [!CAUTION] > Some comments are outside the diff and can’t be posted inline due to GitHub limitations. > > **⚠️ Outside diff range comments (1)** > > <details> > <summary><strong>🟠 Major</strong> · Thread barycentric support into shader lowering. · <code>vulkanWindow.cpp:500-502</code></summary><blockquote> > > `src/graphics/presentation/window/vulkanWindow.cpp:500-502` > **🩺 Stability & Availability** | **🟠 Major** | **🏗️ Heavy lift** > > **Thread barycentric support into shader lowering.** > > When a selected device lacks `VK_KHR_fragment_shader_barycentric`, an affected pixel shader can still emit `CapabilityFragmentBarycentricKHR` and `SPV_KHR_fragment_shader_barycentric`. Vulkan requires the extension and enabled `fragmentShaderBarycentric` feature for these constructs. Shader-module or graphics-pipeline creation can therefore fail, and the pipeline path treats that failure as fatal. > > Apply the optional-device boundary in the recompiler. Use a lower-fidelity non-barycentric lowering for these inputs, or otherwise handle the affected shader without a fatal pipeline failure. Do not only omit the device feature. This path affects shaders that use non-flat per-vertex inputs, not all games. > > <!-- cr-comment:v1:7e2d83f5d92d5d78792cb5c2 --> > > </blockquote></details> --- <details> <summary>ℹ️ Review info</summary> <details> <summary>⚙️ Run configuration</summary> - **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `de68e7ba-8662-4a9e-a7f6-fae4ffb062f3` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between ddba4a0f296095965773b152dbdfd85399f83975 and 8c74ca5e51d63ea82ba64881ffa35a5a43636c06. </details> <details> <summary>📒 Files selected for processing (1)</summary> * `src/graphics/presentation/window/vulkanWindow.cpp` </details> <details> <summary>🚧 Files skipped from review as they are similar to previous changes (1)</summary> * 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; 6 remain after this review. </details> <!-- This is an auto-generated comment by CodeRabbit for review status --> <!-- coderabbit-review-publication v1 publication=ef7f9a2e-c571-4b94-98e9-9609542ec60a attempt=8f1a22fc-b471-4bdf-a6ff-c6726d84bb38 batch=1/1 -->
Author
Owner

@⁠theantipopau on GitHub · 2026-10-10 02:38 UTC · original

Evidence from a Windows fork build (AMD RX-series host, clang-cl): both commits (ddba4a0f + 8c74ca5e) apply cleanly on top of current fork main (ccfb55d9, which includes f3836bb8's upstream/main merge) as picks e4349251 + c1800f87.

  • Full build passes with zero errors; the extension enumeration reorder merges into our renderer without touching our fork-only descriptor plumbing.
  • Targeted Windows ctest set green after the picks: kernel_file_system, controller_settings, resource_materialization, memory_tracker, page_manager, archive_file, windows_file_read, shader_cfg — 8/8 pass.
  • This unblocks exactly our class of GPU: with fragmentShaderBarycentric optional, cards without native barycentric support no longer fail device creation, so we can no longer attribute those local Vulkan-harness failures to missing perms without double-checking driver state.

LGTM from the fork side; happy to smoke-test a release artifact on a barycentric-less GPU if you want one more data point upstream.

**@⁠theantipopau** on GitHub · 2026-10-10 02:38 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1346#issuecomment-6092866506) Evidence from a Windows fork build (AMD RX-series host, clang-cl): both commits (`ddba4a0f` + `8c74ca5e`) apply cleanly on top of current fork main (`ccfb55d9`, which includes f3836bb8's upstream/main merge) as picks `e4349251` + `c1800f87`. - Full build passes with zero errors; the extension enumeration reorder merges into our renderer without touching our fork-only descriptor plumbing. - Targeted Windows ctest set green after the picks: kernel_file_system, controller_settings, resource_materialization, memory_tracker, page_manager, archive_file, windows_file_read, shader_cfg — 8/8 pass. - This unblocks exactly our class of GPU: with `fragmentShaderBarycentric` optional, cards without native barycentric support no longer fail device creation, so we can no longer attribute those local Vulkan-harness failures to missing perms without double-checking driver state. LGTM from the fork side; happy to smoke-test a release artifact on a barycentric-less GPU if you want one more data point upstream.

Pull request closed

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