OSDN Git Service

meta: Improve GLSL version check
authorIan Romanick <ian.d.romanick@intel.com>
Mon, 16 Dec 2013 21:10:11 +0000 (13:10 -0800)
committerEric Anholt <eric@anholt.net>
Wed, 12 Feb 2014 00:00:12 +0000 (16:00 -0800)
We want to use the GLSL 1.30-ish path for OpenGL ES 3.0.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
src/mesa/drivers/common/meta.c

index 40e1f37..a40bf08 100644 (file)
@@ -461,7 +461,12 @@ setup_shader_for_sampler(struct gl_context *ctx, struct glsl_sampler *sampler)
    if (sampler->shader_prog != 0)
       return sampler->shader_prog;
 
-   if (ctx->API == API_OPENGLES2 || ctx->Const.GLSLVersion < 130) {
+   /* The version check is a little tricky.  API is set to API_OPENGLES2 even
+    * for OpenGL ES 3.0 contexts, and GLSLVersion may be set to 140, for
+    * example, in an OpenGL ES 2.0 context.
+    */
+   if ((ctx->API == API_OPENGLES2 && ctx->Version < 30)
+       || ctx->Const.GLSLVersion < 130) {
       vs_source =
          "attribute vec2 position;\n"
          "attribute vec3 textureCoords;\n"