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>
This commit is contained in:
Keith Packard 2014-04-01 21:15:42 -07:00
parent 3c2c59eed3
commit 5b76b3978d
3 changed files with 12 additions and 10 deletions

View File

@ -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().

View File

@ -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;

View File

@ -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);