From: Jacek Caban jacek@codeweavers.com
--- dlls/opengl32/unix_wgl.c | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-)
diff --git a/dlls/opengl32/unix_wgl.c b/dlls/opengl32/unix_wgl.c index 343863d0c72..b610d376e7b 100644 --- a/dlls/opengl32/unix_wgl.c +++ b/dlls/opengl32/unix_wgl.c @@ -139,7 +139,7 @@ struct context UINT64 debug_user; /* client pointer */ GLubyte *extensions; /* extension string */ GLuint *disabled_exts; /* indices of disabled extensions */ - GLubyte *wow64_version; /* wow64 GL version override */ + char *wow64_version; /* wow64 GL version override */ struct buffers *buffers; /* wow64 buffers map */ GLenum gl_error; /* wrapped GL error */
@@ -836,12 +836,12 @@ static BOOL check_extension_support( struct context *ctx, const char *extension, static void sync_context_version( TEB *teb, struct context *ctx ) { const struct opengl_funcs *funcs = teb->glTable; - const char *version; + const char *version, *rest = "";
if (ctx->major_version) return; /* already synced */
version = (const char *)funcs->p_glGetString( GL_VERSION ); - if (version) parse_gl_version( version, &ctx->major_version, &ctx->minor_version ); + if (version) rest = parse_gl_version( version, &ctx->major_version, &ctx->minor_version ); if (!ctx->major_version) ctx->major_version = 1; TRACE( "context %p version %d.%d\n", ctx, ctx->major_version, ctx->minor_version );
@@ -852,6 +852,7 @@ static void sync_context_version( TEB *teb, struct context *ctx ) FIXME( "GL version %d.%d is not supported on wow64, using 4.3\n ", ctx->major_version, ctx->minor_version ); ctx->major_version = 4; ctx->minor_version = 3; + asprintf( &ctx->wow64_version, "4.3%s", rest ); } } } @@ -945,21 +946,11 @@ const GLubyte *wrap_glGetString( TEB *teb, GLenum name ) GLuint **disabled = &ctx->disabled_exts; if (*extensions || filter_extensions( teb, (const char *)ret, extensions, disabled )) return *extensions; } - else if (name == GL_VERSION && is_win64 && is_wow64()) + else if (name == GL_VERSION) { struct context *ctx = get_current_context( teb, NULL, NULL ); - GLubyte **str = &ctx->wow64_version; - int major, minor; - - if (!*str) - { - const char *rest = parse_gl_version( (const char *)ret, &major, &minor ); - /* 4.4 depends on ARB_buffer_storage, which we don't support on wow64. */ - if (major > 4 || (major == 4 && minor >= 4)) asprintf( (char **)str, "4.3%s", rest ); - else *str = (GLubyte *)strdup( (char *)ret ); - } - - return *str; + sync_context_version( teb, ctx ); + if (ctx->wow64_version) return (const GLubyte *)ctx->wow64_version; } }