From e1ffd32d83d87c2bd90812f20344f253139d5c1b Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Sat, 24 Feb 2018 14:03:06 +0000 Subject: Support encoding minor versions bigger than 10 The GL version minor numbers haven't hit 10, yet, but if they do we're going to get non-sensical encoded versions when calling epoxy_gl_version(), like we're getting right now, with the GLSL version numbers. If the minor number is larger than the multiplication factor used for the major number, we should bump up the factor to the next order of magnitude. --- src/dispatch_common.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/dispatch_common.c b/src/dispatch_common.c index d8baeee..72cda4c 100644 --- a/src/dispatch_common.c +++ b/src/dispatch_common.c @@ -395,7 +395,7 @@ static int epoxy_internal_gl_version(GLenum version_string, int error_version) { const char *version = (const char *)glGetString(version_string); - GLint major, minor; + GLint major, minor, factor; int scanf_count; if (!version) @@ -412,7 +412,13 @@ epoxy_internal_gl_version(GLenum version_string, int error_version) version); exit(1); } - return 10 * major + minor; + + if (minor >= 10) + factor = 100; + else + factor = 10; + + return factor * major + minor; } /** @@ -452,7 +458,7 @@ epoxy_conservative_gl_version(void) * * ``` * - * version = major * 10 + minor + * version = major * 100 + minor * * ``` * -- cgit v1.2.1