mirror of
https://github.com/brl/mutter.git
synced 2024-11-12 17:27:03 -05:00
driver-gl: split out parse_gl_version function
This splits out the GL version parser code from cogl-driver-gl.c:_cogl_get_gl_version() so it can also be used for parsing other gl version strings. Reviewed-by: Neil Roberts <neil@linux.intel.com> (cherry picked from commit 66c2e74b9d61669fb5b93cf9a31cc8659a601fdd)
This commit is contained in:
parent
2bcf38d126
commit
2438d70b38
@ -243,17 +243,13 @@ _cogl_driver_pixel_format_to_gl (CoglContext *context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
_cogl_get_gl_version (CoglContext *ctx,
|
parse_gl_version (const char *version_string,
|
||||||
int *major_out,
|
int *major_out,
|
||||||
int *minor_out)
|
int *minor_out)
|
||||||
{
|
{
|
||||||
const char *version_string, *major_end, *minor_end;
|
const char *major_end, *minor_end;
|
||||||
int major = 0, minor = 0;
|
int major = 0, minor = 0;
|
||||||
|
|
||||||
/* Get the OpenGL version number */
|
|
||||||
if ((version_string = _cogl_context_get_gl_version (ctx)) == NULL)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
/* Extract the major number */
|
/* Extract the major number */
|
||||||
for (major_end = version_string; *major_end >= '0'
|
for (major_end = version_string; *major_end >= '0'
|
||||||
&& *major_end <= '9'; major_end++)
|
&& *major_end <= '9'; major_end++)
|
||||||
@ -279,6 +275,20 @@ _cogl_get_gl_version (CoglContext *ctx,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static CoglBool
|
||||||
|
_cogl_get_gl_version (CoglContext *ctx,
|
||||||
|
int *major_out,
|
||||||
|
int *minor_out)
|
||||||
|
{
|
||||||
|
const char *version_string;
|
||||||
|
|
||||||
|
/* Get the OpenGL version number */
|
||||||
|
if ((version_string = _cogl_context_get_gl_version (ctx)) == NULL)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
return parse_gl_version (version_string, major_out, minor_out);
|
||||||
|
}
|
||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
check_gl_version (CoglContext *ctx,
|
check_gl_version (CoglContext *ctx,
|
||||||
CoglError **error)
|
CoglError **error)
|
||||||
|
Loading…
Reference in New Issue
Block a user