From 36eb0d9ad5994fe4e4ad9f02e4732efc397fc631 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 1 Oct 2022 20:42:00 -0700 Subject: [PATCH] Vulkan: Use geo clip distance only where supported. It might be supported without cull or GS. Otherwise we may need to clip the triangles manually. --- GPU/Common/GeometryShaderGenerator.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/GPU/Common/GeometryShaderGenerator.cpp b/GPU/Common/GeometryShaderGenerator.cpp index 2c2906d100..0121d7748a 100644 --- a/GPU/Common/GeometryShaderGenerator.cpp +++ b/GPU/Common/GeometryShaderGenerator.cpp @@ -114,8 +114,9 @@ bool GenerateGeometryShader(const GShaderID &id, char *buffer, const ShaderLangu p.C(" vec3 projPos = outPos.xyz / outPos.w;\n"); p.C(" float projZ = (projPos.z - u_depthRange.z) * u_depthRange.w;\n"); // TODO: Not rectangles... - // TODO: Check feature flag. - //p.F(" gl_ClipDistance%s = projZ * outPos.w + outPos.w;\n", clip0); + if (gstate_c.Supports(GPU_SUPPORTS_CLIP_DISTANCE)) { + p.F(" gl_ClipDistance%s = projZ * outPos.w + outPos.w;\n", clip0); + } for (size_t i = 0; i < varyings.size(); i++) { VaryingDef &in = varyings[i];