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.
macos/v1.5.9
Emmanuele Bassi 7 years ago
parent 1489c20770
commit e1ffd32d83
  1. 12
      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
*
* ```
*

Loading…
Cancel
Save