From 74e224f2c7aa67fc6fec7901eab869ca6049900f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Mon, 11 Mar 2019 23:17:54 +0100 Subject: GLES2: Add comments around EXT_shader_texture_lod check To avoid reintroducing bugs as I did in #26928 and #26932. texture2DLodEXT and textureCubeLodEXT are only for the fragment shader with https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_shader_texture_lod.txt In the vertex shader, texture2DLod and textureCubeLod are built-in. --- drivers/gles2/shaders/canvas.glsl | 10 +++------- drivers/gles2/shaders/cubemap_filter.glsl | 8 +++----- drivers/gles2/shaders/scene.glsl | 9 +++------ 3 files changed, 9 insertions(+), 18 deletions(-) (limited to 'drivers/gles2/shaders') diff --git a/drivers/gles2/shaders/canvas.glsl b/drivers/gles2/shaders/canvas.glsl index f72a0d288b..a2c14cd3d2 100644 --- a/drivers/gles2/shaders/canvas.glsl +++ b/drivers/gles2/shaders/canvas.glsl @@ -220,29 +220,25 @@ VERTEX_SHADER_CODE /* clang-format off */ [fragment] +// texture2DLodEXT and textureCubeLodEXT are fragment shader specific. +// Do not copy these defines in the [vertex] section. #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 #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..19fd62253f 100644 --- a/drivers/gles2/shaders/cubemap_filter.glsl +++ b/drivers/gles2/shaders/cubemap_filter.glsl @@ -25,15 +25,15 @@ void main() { /* clang-format off */ [fragment] +// texture2DLodEXT and textureCubeLodEXT are fragment shader specific. +// Do not copy these defines in the [vertex] section. #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 +44,6 @@ void main() { #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/scene.glsl b/drivers/gles2/shaders/scene.glsl index 3b0bca982d..4a1e2a65e3 100644 --- a/drivers/gles2/shaders/scene.glsl +++ b/drivers/gles2/shaders/scene.glsl @@ -675,15 +675,15 @@ VERTEX_SHADER_CODE /* clang-format off */ [fragment] +// texture2DLodEXT and textureCubeLodEXT are fragment shader specific. +// Do not copy these defines in the [vertex] section. #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 +694,6 @@ VERTEX_SHADER_CODE #define textureCubeLod(img, coord, lod) textureCube(img, coord, lod) #endif - - - #ifdef USE_GLES_OVER_GL #define lowp #define mediump -- cgit v1.2.3