[Mesa-dev] [PATCH] es2tri: Define precision in fragment shader

Shuang He shuang.he at intel.com
Mon Jul 9 00:54:45 PDT 2012


According to GLSL ES spec, section 4.5.2:
"If the precision cannot be determined by this method e.g. if an entire expression is composed only of
operands with no precision qualifier, and the result is not assigned or passed as an argument, then it
 is evaluated at the default precision of the type or greater. When this occurs in the fragment shader,
the default precision must be defined."
---
 src/egl/opengles2/es2tri.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/egl/opengles2/es2tri.c b/src/egl/opengles2/es2tri.c
index 6dcc1b8..349a576 100644
--- a/src/egl/opengles2/es2tri.c
+++ b/src/egl/opengles2/es2tri.c
@@ -139,6 +139,7 @@ static void
 create_shaders(void)
 {
    static const char *fragShaderText =
+      "precision mediump float;\n"
       "varying vec4 v_color;\n"
       "void main() {\n"
       "   gl_FragColor = v_color;\n"
-- 
1.7.7



More information about the mesa-dev mailing list