summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2014-04-01 21:15:42 -0700
committerKeith Packard <keithp@keithp.com>2014-04-03 13:07:51 -0700
commit5b76b3978d792c92b23a691204b473209782476e (patch)
tree733e4c5ad6bebc5f67b630f5c2647fbc763483e1
parent3c2c59eed3c68c0e5a93c38cf01eedad015e3157 (diff)
glamor: Compute supported GLSL version and save in screen private
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 <keithp@keithp.com> Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Eric Anholt <eric@anholt.net>
-rw-r--r--glamor/glamor.c9
-rw-r--r--glamor/glamor_priv.h1
-rw-r--r--glamor/glamor_program.c12
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);