check the glsl version during init

This adds a check for the glsl version during driver init which gets
stored in ctx->glsl_major and ctx->glsl_minor.

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit 9bde48bda6d602dd536c3536d56d2ff7545802c3)
This commit is contained in:
Robert Bragg 2012-09-26 22:01:38 +01:00
parent 2438d70b38
commit 258aba3836
3 changed files with 16 additions and 0 deletions

View File

@ -75,6 +75,9 @@ struct _CoglContext
const CoglDriverVtable *driver_vtable;
const CoglTextureDriver *texture_driver;
int glsl_major;
int glsl_minor;
/* Features cache */
unsigned long features[COGL_FLAGS_N_LONGS_FOR_SIZE (_COGL_N_FEATURE_IDS)];
CoglFeatureFlags feature_flags; /* legacy/deprecated feature flags */

View File

@ -375,6 +375,16 @@ _cogl_driver_update_features (CoglContext *ctx,
_cogl_gpu_info_init (ctx, &ctx->gpu);
ctx->glsl_major = 1;
ctx->glsl_minor = 1;
if (COGL_CHECK_GL_VERSION (gl_major, gl_minor, 2, 0))
{
const char *glsl_version =
(char *)ctx->glGetString (GL_SHADING_LANGUAGE_VERSION);
parse_gl_version (glsl_version, &ctx->glsl_major, &ctx->glsl_minor);
}
flags = (COGL_FEATURE_TEXTURE_READ_PIXELS
| COGL_FEATURE_UNSIGNED_INT_INDICES
| COGL_FEATURE_DEPTH_RANGE);

View File

@ -216,6 +216,9 @@ _cogl_driver_update_features (CoglContext *context,
_cogl_gpu_info_init (context, &context->gpu);
context->glsl_major = 1;
context->glsl_minor = 0;
gl_extensions = _cogl_context_get_gl_extensions (context);
_cogl_feature_check_ext_functions (context,