From e6125ffa462a759fe67c0d7d5d95d3b5cce313b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D1=80=D0=B0=D0=BD=D0=B8=D0=BC=D0=B8=D1=80=20=D0=9A?= =?UTF-8?q?=D0=B0=D1=80=D0=B0=D1=9F=D0=B8=D1=9B?= Date: Fri, 19 Nov 2021 19:11:59 -0800 Subject: [PATCH] shaderc: Fixed gl_FragColor patching for raw GLSL. --- tools/shaderc/shaderc.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tools/shaderc/shaderc.cpp b/tools/shaderc/shaderc.cpp index 6bc34ee82..34cc8e097 100644 --- a/tools/shaderc/shaderc.cpp +++ b/tools/shaderc/shaderc.cpp @@ -2491,6 +2491,17 @@ namespace bgfx { bx::stringPrintf(code, "#version %d\n", glsl_profile); + if (120 < glsl_profile) + { + if (!bx::findIdentifierMatch(input, "gl_FragColor").isEmpty() ) + { + bx::stringPrintf(code + , "out vec4 bgfx_FragColor;\n" + "#define gl_FragColor bgfx_FragColor\n" + ); + } + } + bx::stringPrintf(code , "#define texture2DLod textureLod\n" "#define texture2DGrad textureGrad\n"