From 5b76b3978d792c92b23a691204b473209782476e Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 1 Apr 2014 21:15:42 -0700 Subject: glamor: Compute supported GLSL version and save in screen private MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This currently computes the GLSL version in a fairly naïve fashion, and leaves that in the screen private for other users. This will let us update the version computation in one place later on. v2: Drop an accidental rebase-squashed hunk (change by anholt). Signed-off-by: Keith Packard Signed-off-by: Eric Anholt Reviewed-by: Eric Anholt --- glamor/glamor.c | 9 +++++++++ glamor/glamor_priv.h | 1 + glamor/glamor_program.c | 12 ++---------- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/glamor/glamor.c b/glamor/glamor.c index a7d981cd8..d7192c1aa 100644 --- a/glamor/glamor.c +++ b/glamor/glamor.c @@ -353,6 +353,15 @@ glamor_init(ScreenPtr screen, unsigned int flags) gl_version = epoxy_gl_version(); + /* Would be nice to have a cleaner test for GLSL 1.30 support, + * but for now this should suffice + */ + if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP && gl_version >= 30) + glamor_priv->glsl_version = 130; + else + glamor_priv->glsl_version = 120; + + /* We'd like to require GL_ARB_map_buffer_range or * GL_OES_map_buffer_range, since it offers more information to * the driver than plain old glMapBuffer() or glBufferSubData(). diff --git a/glamor/glamor_priv.h b/glamor/glamor_priv.h index 4c305abfc..36f9b7108 100644 --- a/glamor/glamor_priv.h +++ b/glamor/glamor_priv.h @@ -205,6 +205,7 @@ typedef struct glamor_screen_private { Bool yInverted; unsigned int tick; enum glamor_gl_flavor gl_flavor; + int glsl_version; int has_pack_invert; int has_fbo_blit; int has_map_buffer_range; diff --git a/glamor/glamor_program.c b/glamor/glamor_program.c index e2e1434ee..5996ed9a8 100644 --- a/glamor/glamor_program.c +++ b/glamor/glamor_program.c @@ -240,16 +240,8 @@ glamor_build_program(ScreenPtr screen, flags |= fill->flags; version = MAX(version, fill->version); - if (version >= 130) { - - /* Would be nice to have a cleaner test for GLSL 1.30 support, - * but for now this should suffice - */ - if (glamor_priv->gl_flavor != GLAMOR_GL_DESKTOP || - epoxy_gl_version() < 30) { - goto fail; - } - } + if (version > glamor_priv->glsl_version) + goto fail; vs_vars = vs_location_vars(locations); fs_vars = fs_location_vars(locations); -- cgit v1.2.3