[Mesa-dev] [PATCH 25/35] meta: Improve GLSL version check

Ian Romanick idr at freedesktop.org
Wed Jan 29 13:53:16 PST 2014


From: Ian Romanick <ian.d.romanick at intel.com>

We want to use the GLSL 1.30-ish path for OpenGL ES 3.0.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 src/mesa/drivers/common/meta.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index e7154df..380ee32 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -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"
-- 
1.8.1.4



More information about the mesa-dev mailing list