Commit cd93ca03 authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

opengl32: Use the unixlib for glGet(String|Integerv).

parent 7dcc6ccf
......@@ -935,7 +935,6 @@ print OUT "#include \"wine/unixlib.h\"\n\n";
foreach (sort keys %norm_functions)
{
next if defined $manual_win_functions{$_};
next if needs_wrapper( $_, $norm_functions{$_} );
print OUT generate_func_params($_, $norm_functions{$_});
}
......@@ -944,7 +943,6 @@ print OUT "{\n";
foreach (sort keys %norm_functions)
{
next if defined $manual_win_functions{$_};
next if needs_wrapper( $_, $norm_functions{$_} );
printf OUT " unix_%s,\n", $_;
}
print OUT "};\n\n";
......@@ -1005,7 +1003,6 @@ print OUT "#include \"opengl_ext.h\"\n\n";
foreach (sort keys %norm_functions)
{
next if defined $manual_win_functions{$_};
next if needs_wrapper( $_, $norm_functions{$_} );
print OUT generate_unix_thunk($_, $norm_functions{$_}, "gl");
}
......@@ -1014,7 +1011,6 @@ print OUT "{\n";
foreach (sort keys %norm_functions)
{
next if defined $manual_win_functions{$_};
next if needs_wrapper( $_, $norm_functions{$_} );
printf OUT " &gl_%s,\n", $_;
}
print OUT "};\n";
......
......@@ -841,6 +841,14 @@ static NTSTATUS gl_glGetFloatv( void *args )
return STATUS_SUCCESS;
}
static NTSTATUS gl_glGetIntegerv( void *args )
{
struct glGetIntegerv_params *params = args;
const struct opengl_funcs *funcs = NtCurrentTeb()->glTable;
funcs->gl.p_glGetIntegerv( params->pname, params->data );
return STATUS_SUCCESS;
}
static NTSTATUS gl_glGetLightfv( void *args )
{
struct glGetLightfv_params *params = args;
......@@ -937,6 +945,14 @@ static NTSTATUS gl_glGetPolygonStipple( void *args )
return STATUS_SUCCESS;
}
static NTSTATUS gl_glGetString( void *args )
{
struct glGetString_params *params = args;
const struct opengl_funcs *funcs = NtCurrentTeb()->glTable;
params->ret = funcs->gl.p_glGetString( params->name );
return STATUS_SUCCESS;
}
static NTSTATUS gl_glGetTexEnvfv( void *args )
{
struct glGetTexEnvfv_params *params = args;
......@@ -2780,6 +2796,7 @@ const unixlib_function_t __wine_unix_call_funcs[] =
&gl_glGetDoublev,
&gl_glGetError,
&gl_glGetFloatv,
&gl_glGetIntegerv,
&gl_glGetLightfv,
&gl_glGetLightiv,
&gl_glGetMapdv,
......@@ -2792,6 +2809,7 @@ const unixlib_function_t __wine_unix_call_funcs[] =
&gl_glGetPixelMapusv,
&gl_glGetPointerv,
&gl_glGetPolygonStipple,
&gl_glGetString,
&gl_glGetTexEnvfv,
&gl_glGetTexEnviv,
&gl_glGetTexGendv,
......
......@@ -669,6 +669,12 @@ struct glGetFloatv_params
GLfloat *data;
};
struct glGetIntegerv_params
{
GLenum pname;
GLint *data;
};
struct glGetLightfv_params
{
GLenum light;
......@@ -747,6 +753,12 @@ struct glGetPolygonStipple_params
GLubyte *mask;
};
struct glGetString_params
{
GLenum name;
const GLubyte *ret;
};
struct glGetTexEnvfv_params
{
GLenum target;
......@@ -2247,6 +2259,7 @@ enum unix_funcs
unix_glGetDoublev,
unix_glGetError,
unix_glGetFloatv,
unix_glGetIntegerv,
unix_glGetLightfv,
unix_glGetLightiv,
unix_glGetMapdv,
......@@ -2259,6 +2272,7 @@ enum unix_funcs
unix_glGetPixelMapusv,
unix_glGetPointerv,
unix_glGetPolygonStipple,
unix_glGetString,
unix_glGetTexEnvfv,
unix_glGetTexEnviv,
unix_glGetTexGendv,
......
......@@ -26,6 +26,8 @@
#include <sys/types.h>
#include <math.h>
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
......@@ -35,6 +37,9 @@
#include "winnt.h"
#include "opengl_ext.h"
#include "unixlib.h"
#include "wine/gdi_driver.h"
#include "wine/glu.h"
#include "wine/debug.h"
......@@ -835,27 +840,32 @@ static BOOL filter_extensions( const char *extensions, GLubyte **exts_list, GLui
void WINAPI glGetIntegerv(GLenum pname, GLint *data)
{
const struct opengl_funcs *funcs = NtCurrentTeb()->glTable;
struct glGetIntegerv_params args = { .pname = pname, .data = data, };
NTSTATUS status;
TRACE( "pname %d, data %p\n", pname, data );
TRACE("(%d, %p)\n", pname, data);
if (pname == GL_NUM_EXTENSIONS)
{
struct wgl_handle *ptr = get_current_context_ptr();
GLuint **disabled = &ptr->u.context->disabled_exts;
if (ptr->u.context->disabled_exts ||
filter_extensions(NULL, NULL, &ptr->u.context->disabled_exts))
if (*disabled || filter_extensions( NULL, NULL, disabled ))
{
const GLuint *disabled_exts = ptr->u.context->disabled_exts;
const GLuint *disabled_exts = *disabled;
GLint count, disabled_count = 0;
funcs->gl.p_glGetIntegerv(pname, &count);
args.data = &count;
if ((status = UNIX_CALL( glGetIntegerv, &args ))) WARN( "glGetIntegerv returned %#x\n", status );
while (*disabled_exts++ != ~0u)
disabled_count++;
*data = count - disabled_count;
return;
}
}
funcs->gl.p_glGetIntegerv(pname, data);
if ((status = UNIX_CALL( glGetIntegerv, &args ))) WARN( "glGetIntegerv returned %#x\n", status );
}
const GLubyte * WINAPI glGetStringi(GLenum name, GLuint index)
......@@ -1739,17 +1749,22 @@ GLint WINAPI glDebugEntry( GLint unknown1, GLint unknown2 )
*/
const GLubyte * WINAPI glGetString( GLenum name )
{
const struct opengl_funcs *funcs = NtCurrentTeb()->glTable;
const GLubyte *ret = funcs->gl.p_glGetString( name );
struct glGetString_params args = { .name = name, };
NTSTATUS status;
TRACE( "name %d\n", name );
if (name == GL_EXTENSIONS && ret)
if ((status = UNIX_CALL( glGetString, &args ))) WARN( "glGetString returned %#x\n", status );
if (name == GL_EXTENSIONS && args.ret)
{
struct wgl_handle *ptr = get_current_context_ptr();
if (ptr->u.context->extensions ||
filter_extensions((const char *)ret, &ptr->u.context->extensions, &ptr->u.context->disabled_exts))
ret = ptr->u.context->extensions;
GLubyte **extensions = &ptr->u.context->extensions;
GLuint **disabled = &ptr->u.context->disabled_exts;
if (*extensions || filter_extensions( (const char *)args.ret, extensions, disabled )) return *extensions;
}
return ret;
return args.ret;
}
/* wrapper for glDebugMessageCallback* functions */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment