From: Rémi Bernon <rbernon@codeweavers.com> --- dlls/opengl32/make_opengl | 1 + dlls/opengl32/thunks.c | 8 -------- dlls/opengl32/unix_wgl.c | 33 +++++++++++++-------------------- dlls/opengl32/wgl.c | 23 +++++++++++++++++++++++ include/wine/opengl_driver.h | 2 ++ 5 files changed, 39 insertions(+), 28 deletions(-) diff --git a/dlls/opengl32/make_opengl b/dlls/opengl32/make_opengl index a78ccce005b..dbdfb3ecbf7 100755 --- a/dlls/opengl32/make_opengl +++ b/dlls/opengl32/make_opengl @@ -173,6 +173,7 @@ my %manual_win_thunks = "glCreateSyncFromCLeventARB" => 1, "glDeleteSync" => 1, "glFenceSync" => 1, + "glGetIntegerv" => 1, "glGetString" => 1, "glGetStringi" => 1, "glImportSyncEXT" => 1, diff --git a/dlls/opengl32/thunks.c b/dlls/opengl32/thunks.c index 3c60ec5d6bb..c3696f3406b 100644 --- a/dlls/opengl32/thunks.c +++ b/dlls/opengl32/thunks.c @@ -882,14 +882,6 @@ void WINAPI glGetFloatv( GLenum pname, GLfloat *data ) if ((status = UNIX_CALL( glGetFloatv, &args ))) WARN( "glGetFloatv returned %#lx\n", status ); } -void WINAPI glGetIntegerv( GLenum pname, GLint *data ) -{ - struct glGetIntegerv_params args = { .teb = NtCurrentTeb(), .pname = pname, .data = data }; - NTSTATUS status; - TRACE( "pname %d, data %p\n", pname, data ); - if ((status = UNIX_CALL( glGetIntegerv, &args ))) WARN( "glGetIntegerv returned %#lx\n", status ); -} - void WINAPI glGetLightfv( GLenum light, GLenum pname, GLfloat *params ) { struct glGetLightfv_params args = { .teb = NtCurrentTeb(), .light = light, .pname = pname, .params = params }; diff --git a/dlls/opengl32/unix_wgl.c b/dlls/opengl32/unix_wgl.c index af088daf2cf..3958cec1ba4 100644 --- a/dlls/opengl32/unix_wgl.c +++ b/dlls/opengl32/unix_wgl.c @@ -126,8 +126,6 @@ struct context HGLRC share; /* context to be shared with */ int *attribs; /* creation attributes */ DWORD tid; /* thread that the context is current in */ - int major_version; /* major GL version */ - int minor_version; /* minor GL version */ UINT64 debug_callback; /* client pointer */ UINT64 debug_user; /* client pointer */ GLubyte *extensions; /* extension string */ @@ -713,6 +711,7 @@ static GLubyte *filter_extensions( struct context *ctx, const char *extensions, /* Check if any GL extension from the list is supported */ static BOOL is_any_extension_supported( struct context *ctx, const char *extension ) { + struct opengl_client_context *client = opengl_client_context_from_client( ctx->base.client_context ); size_t len; /* We use the GetProcAddress function from the display driver to retrieve function pointers @@ -739,10 +738,10 @@ static BOOL is_any_extension_supported( struct context *ctx, const char *extensi /* Compare the major/minor version numbers of the native OpenGL library and what is required by the function. * The gl_version string is guaranteed to have at least a major/minor and sometimes it has a release number as well. */ - if (ctx->major_version > major || (ctx->major_version == major && ctx->minor_version >= minor)) return TRUE; + if (client->major_version > major || (client->major_version == major && client->minor_version >= minor)) return TRUE; WARN( "The function requires OpenGL version '%d.%d' while your drivers only provide '%d.%d'\n", - major, minor, ctx->major_version, ctx->minor_version ); + major, minor, client->major_version, client->minor_version ); } extension += len + 1; @@ -810,12 +809,6 @@ static BOOL get_integer( TEB *teb, GLenum pname, GLint *data ) switch (pname) { - case GL_MAJOR_VERSION: - *data = ctx->major_version; - return TRUE; - case GL_MINOR_VERSION: - *data = ctx->minor_version; - return TRUE; case GL_NUM_EXTENSIONS: *data = ctx->extension_count; return TRUE; @@ -1256,16 +1249,16 @@ static void make_context_current( TEB *teb, const struct opengl_funcs *funcs, HD pthread_once( &once, init_enabled_extensions ); - if (ctx->major_version) return; /* already synced */ + if (client->major_version) return; /* already synced */ version = (const char *)funcs->p_glGetString( GL_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 ); + if (version) rest = parse_gl_version( version, &client->major_version, &client->minor_version ); + if (!client->major_version) client->major_version = 1; + TRACE( "context %p version %d.%d\n", ctx, client->major_version, client->minor_version ); funcs->p_init_extensions( ctx->base.extensions ); - if (ctx->major_version >= 3) + if (client->major_version >= 3) { funcs->p_glGetIntegerv( GL_NUM_EXTENSIONS, &num ); for (GLint i = 0; i < num; i++) @@ -1293,7 +1286,7 @@ static void make_context_current( TEB *teb, const struct opengl_funcs *funcs, HD if (funcs->p_glImportMemoryWin32HandleEXT) size++; if (funcs->p_glImportSemaphoreWin32HandleEXT) size++; - if (ctx->major_version >= 3) + if (client->major_version >= 3) { GLint extensions_count; funcs->p_glGetIntegerv( GL_NUM_EXTENSIONS, &extensions_count ); @@ -1361,11 +1354,11 @@ static void make_context_current( TEB *teb, const struct opengl_funcs *funcs, HD if (is_win64 && ctx->buffers && !initialize_vk_device( teb, ctx ) && !(ctx->use_pinned_memory = ctx->base.extensions[GL_AMD_pinned_memory])) { - if (ctx->major_version > 4 || (ctx->major_version == 4 && ctx->minor_version > 3)) + if (client->major_version > 4 || (client->major_version == 4 && client->minor_version > 3)) { - 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; + FIXME( "GL version %d.%d is not supported on wow64, using 4.3\n", client->major_version, client->minor_version ); + client->major_version = 4; + client->minor_version = 3; asprintf( &ctx->wow64_version, "4.3%s", rest ); } for (i = 0, j = 0; i < count; i++) diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c index e8fb929f127..d781eedfbfa 100644 --- a/dlls/opengl32/wgl.c +++ b/dlls/opengl32/wgl.c @@ -1992,6 +1992,29 @@ GLsync WINAPI glImportSyncEXT( GLenum external_sync_type, GLintptr external_sync return NULL; } +void WINAPI glGetIntegerv( GLenum name, GLint *data ) +{ + struct glGetIntegerv_params args = { .teb = NtCurrentTeb(), .pname = name, .data = data }; + struct context *ctx; + NTSTATUS status; + + TRACE( "name %d, data %p\n", name, data ); + + if (!(ctx = context_from_handle( NtCurrentTeb()->glCurrentRC ))) return; + + switch (name) + { + case GL_MAJOR_VERSION: + *data = ctx->base.major_version; + return; + case GL_MINOR_VERSION: + *data = ctx->base.minor_version; + return; + } + + if ((status = UNIX_CALL( glGetIntegerv, &args ))) WARN( "glGetIntegerv returned %#lx\n", status ); +} + const GLubyte * WINAPI glGetStringi( GLenum name, GLuint index ) { struct glGetStringi_params args = diff --git a/include/wine/opengl_driver.h b/include/wine/opengl_driver.h index 7056ec616ad..f73ff11f023 100644 --- a/include/wine/opengl_driver.h +++ b/include/wine/opengl_driver.h @@ -74,6 +74,8 @@ struct opengl_client_context UINT64 unix_handle; UINT64 unix_funcs; GLenum last_error; + int major_version; + int minor_version; BOOLEAN extensions[GL_EXTENSION_COUNT]; /* exposed client extensions */ }; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10019