glGetStringi() is not available before 3.0. We can't trust its function pointer being NULL since the GL implementation is allowed to return anything in this case (*cough* macOS's GL on Metal *cough*).
This probably regressed when fd92954df8cf12c61e08c7ef7acf172efb7c44ad removed the "if (!disabled[0]) return FALSE;" exit from filter_extensions(), although that simply exposed an existing issue.
From: Matteo Bruni mbruni@codeweavers.com
glGetStringi() is not available before 3.0. We can't trust its function pointer being NULL since the GL implementation is allowed to return anything in this case (*cough* macOS's GL on Metal *cough*).
This probably regressed when fd92954df8cf12c61e08c7ef7acf172efb7c44ad removed the "if (!disabled[0]) return FALSE;" exit from filter_extensions(), although that simply exposed an existing issue. --- dlls/opengl32/unix_wgl.c | 45 ++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 20 deletions(-)
diff --git a/dlls/opengl32/unix_wgl.c b/dlls/opengl32/unix_wgl.c index 5da69196548..1571ce3004b 100644 --- a/dlls/opengl32/unix_wgl.c +++ b/dlls/opengl32/unix_wgl.c @@ -198,13 +198,31 @@ static GLubyte *filter_extensions_list( const char *extensions, const char *disa return (GLubyte *)str; }
+static const char *parse_gl_version( const char *gl_version, int *major, int *minor ) +{ + const char *ptr = gl_version; + + *major = atoi( ptr ); + if (*major <= 0) + ERR( "Invalid OpenGL major version %d.\n", *major ); + + while (isdigit( *ptr )) ++ptr; + if (*ptr++ != '.') + ERR( "Invalid OpenGL version string %s.\n", debugstr_a(gl_version) ); + + *minor = atoi( ptr ); + + while (isdigit( *ptr )) ++ptr; + return ptr; +} + static GLuint *filter_extensions_index( TEB *teb, const char *disabled ) { const struct opengl_funcs *funcs = teb->glTable; + unsigned int i = 0, j, major, minor; + const char *ext, *version; GLuint *disabled_index; GLint extensions_count; - unsigned int i = 0, j; - const char *ext;
if (!funcs->ext.p_glGetStringi) { @@ -213,6 +231,11 @@ static GLuint *filter_extensions_index( TEB *teb, const char *disabled ) if (!funcs->ext.p_glGetStringi) return NULL; }
+ version = funcs->gl.p_glGetString( GL_VERSION ); + parse_gl_version( version, &major, &minor ); + if (major < 3) + return NULL; + funcs->gl.p_glGetIntegerv( GL_NUM_EXTENSIONS, &extensions_count ); disabled_index = malloc( extensions_count * sizeof(*disabled_index) ); if (!disabled_index) return NULL; @@ -413,24 +436,6 @@ static BOOL check_extension_support( TEB *teb, const char *extension, const char return FALSE; }
-static const char *parse_gl_version( const char *gl_version, int *major, int *minor ) -{ - const char *ptr = gl_version; - - *major = atoi( ptr ); - if (*major <= 0) - ERR( "Invalid OpenGL major version %d.\n", *major ); - - while (isdigit( *ptr )) ++ptr; - if (*ptr++ != '.') - ERR( "Invalid OpenGL version string %s.\n", debugstr_a(gl_version) ); - - *minor = atoi( ptr ); - - while (isdigit( *ptr )) ++ptr; - return ptr; -} - static void wrap_glGetIntegerv( TEB *teb, GLenum pname, GLint *data ) { const struct opengl_funcs *funcs = teb->glTable;