diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2019-03-11 23:17:54 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2019-03-11 23:18:21 +0100 |
commit | 74e224f2c7aa67fc6fec7901eab869ca6049900f (patch) | |
tree | b18f3339a25d956a10235c2d12d3a8bbc25ec648 | |
parent | 764671d2d089b27dfe03d26919dbc4b41e3b28ba (diff) |
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.
-rw-r--r-- | drivers/gles2/shaders/canvas.glsl | 10 | ||||
-rw-r--r-- | drivers/gles2/shaders/cubemap_filter.glsl | 8 | ||||
-rw-r--r-- | drivers/gles2/shaders/scene.glsl | 9 |
3 files changed, 9 insertions, 18 deletions
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 |