graphics: make fragment shader barycentrics optional #959
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
GPU
GUI
help wanted
question
Shaders
Video
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/KytyPS5--KytyPS5!959
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/959/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Aryansh1520 on GitHub · 2026-10-01 14:46 UTC · original
Aryansh1520:fix/gpu-device-requirements→main· +143 −54 · 10 files · 3 commits · closed without mergingFixes #489
Fixes #1059
Problem
VK_KHR_fragment_shader_barycentricwas a hard device requirement. RADV only exposes it on GFX10.3+ (RDNA2), so older AMD GPUs were rejected withCould not find suitable device. The log attached to #489 shows the AMD BC-250 (RADV GFX1013, Mesa 26.2) passing every feature check and failing only on the missing extension. Other pre-RDNA2 RADV reports in that thread (e.g. RX 580) likely hit the same requirement.Fix
Device setup (
vulkanWindow.cpp): the extension is requested only when it is available, in the same way as the other optional extensions (provoking vertex, mesh shader, ...). Its feature struct is chained into device creation only when supported, and the result is stored inGraphicContext::fragment_shader_barycentric_enabled. Devices without it log a warning instead of being rejected.Recompiler: ordinary
V_INTERP_P1/P2interpolation never needed barycentrics. They are only needed by pixel shaders that read raw vertex attributes (V_INTERP_MOVof a smooth or custom parameter) or that read the barycentric VGPRs directly. The newCompileOptions::fragment_shader_barycentricflag, passed through toCollectShaderInfo, changes how those shaders compile when the extension is missing:PerVertexKHR.p0 + i*p10 + j*p20therefore still get the interpolated attribute.BaryCoord*builtins are not declared and read as 0.With the extension available, the generated SPIR-V is unchanged.
macOS: the extension is now enabled when MoltenVK exposes it. Before this change it was never enabled there, even though the recompiler could still emit the capability.
Testing
TestVintrpMovWithoutHostBarycentricsinshader_cfg_tests. It checks, for standard and custom parameters, that there is noFragmentBarycentricKHR, noPerVertexKHR, noBaryCoordKHRand no delta subtraction, and that the SPIR-V validates. I confirmed it fails when barycentrics are enabled. The rest ofshader_cfg_testspasses.fragmentShaderBarycentricas the only failed check on that GPU, so this should fix it. #451 (also Iris Xe) has no log, but is likely the same failure.Platform impact
mode < 2interpolation read marks its input per-vertex, and that flag is never cleared, so the new zero-delta path inEmitInterpolationParameteris unreachable.FragmentBarycentricKHR/PerVertexKHR. Now it is enabled only when MoltenVK reports it, and otherwise the shader takes the fallback, so no unsupported capability is emitted. The existing macOS paths (depth clip, color write, depth bounds) are untouched.main(after 64-bit image atomics and theVulkan11Featuresprobe); both are kept alongside the optional barycentric feature chain.@coderabbitai[bot] on GitHub · 2026-10-01 14:56 UTC · original · edited 2026-10-07 14:19 UTC
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
0259b56d-d4bb-4653-81d6-67295bf9fa6f📥 Commits
Reviewing files that changed from the base of the PR and between
cff346b5c3and074805a392.📒 Files selected for processing (1)
src/loader/runtimeLinker.cppIncluded review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
📝 Walkthrough
Walkthrough
Vulkan fragment-shader barycentric support is optional during device selection and creation. The detected capability is stored in the graphics context and passed through the pipeline cache to shader compilation. Pixel shader input collection and SPIR-V emission account for the capability, and a regression test checks generated SPIR-V when host barycentrics are disabled. Guest fault reports now include host module details and use fatal logging.
Suggested reviewers:
ew-sudoPriority: ➖ Normal
Change: Bug fix · Severity of issue fixed: Medium
Merge Risk: ⚪ Minimal · up to
07480No identified issue blocks merging. The changed fault report still reaches stdout before the process exits.
Security Architecture Review
Security architecture risk: 🔵 Low · up to
cff34The change supports more GPUs while retaining device capability checks. No added access or privilege was identified, but the available tests do not establish behavior across the newly supported hardware.
Retained concerns
No architecture-level concerns identified.
Security review details
Security Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 3 | ❌ 2
❌ Failed checks (2 warnings)
src/loader/runtimeLinker.cppadds host-module lookup and changes guest fault reporting. This change does not support optional barycentric device setup or shader fallback for [#489] or [#1059].runtimeLinker.cpphost-module and fault-reporting changes from this pull request, or submit them in a separate pull request.✅ Passed checks (3 passed)
#489] Device selection no longer requiresfragmentShaderBarycentric; device creation enables it only when available and records the capability. [#1059…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 helpto get the list of available commands.@AdelRdp2024 on GitHub · 2026-10-03 21:35 UTC · original
Thanks for this fix. I’m also affected by the Could not find suitable device issue on an older NVIDIA GPU (GTX 980).
It would be great if this PR could be merged into main so users with older GPUs can test it. I’d be happy to test a Windows build of this commit on my GTX 980 and report the result.
@salvatorelobianco on GitHub · 2026-10-11 13:28 UTC · original
Hi, I can help test this on real RDNA 1 hardware.
My setup:
With the official build KytyPS5-2026-10-11-16a7fe6 the emulator exits at startup with:
Could not find suitable device:
AMD Radeon RX 5700 XT: fragmentShaderBarycentric is not supported in vulkanWindow.cpp:980
This is the same error as in #1340, #1364 and #1416. As far as I can tell, no one has tested this PR on an RDNA 1 GPU yet, so I'd be happy to try a build that includes it and report back with logs, both for startup and for any games that hit the shader fallback path.
Is there an artifact or a branch I can test? Thanks!
@salvatorelobianco on GitHub · 2026-10-11 13:33 UTC · original
Update: I tested the Windows artifact from this PR's CI (source build 356e980) on real RDNA 1 hardware.
Setup:
Result:
The emulator then crashes with an unhandled host exception (access violation, address 0x18, inside VCRUNTIME140.dll) at runtimeLinker.cpp:749. Right before it, there are four "Unresolved import stub called" lines for NpCppWebApi_v1. I don't see anything in the log pointing at shaders or barycentrics, so this looks unrelated to this PR, but I can't say for sure. Full log attached below.
So the device-selection change works on RDNA 1. I haven't yet been able to check rendering on a game that gets further. I'll test other titles and report back.
Initialized: Config
Initialized: Log
Initialized: Timer
Initialized: Pthread
Initialized: Profiler
Initialized: Network
Initialized: Memory
Initialized: FileSystem
Initialized: Controller
Initialized: Audio
WARNING: fragmentShaderBarycentric is unavailable. Pixel shaders that read raw vertex attributes will use interpolated values, which may cause rendering errors.
Vulkan pipeline cache: initializing _PipelineCache\PPSA21567.bin
Vulkan pipeline cache: initialized empty
Initialized: Graphics
Title ID: PPSA21567
version = 13
Unresolved import stub called: Y295ygEccqk[NpCppWebApi_v1][NpCppWebApi_v1.1][Func]
Unresolved import stub called: 8x++mBOUeso[NpCppWebApi_v1][NpCppWebApi_v1.1][Func]
Unresolved import stub called: UYPxv8MIzGo[NpCppWebApi_v1][NpCppWebApi_v1.1][Func]
Unresolved import stub called: 52AlYvq+dmk[NpCppWebApi_v1][NpCppWebApi_v1.1][Func]
Shaders: VS 0 | PS 0 | CS 1 | GS 0 | LS 0 | HS 0 | TES 0
Shaders: VS 0 | PS 0 | CS 2 | GS 0 | LS 0 | HS 0 | TES 0
Shaders: VS 0 | PS 1 | CS 2 | GS 0 | LS 0 | HS 0 | TES 0
Shader: emitted zero-position clip guard
Shaders: VS 1 | PS 1 | CS 2 | GS 0 | LS 0 | HS 0 | TES 0
Shaders: VS 1 | PS 1 | CS 3 | GS 0 | LS 0 | HS 0 | TES 0
Shaders: VS 1 | PS 1 | CS 4 | GS 0 | LS 0 | HS 0 | TES 0
Shaders: VS 1 | PS 1 | CS 5 | GS 0 | LS 0 | HS 0 | TES 0
Shaders: VS 1 | PS 1 | CS 6 | GS 0 | LS 0 | HS 0 | TES 0
Shaders: VS 1 | PS 1 | CS 7 | GS 0 | LS 0 | HS 0 | TES 0
Shaders: VS 1 | PS 1 | CS 8 | GS 0 | LS 0 | HS 0 | TES 0
Shaders: VS 1 | PS 1 | CS 9 | GS 0 | LS 0 | HS 0 | TES 0
Shaders: VS 1 | PS 1 | CS 10 | GS 0 | LS 0 | HS 0 | TES 0
Shaders: VS 1 | PS 1 | CS 11 | GS 0 | LS 0 | HS 0 | TES 0
Shaders: VS 1 | PS 1 | CS 12 | GS 0 | LS 0 | HS 0 | TES 0
Shaders: VS 1 | PS 1 | CS 13 | GS 0 | LS 0 | HS 0 | TES 0
Shaders: VS 2 | PS 1 | CS 13 | GS 0 | LS 0 | HS 0 | TES 0
Shaders: VS 2 | PS 1 | CS 14 | GS 0 | LS 0 | HS 0 | TES 0
Shaders: VS 2 | PS 1 | CS 15 | GS 0 | LS 0 | HS 0 | TES 0
Shaders: VS 2 | PS 2 | CS 15 | GS 0 | LS 0 | HS 0 | TES 0
Shaders: VS 3 | PS 2 | CS 15 | GS 0 | LS 0 | HS 0 | TES 0
--- Guest fault context ---
thread: (host thread)
rax=0000013ff69eda60 rbx=0000013ff69ede70 rcx=0000013ff69eda60 rdx=0000000000000018
rsi=0000000000000018 rdi=0000013ff69eda98 rbp=0000000000000000 rsp=0000013ff69ed9c8
r8 =0000000000000004 r9 =00007ffb4e38dc1a r10=00007ffb4e370000 r11=0000000000000000
r12=0000000000000018 r13=000001400a732040 r14=000001400c6c48b0 r15=0000000000000000
module: C:\WINDOWS\SYSTEM32\VCRUNTIME140.dll+0x1dc1a
code (pc-48 .. pc+48, fault at byte 48):
89 00 89 48 08 c3 8b 0a 44 0f b7 42 04 89 08 66
44 89 40 04 c3 8b 0a 44 0f b6 42 04 89 08 44 88
40 04 c3 48 8b 0a 48 89 08 c3 0f b6 0a 88 08 c3
8b 0a 89 08 c3 90 49 83 f8 20 77 17 f3 0f 6f 0a
f3 42 0f 6f 54 02 f0 f3 0f 7f 09 f3 42 0f 7f 54
01 f0 c3 4e 8d 0c 02 48 3b ca 4c 0f 46 c9 49 3b
stack:
0000000140a03d2e 0000000000000000 0000000000000000 0000000000000000
0000013ff69eda90 fffffffffffffffe 000001400c6c4820 0000013ff69edf28
0000013ff69edd40 0000000000000018 0000b3ee11d211d6 0000013ff69eda60
0000013ff69edf28 0000013ff69edd40 0000000140a304ed 0000014003cb4d70
0000014003cb44a0 000000000000008e 0000000000000060 0000000000000000
0000000000000000 0000000000440000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000013ff69eda60 0000000000000001
0000000000000040 000000000000004c 0000013ff69edf28 0000013ff69edb80
--- Build ---
Source build 356e980
--- Error ---
Unhandled host exception: type=1 code=3221225477 pc=0x00007ffb4e38dc1a access=1 address=0x0000000000000018
in D:\a\KytyPS5\KytyPS5\src\loader\runtimeLinker.cpp:749
C:\Users\salvo\Desktop\KytyPS5>
Pull request closed