[Cogl] [PATCH] gles2: Use GL_ES instead of __VERSION__ for setting precision

Neil Roberts neil at linux.intel.com
Fri Aug 23 04:39:39 PDT 2013


Mesa has started getting picky about specifying the precision for
floating types in the fragment shader. We already have a default
precision specifier in all the fragment shaders but apparently this
wasn't working because it is only used when the __VERSION__ define is
100 and Mesa is reporting 110. Regardless of whether Mesa is doing the
right thing or not I think it makes sense to use GL_ES instead of
__VERSION__ because we will also need the precision specifier if we
start requesting GLSL 3.0. The GLES specification explictly states
that GL_ES will only be defined for GLES and this is similar to what
the internal meta shaders do in Mesa.

http://cgit.freedesktop.org/mesa/mesa/commit/?id=cabd45773b58d6aa482
---
 cogl/cogl-glsl-shader-boilerplate.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cogl/cogl-glsl-shader-boilerplate.h b/cogl/cogl-glsl-shader-boilerplate.h
index 860854b..99c1dbc 100644
--- a/cogl/cogl-glsl-shader-boilerplate.h
+++ b/cogl/cogl-glsl-shader-boilerplate.h
@@ -52,7 +52,7 @@
   "attribute vec3 cogl_normal_in;\n"
 
 #define _COGL_FRAGMENT_SHADER_BOILERPLATE \
-  "#if __VERSION__ == 100\n" \
+  "#ifdef GL_ES\n" \
   "precision highp float;\n" \
   "#endif\n" \
   _COGL_COMMON_SHADER_BOILERPLATE \
-- 
1.8.3.1



More information about the Cogl mailing list