From: Jacek Caban <jacek@codeweavers.com> --- dlls/opengl32/make_opengl | 1 - dlls/opengl32/unix_thunks.c | 4 ++-- dlls/opengl32/unix_thunks.h | 1 - dlls/opengl32/unix_wgl.c | 22 ---------------------- dlls/opengl32/wgl.c | 14 +++++++++++++- 5 files changed, 15 insertions(+), 27 deletions(-) diff --git a/dlls/opengl32/make_opengl b/dlls/opengl32/make_opengl index 9b1b4a588d5..f6babb688d1 100755 --- a/dlls/opengl32/make_opengl +++ b/dlls/opengl32/make_opengl @@ -218,7 +218,6 @@ my %manual_unix_thunks = "glGetInteger64v" => 1, "glGetIntegerv" => 1, "glGetString" => 1, - "glGetStringi" => 1, "glGetUnsignedBytevEXT" => 1, "glImportSyncEXT" => 1, "glNamedFramebufferDrawBuffer" => 1, diff --git a/dlls/opengl32/unix_thunks.c b/dlls/opengl32/unix_thunks.c index 4ca258055fb..5f1c176e998 100644 --- a/dlls/opengl32/unix_thunks.c +++ b/dlls/opengl32/unix_thunks.c @@ -12335,7 +12335,7 @@ static NTSTATUS ext_glGetStringi( void *args ) struct glGetStringi_params *params = args; const struct opengl_funcs *funcs = params->teb->glTable; if (!funcs->p_glGetStringi) return STATUS_NOT_IMPLEMENTED; - params->ret = wrap_glGetStringi( params->teb, params->name, params->index ); + params->ret = funcs->p_glGetStringi( params->name, params->index ); return STATUS_SUCCESS; } @@ -55167,7 +55167,7 @@ static NTSTATUS wow64_ext_glGetStringi( void *args ) const GLubyte *ret; const struct opengl_funcs *funcs = teb->glTable; if (!funcs->p_glGetStringi) return STATUS_NOT_IMPLEMENTED; - ret = wrap_glGetStringi( teb, params->name, params->index ); + ret = funcs->p_glGetStringi( params->name, params->index ); return return_wow64_string( ret, ¶ms->ret ); } diff --git a/dlls/opengl32/unix_thunks.h b/dlls/opengl32/unix_thunks.h index 2c0824e0268..a86626520f4 100644 --- a/dlls/opengl32/unix_thunks.h +++ b/dlls/opengl32/unix_thunks.h @@ -34,7 +34,6 @@ extern void wrap_glFramebufferDrawBuffersEXT( TEB *teb, GLuint framebuffer, GLsi extern void wrap_glFramebufferReadBufferEXT( TEB *teb, GLuint framebuffer, GLenum mode ); extern void wrap_glGetFramebufferParameterivEXT( TEB *teb, GLuint framebuffer, GLenum pname, GLint *params ); extern void wrap_glGetInteger64v( TEB *teb, GLenum pname, GLint64 *data ); -extern const GLubyte *wrap_glGetStringi( TEB *teb, GLenum name, GLuint index ); extern void wrap_glGetUnsignedBytevEXT( TEB *teb, GLenum pname, GLubyte *data ); extern GLsync wrap_glImportSyncEXT( TEB *teb, GLenum external_sync_type, GLintptr external_sync, GLbitfield flags, GLsync handle ); extern void wrap_glNamedFramebufferDrawBuffer( TEB *teb, GLuint framebuffer, GLenum buf ); diff --git a/dlls/opengl32/unix_wgl.c b/dlls/opengl32/unix_wgl.c index 4206456ec8a..51c757e8b63 100644 --- a/dlls/opengl32/unix_wgl.c +++ b/dlls/opengl32/unix_wgl.c @@ -948,28 +948,6 @@ const GLubyte *wrap_glGetString( TEB *teb, GLenum name ) return ret; } -const GLubyte *wrap_glGetStringi( TEB *teb, GLenum name, GLuint index ) -{ - const struct opengl_funcs *funcs = teb->glTable; - - if (!funcs->p_glGetStringi) - { - void **func_ptr = (void **)&funcs->p_glGetStringi; - *func_ptr = funcs->p_wglGetProcAddress( "glGetStringi" ); - } - - if (name == GL_EXTENSIONS) - { - struct context *ctx = get_current_context( teb, NULL, NULL ); - struct opengl_client_context *client = opengl_client_context_from_client( ctx->base.client_context ); - if (index < client->extension_count) - return (const GLubyte *)all_extensions[client->extension_array[index]].name; - index = -1; - } - - return funcs->p_glGetStringi( name, index ); -} - static int registry_entry_cmp( const void *a, const void *b ) { const struct registry_entry *entry_a = a, *entry_b = b; diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c index 7222a127424..236d20a7dc9 100644 --- a/dlls/opengl32/wgl.c +++ b/dlls/opengl32/wgl.c @@ -58,7 +58,7 @@ static CRITICAL_SECTION_DEBUG wgl_cs_debug = { static CRITICAL_SECTION wgl_cs = { &wgl_cs_debug, -1, 0, 0, 0, 0 }; static char *wgl_extensions; -#define USE_GL_EXT(x) #x +#define USE_GL_EXT(x) #x, static const char *extension_names[] = { ALL_GL_EXTS ALL_WGL_EXTS }; #undef USE_GL_EXT @@ -2049,12 +2049,24 @@ const GLubyte * WINAPI glGetStringi( GLenum name, GLuint index ) .index = index, }; NTSTATUS status; + struct context *ctx; #ifndef _WIN64 GLubyte *wow64_str = NULL; #endif TRACE( "name %d, index %d\n", name, index ); + if (!(ctx = context_from_handle( NtCurrentTeb()->glCurrentRC ))) return NULL; + + switch (name) + { + case GL_EXTENSIONS: + if (index < ctx->base.extension_count) + return (const GLubyte *)extension_names[ctx->base.extension_array[index]]; + set_gl_error( GL_INVALID_VALUE ); + return NULL; + } + #ifndef _WIN64 if (UNIX_CALL( glGetStringi, &args ) == STATUS_BUFFER_TOO_SMALL) args.ret = wow64_str = malloc( (size_t)args.ret ); #endif -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10349