diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2019-03-11 19:31:05 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2019-03-11 19:34:31 +0100 |
commit | f5f565e3e49eecde9ed3b05913747a50d54b7357 (patch) | |
tree | 2dbd7ce698d8d3bd64652df1336050c44e8c7af0 /drivers/gles2/shaders | |
parent | 292c037f9b1577f0d195824be149d8cea7d0d2fc (diff) |
GLES2: Ensure extension checks for texture2DLod
In canvas.glsl and scene.glsl, we were using texel2DFetch from stdlib.glsl,
which uses texture2DLod. In both cases, the stdlib.glsl include came before
the define of texture2DLod.
Might fix issues for drivers that don't support GL_EXT_shader_texture_lod.
Diffstat (limited to 'drivers/gles2/shaders')
-rw-r--r-- | drivers/gles2/shaders/canvas.glsl | 23 | ||||
-rw-r--r-- | drivers/gles2/shaders/cubemap_filter.glsl | 9 | ||||
-rw-r--r-- | drivers/gles2/shaders/scene.glsl | 10 | ||||
-rw-r--r-- | drivers/gles2/shaders/stdlib.glsl | 16 |
4 files changed, 20 insertions, 38 deletions
diff --git a/drivers/gles2/shaders/canvas.glsl b/drivers/gles2/shaders/canvas.glsl index f72a0d288b..2d9761bf49 100644 --- a/drivers/gles2/shaders/canvas.glsl +++ b/drivers/gles2/shaders/canvas.glsl @@ -220,29 +220,6 @@ 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 diff --git a/drivers/gles2/shaders/cubemap_filter.glsl b/drivers/gles2/shaders/cubemap_filter.glsl index a6902836ed..128da15b39 100644 --- a/drivers/gles2/shaders/cubemap_filter.glsl +++ b/drivers/gles2/shaders/cubemap_filter.glsl @@ -26,14 +26,12 @@ void main() { [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 +#endif // !USE_GLES_OVER_GL #ifdef GL_ARB_shader_texture_lod #extension GL_ARB_shader_texture_lod : enable @@ -44,8 +42,6 @@ void main() { #define textureCubeLod(img, coord, lod) textureCube(img, coord, lod) #endif - - #ifdef USE_GLES_OVER_GL #define lowp #define mediump @@ -58,8 +54,7 @@ precision highp int; precision mediump float; precision mediump int; #endif - -#endif +#endif // USE_GLES_OVER_GL #ifdef USE_SOURCE_PANORAMA uniform sampler2D source_panorama; //texunit:0 diff --git a/drivers/gles2/shaders/scene.glsl b/drivers/gles2/shaders/scene.glsl index 3b0bca982d..9c235854a3 100644 --- a/drivers/gles2/shaders/scene.glsl +++ b/drivers/gles2/shaders/scene.glsl @@ -16,7 +16,6 @@ precision highp int; #define M_PI 3.14159265359 - // // attributes // @@ -676,14 +675,12 @@ VERTEX_SHADER_CODE [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 +#endif // !USE_GLES_OVER_GL #ifdef GL_ARB_shader_texture_lod #extension GL_ARB_shader_texture_lod : enable @@ -694,9 +691,6 @@ VERTEX_SHADER_CODE #define textureCubeLod(img, coord, lod) textureCube(img, coord, lod) #endif - - - #ifdef USE_GLES_OVER_GL #define lowp #define mediump @@ -709,7 +703,7 @@ precision highp int; precision mediump float; precision mediump int; #endif -#endif +#endif // USE_GLES_OVER_GL #include "stdlib.glsl" diff --git a/drivers/gles2/shaders/stdlib.glsl b/drivers/gles2/shaders/stdlib.glsl index 3674d70c9f..3cc65bc509 100644 --- a/drivers/gles2/shaders/stdlib.glsl +++ b/drivers/gles2/shaders/stdlib.glsl @@ -1,3 +1,19 @@ +#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 // !USE_GLES_OVER_GL + +#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 vec2 select2(vec2 a, vec2 b, bvec2 c) { vec2 ret; |