Преглед изворни кода

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
santouits пре 6 година
родитељ
комит
e7e9a7cc6c
1 измењених фајлова са 5 додато и 10 уклоњено
  1. 5 10
      drivers/gles2/shaders/canvas.glsl

+ 5 - 10
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