From e7e9a7cc6cc5e7bde5b1733dfac7a708cd84571d Mon Sep 17 00:00:00 2001 From: santouits Date: Mon, 21 Jan 2019 21:04:46 +0200 Subject: [PATCH] webgl1 doesn't like backslashes in #define According to https://www.khronos.org/registry/OpenGL/specs/es/2.0/GLSL_ES_Specification_1.00.pdf , backslashes aren't necessary supported as line continuation characters in preprocessor directives --- drivers/gles2/shaders/canvas.glsl | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/gles2/shaders/canvas.glsl b/drivers/gles2/shaders/canvas.glsl index 0de60d74214..d483659e4d4 100644 --- a/drivers/gles2/shaders/canvas.glsl +++ b/drivers/gles2/shaders/canvas.glsl @@ -433,19 +433,14 @@ FRAGMENT_SHADER_CODE #ifdef SHADOW_USE_GRADIENT -#define SHADOW_TEST(m_ofs) \ - { \ - highp float sd = SHADOW_DEPTH(shadow_texture, vec2(m_ofs, sh)); \ - shadow_attenuation += 1.0 - smoothstep(sd, sd + shadow_gradient, sz); \ - } + /* clang-format off */ + /* GLSL es 100 doesn't support line continuation characters(backslashes) */ +#define SHADOW_TEST(m_ofs) { highp float sd = SHADOW_DEPTH(shadow_texture, vec2(m_ofs, sh)); shadow_attenuation += 1.0 - smoothstep(sd, sd + shadow_gradient, sz); } #else -#define SHADOW_TEST(m_ofs) \ - { \ - highp float sd = SHADOW_DEPTH(shadow_texture, vec2(m_ofs, sh)); \ - shadow_attenuation += step(sz, sd); \ - } +#define SHADOW_TEST(m_ofs) { highp float sd = SHADOW_DEPTH(shadow_texture, vec2(m_ofs, sh)); shadow_attenuation += step(sz, sd); } + /* clang-format on */ #endif