opengl32: Introduce wrappers for glGetIntegerv and glGetStringi. (v3).

This commit is contained in:
Matteo Bruni 2015-02-10 20:13:44 +01:00 committed by Alexandre Julliard
parent 9b0ebaeb78
commit 9e45ae0413
4 changed files with 32 additions and 24 deletions

View File

@ -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 */

View File

@ -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;

View File

@ -947,15 +947,6 @@ void WINAPI glGetFloatv( GLenum pname, GLfloat* data ) {
funcs->gl.p_glGetFloatv( pname, 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.@)
*/

View File

@ -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;
}