summaryrefslogtreecommitdiff
path: root/drivers/gles2/shaders/canvas.glsl
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gles2/shaders/canvas.glsl')
-rw-r--r--drivers/gles2/shaders/canvas.glsl47
1 files changed, 35 insertions, 12 deletions
diff --git a/drivers/gles2/shaders/canvas.glsl b/drivers/gles2/shaders/canvas.glsl
index 0de60d7421..c4a8c8b990 100644
--- a/drivers/gles2/shaders/canvas.glsl
+++ b/drivers/gles2/shaders/canvas.glsl
@@ -6,8 +6,8 @@
#define mediump
#define highp
#else
-precision mediump float;
-precision mediump int;
+precision highp float;
+precision highp int;
#endif
uniform highp mat4 projection_matrix;
@@ -215,14 +215,42 @@ VERTEX_SHADER_CODE
/* clang-format off */
[fragment]
+#ifndef USE_GLES_OVER_GL
+
+#ifdef GL_EXT_shader_texture_lod
+#extension GL_EXT_shader_texture_lod : enable
+#define texture2DLod(img, coord, lod) texture2DLodEXT(img, coord, lod)
+#define textureCubeLod(img, coord, lod) textureCubeLodEXT(img, coord, lod)
+#endif
+
+#endif
+
+#ifdef GL_ARB_shader_texture_lod
+#extension GL_ARB_shader_texture_lod : enable
+#endif
+
+
+#if !defined(GL_EXT_shader_texture_lod) && !defined(GL_ARB_shader_texture_lod)
+#define texture2DLod(img, coord, lod) texture2D(img, coord, lod)
+#define textureCubeLod(img, coord, lod) textureCube(img, coord, lod)
+#endif
+
+
+
+
#ifdef USE_GLES_OVER_GL
#define lowp
#define mediump
#define highp
#else
+#if defined(USE_HIGHP_PRECISION)
+precision highp float;
+precision highp int;
+#else
precision mediump float;
precision mediump int;
#endif
+#endif
uniform sampler2D color_texture; // texunit:-1
/* clang-format on */
@@ -433,19 +461,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