From 906a04f1fdf152ba20f6f6e9de67c8e000cb656c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 26 Oct 2021 09:56:38 +0200 Subject: [PATCH] Make sure to not leave cull distance uninitialized in other paths, if we do write to it in some path. --- GPU/Common/VertexShaderGenerator.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/GPU/Common/VertexShaderGenerator.cpp b/GPU/Common/VertexShaderGenerator.cpp index a4d8c68a63..d92a3347e4 100644 --- a/GPU/Common/VertexShaderGenerator.cpp +++ b/GPU/Common/VertexShaderGenerator.cpp @@ -1135,7 +1135,10 @@ bool GenerateVertexShader(const VShaderID &id, char *buffer, const ShaderLanguag WRITE(p, " if (u_cullRangeMin.w > 0.0) {\n"); WRITE(p, " %sgl_CullDistance%s = projPos.z - u_cullRangeMin.z;\n", compat.vsOutPrefix, cull0); WRITE(p, " %sgl_CullDistance%s = u_cullRangeMax.z - projPos.z;\n", compat.vsOutPrefix, cull1); - WRITE(p, " }\n"); + WRITE(p, " } else {\n"); + WRITE(p, " %sgl_CullDistance%s = 0.0;\n", compat.vsOutPrefix, cull0); + WRITE(p, " %sgl_CullDistance%s = 0.0;\n", compat.vsOutPrefix, cull1); + WRITE(p, " }"); } }