From 1523ccc900b1c559474505e44d22b79282ebd57f Mon Sep 17 00:00:00 2001 From: Matteo Bruni Date: Wed, 28 Jan 2015 18:30:56 +0100 Subject: opengl32: Introduce wrappers for glGetIntegerv and glGetStringi. (v3) It should be a NOP change, the wrappers do nothing extra (yet). v2: Don't check for glGetIntegerv in wglGetProcAddress. v3: Just make the extension_registry entry point to the new glGetStringi wrapper. --- dlls/opengl32/make_opengl | 8 +++++++- dlls/opengl32/opengl_ext.c | 6 +----- dlls/opengl32/opengl_norm.c | 9 --------- dlls/opengl32/wgl.c | 33 ++++++++++++++++++++++++--------- 4 files changed, 32 insertions(+), 24 deletions(-) diff --git a/dlls/opengl32/make_opengl b/dlls/opengl32/make_opengl index 9ca5ebd..2b15f58 100755 --- a/dlls/opengl32/make_opengl +++ b/dlls/opengl32/make_opengl @@ -236,6 +236,7 @@ sub GenerateThunk($$$$) my $trace_arg = ""; return "" if $name eq "glDebugEntry"; + return "" if $name eq "glGetIntegerv"; return "" if $name eq "glGetString"; return "" if $func_ref->[2] && $func_ref->[2]->[0] =~ /WGL_/; @@ -285,6 +286,7 @@ sub GenerateThunk($$$$) } } $ret .= 'void ' if (!@{$func_ref->[1]}); + return "$ret) DECLSPEC_HIDDEN;\n" if $name eq "glGetStringi"; $ret .= ") {\n"; $ret .= " const struct opengl_funcs *funcs = NtCurrentTeb()->glTable;\n"; if ($func_ref->[0] ne "void" && $gen_thread_safe) { @@ -951,7 +953,11 @@ my $count = keys %ext_functions; print EXT "const int extension_registry_size = $count;\n"; foreach (sort keys %ext_functions) { my $string = GenerateThunk($_, $ext_functions{$_}, 0, "ext"); - print EXT "\nstatic $string" if $string; + if ($string =~ /DECLSPEC_HIDDEN/) { + print EXT "\n$string"; + } else { + print EXT "\nstatic $string" if $string; + } } # Then the table giving the string <-> function correspondence */ diff --git a/dlls/opengl32/opengl_ext.c b/dlls/opengl32/opengl_ext.c index 9b9dfa7..67ebc59 100644 --- a/dlls/opengl32/opengl_ext.c +++ b/dlls/opengl32/opengl_ext.c @@ -5014,11 +5014,7 @@ static void WINAPI glGetSharpenTexFuncSGIS( GLenum target, GLfloat* points ) { funcs->ext.p_glGetSharpenTexFuncSGIS( target, points ); } -static const GLubyte* WINAPI glGetStringi( GLenum name, GLuint index ) { - const struct opengl_funcs *funcs = NtCurrentTeb()->glTable; - TRACE("(%d, %d)\n", name, index ); - return funcs->ext.p_glGetStringi( name, index ); -} +const GLubyte* WINAPI glGetStringi( GLenum name, GLuint index ) DECLSPEC_HIDDEN; static GLuint WINAPI glGetSubroutineIndex( GLuint program, GLenum shadertype, const GLchar* name ) { const struct opengl_funcs *funcs = NtCurrentTeb()->glTable; diff --git a/dlls/opengl32/opengl_norm.c b/dlls/opengl32/opengl_norm.c index 52fb00b..34a4892 100644 --- a/dlls/opengl32/opengl_norm.c +++ b/dlls/opengl32/opengl_norm.c @@ -948,15 +948,6 @@ void WINAPI glGetFloatv( GLenum pname, GLfloat* data ) { } /*********************************************************************** - * glGetIntegerv (OPENGL32.@) - */ -void WINAPI glGetIntegerv( GLenum pname, GLint* data ) { - const struct opengl_funcs *funcs = NtCurrentTeb()->glTable; - TRACE("(%d, %p)\n", pname, data ); - funcs->gl.p_glGetIntegerv( pname, data ); -} - -/*********************************************************************** * glGetLightfv (OPENGL32.@) */ void WINAPI glGetLightfv( GLenum light, GLenum pname, GLfloat* params ) { diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c index 6ff54f0..b028fe0 100644 --- a/dlls/opengl32/wgl.c +++ b/dlls/opengl32/wgl.c @@ -687,27 +687,42 @@ int WINAPI wglGetLayerPaletteEntries(HDC hdc, return 0; } +void WINAPI glGetIntegerv(GLenum pname, GLint *data) +{ + const struct opengl_funcs *funcs = NtCurrentTeb()->glTable; + + TRACE("(%d, %p)\n", pname, data); + funcs->gl.p_glGetIntegerv(pname, data); +} + +const GLubyte * WINAPI glGetStringi(GLenum name, GLuint index) +{ + const struct opengl_funcs *funcs = NtCurrentTeb()->glTable; + + TRACE("(%d, %d)\n", name, index); + if (!funcs->ext.p_glGetStringi) + { + void **func_ptr = (void **)&funcs->ext.p_glGetStringi; + + *func_ptr = funcs->wgl.p_wglGetProcAddress("glGetStringi"); + } + + return funcs->ext.p_glGetStringi(name, index); +} + /* check if the extension is present in the list */ static BOOL has_extension( const char *list, const char *ext, size_t len ) { if (!list) { - const struct opengl_funcs *funcs = NtCurrentTeb()->glTable; const char *gl_ext; unsigned int i; GLint extensions_count; - if (!funcs->ext.p_glGetStringi) - { - void **func_ptr = (void **)&funcs->ext.p_glGetStringi; - - *func_ptr = funcs->wgl.p_wglGetProcAddress("glGetStringi"); - } - glGetIntegerv(GL_NUM_EXTENSIONS, &extensions_count); for (i = 0; i < extensions_count; ++i) { - gl_ext = (const char *)funcs->ext.p_glGetStringi(GL_EXTENSIONS, i); + gl_ext = (const char *)glGetStringi(GL_EXTENSIONS, i); if (!strncmp(gl_ext, ext, len) && !gl_ext[len]) return TRUE; } -- 2.0.5