From 57416bfbce17905e71d143478a796dc6b27ba4f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Fri, 21 Dec 2018 15:14:55 +0100 Subject: GLES2: Define 'lowp' for OpenGL 2.1 Precision qualifiers are only used on OpenGL ES 2.0 and 3.0, and while OpenGL 3.3 defines them for compatibility (but without practical effect), they're missing from OpenGL 2.1, so we define them to prevent compilation errors. Fixes #24521. --- drivers/gles2/shaders/canvas.glsl | 8 ++------ drivers/gles2/shaders/canvas_shadow.glsl | 3 ++- drivers/gles2/shaders/copy.glsl | 2 ++ drivers/gles2/shaders/cube_to_dp.glsl | 2 ++ drivers/gles2/shaders/cubemap_filter.glsl | 2 ++ drivers/gles2/shaders/lens_distorted.glsl | 2 ++ drivers/gles2/shaders/scene.glsl | 2 ++ 7 files changed, 14 insertions(+), 7 deletions(-) diff --git a/drivers/gles2/shaders/canvas.glsl b/drivers/gles2/shaders/canvas.glsl index 01a90d0725..614124e6d9 100644 --- a/drivers/gles2/shaders/canvas.glsl +++ b/drivers/gles2/shaders/canvas.glsl @@ -2,6 +2,7 @@ [vertex] #ifdef USE_GLES_OVER_GL +#define lowp #define mediump #define highp #else @@ -31,8 +32,6 @@ uniform vec4 src_rect; uniform highp float time; - - #ifdef USE_LIGHTING // light matrices @@ -62,7 +61,6 @@ const bool at_light_pass = true; const bool at_light_pass = false; #endif - /* clang-format off */ VERTEX_SHADER_GLOBALS @@ -80,7 +78,6 @@ vec2 select(vec2 a, vec2 b, bvec2 c) { void main() { - vec4 color = color_attrib; #ifdef USE_INSTANCING @@ -159,13 +156,13 @@ VERTEX_SHADER_CODE #endif #endif - } /* clang-format off */ [fragment] #ifdef USE_GLES_OVER_GL +#define lowp #define mediump #define highp #else @@ -231,7 +228,6 @@ const bool at_light_pass = false; uniform bool use_default_normal; - /* clang-format off */ FRAGMENT_SHADER_GLOBALS diff --git a/drivers/gles2/shaders/canvas_shadow.glsl b/drivers/gles2/shaders/canvas_shadow.glsl index 51af004e39..d39212826e 100644 --- a/drivers/gles2/shaders/canvas_shadow.glsl +++ b/drivers/gles2/shaders/canvas_shadow.glsl @@ -2,6 +2,7 @@ [vertex] #ifdef USE_GLES_OVER_GL +#define lowp #define mediump #define highp #else @@ -29,6 +30,7 @@ void main() { [fragment] #ifdef USE_GLES_OVER_GL +#define lowp #define mediump #define highp #else @@ -39,7 +41,6 @@ precision mediump int; varying highp vec4 position_interp; /* clang-format on */ - void main() { highp float depth = ((position_interp.z / position_interp.w) + 1.0) * 0.5 + 0.0; // bias diff --git a/drivers/gles2/shaders/copy.glsl b/drivers/gles2/shaders/copy.glsl index 97a24212a5..f3c2a7eec4 100644 --- a/drivers/gles2/shaders/copy.glsl +++ b/drivers/gles2/shaders/copy.glsl @@ -2,6 +2,7 @@ [vertex] #ifdef USE_GLES_OVER_GL +#define lowp #define mediump #define highp #else @@ -56,6 +57,7 @@ void main() { #define M_PI 3.14159265359 #ifdef USE_GLES_OVER_GL +#define lowp #define mediump #define highp #else diff --git a/drivers/gles2/shaders/cube_to_dp.glsl b/drivers/gles2/shaders/cube_to_dp.glsl index 3d24c36336..cb4b3f6dec 100644 --- a/drivers/gles2/shaders/cube_to_dp.glsl +++ b/drivers/gles2/shaders/cube_to_dp.glsl @@ -2,6 +2,7 @@ [vertex] #ifdef USE_GLES_OVER_GL +#define lowp #define mediump #define highp #else @@ -25,6 +26,7 @@ void main() { [fragment] #ifdef USE_GLES_OVER_GL +#define lowp #define mediump #define highp #else diff --git a/drivers/gles2/shaders/cubemap_filter.glsl b/drivers/gles2/shaders/cubemap_filter.glsl index b1553c7cd5..06274a7698 100644 --- a/drivers/gles2/shaders/cubemap_filter.glsl +++ b/drivers/gles2/shaders/cubemap_filter.glsl @@ -2,6 +2,7 @@ [vertex] #ifdef USE_GLES_OVER_GL +#define lowp #define mediump #define highp #else @@ -32,6 +33,7 @@ void main() { #endif #ifdef USE_GLES_OVER_GL +#define lowp #define mediump #define highp #else diff --git a/drivers/gles2/shaders/lens_distorted.glsl b/drivers/gles2/shaders/lens_distorted.glsl index efa35adf7d..81898a75a5 100644 --- a/drivers/gles2/shaders/lens_distorted.glsl +++ b/drivers/gles2/shaders/lens_distorted.glsl @@ -2,6 +2,7 @@ [vertex] #ifdef USE_GLES_OVER_GL +#define lowp #define mediump #define highp #else @@ -29,6 +30,7 @@ void main() { [fragment] #ifdef USE_GLES_OVER_GL +#define lowp #define mediump #define highp #else diff --git a/drivers/gles2/shaders/scene.glsl b/drivers/gles2/shaders/scene.glsl index 32721c892b..4f334d2be2 100644 --- a/drivers/gles2/shaders/scene.glsl +++ b/drivers/gles2/shaders/scene.glsl @@ -2,6 +2,7 @@ [vertex] #ifdef USE_GLES_OVER_GL +#define lowp #define mediump #define highp #else @@ -653,6 +654,7 @@ VERTEX_SHADER_CODE #endif #ifdef USE_GLES_OVER_GL +#define lowp #define mediump #define highp #else -- cgit v1.2.3