From b32298a660f95abd94b7dc9e7ea68bd38150d149 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Thu, 24 Jan 2019 18:58:42 -0300 Subject: Ensure WebGL uses highp by default, and fix some wrong mediump usages. Fixes #22962. --- drivers/gles2/shaders/canvas.glsl | 9 +++++++-- drivers/gles2/shaders/copy.glsl | 9 +++++++-- drivers/gles2/shaders/cubemap_filter.glsl | 10 ++++++++-- drivers/gles2/shaders/scene.glsl | 7 ++++++- 4 files changed, 28 insertions(+), 7 deletions(-) (limited to 'drivers/gles2/shaders') diff --git a/drivers/gles2/shaders/canvas.glsl b/drivers/gles2/shaders/canvas.glsl index bc734a6597..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; @@ -243,9 +243,14 @@ VERTEX_SHADER_CODE #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 */ diff --git a/drivers/gles2/shaders/copy.glsl b/drivers/gles2/shaders/copy.glsl index 286ba6b8c0..931b3f3708 100644 --- a/drivers/gles2/shaders/copy.glsl +++ b/drivers/gles2/shaders/copy.glsl @@ -6,8 +6,8 @@ #define mediump #define highp #else -precision mediump float; -precision mediump int; +precision highp float; +precision highp int; #endif attribute highp vec4 vertex_attrib; // attrib:0 @@ -61,9 +61,14 @@ void main() { #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 #if defined(USE_CUBEMAP) || defined(USE_PANORAMA) varying vec3 cube_interp; diff --git a/drivers/gles2/shaders/cubemap_filter.glsl b/drivers/gles2/shaders/cubemap_filter.glsl index 558c83960e..7643297a14 100644 --- a/drivers/gles2/shaders/cubemap_filter.glsl +++ b/drivers/gles2/shaders/cubemap_filter.glsl @@ -6,8 +6,8 @@ #define mediump #define highp #else -precision mediump float; -precision mediump int; +precision highp float; +precision highp int; #endif attribute highp vec2 vertex; // attrib:0 @@ -51,10 +51,16 @@ void main() { #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 + #ifdef USE_SOURCE_PANORAMA uniform sampler2D source_panorama; //texunit:0 #else diff --git a/drivers/gles2/shaders/scene.glsl b/drivers/gles2/shaders/scene.glsl index 6aa91df20f..c7f5c97133 100644 --- a/drivers/gles2/shaders/scene.glsl +++ b/drivers/gles2/shaders/scene.glsl @@ -683,8 +683,13 @@ VERTEX_SHADER_CODE #define mediump #define highp #else -precision mediump float; +#if defined(USE_HIGHP_PRECISION) +precision highp float; precision highp int; +#else +precision mediump float; +precision mediump int; +#endif #endif #include "stdlib.glsl" -- cgit v1.2.3