summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsantouits <santouits@users.noreply.github.com>2019-01-21 21:04:46 +0200
committersantouits <santouits@users.noreply.github.com>2019-01-21 21:41:39 +0200
commite7e9a7cc6cc5e7bde5b1733dfac7a708cd84571d (patch)
tree3e74dab4b36a65da94aa2aa80cbd2dd870fff335
parent09e4d7e9ebb3aa1f1d8b7adf96778a9568797518 (diff)
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
-rw-r--r--drivers/gles2/shaders/canvas.glsl15
1 files changed, 5 insertions, 10 deletions
diff --git a/drivers/gles2/shaders/canvas.glsl b/drivers/gles2/shaders/canvas.glsl
index 0de60d7421..d483659e4d 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