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

opengl32: Use the unixlib interface for more WGL functions.

parent 494251ad
......@@ -140,6 +140,36 @@ my %khronos_types =
"khronos_uint32_t" => "unsigned int",
"khronos_float_t" => "float",
);
my %manual_win_functions =
(
"glDebugEntry" => 1,
"wglChoosePixelFormat" => 1,
"wglCreateLayerContext" => 1,
"wglDescribeLayerPlane" => 1,
"wglGetCurrentContext" => 1,
"wglGetCurrentDC" => 1,
"wglGetDefaultProcAddress" => 1,
"wglGetLayerPaletteEntries" => 1,
"wglRealizeLayerPalette" => 1,
"wglSetLayerPaletteEntries" => 1,
"wglSwapLayerBuffers" => 1,
"wglUseFontBitmapsA" => 1,
"wglUseFontBitmapsW" => 1,
"wglUseFontOutlinesA" => 1,
"wglUseFontOutlinesW" => 1,
);
my %manual_win_thunks =
(
"glGetIntegerv" => 1,
"glGetString" => 1,
"glGetStringi" => 1,
"wglGetCurrentReadDCARB" => 1,
"wglGetPixelFormat" => 1,
"wglGetProcAddress" => 1,
"wglSwapBuffers" => 1,
);
#
# Used to convert some types
#
......@@ -419,25 +449,6 @@ my %wgl_functions;
my %gl_enums;
my (%gl_types, @gl_types); # also use an array to preserve declaration order
my %manual_win_functions =
(
"glDebugEntry" => 1,
"wglChoosePixelFormat" => 1,
"wglCreateLayerContext" => 1,
"wglDescribeLayerPlane" => 1,
"wglGetCurrentContext" => 1,
"wglGetCurrentDC" => 1,
"wglGetDefaultProcAddress" => 1,
"wglGetLayerPaletteEntries" => 1,
"wglRealizeLayerPalette" => 1,
"wglSetLayerPaletteEntries" => 1,
"wglSwapLayerBuffers" => 1,
"wglUseFontBitmapsA" => 1,
"wglUseFontBitmapsW" => 1,
"wglUseFontOutlinesA" => 1,
"wglUseFontOutlinesW" => 1,
);
my %remapped_wgl_functions =
(
"ChoosePixelFormat" => "wglChoosePixelFormat",
......@@ -498,23 +509,10 @@ sub is_supported_api($)
# some functions need a hand-written wrapper
sub needs_wrapper($$)
{
my %funcs =
(
"glDebugEntry" => 1,
"glDebugMessageCallback" => 1,
"glDebugMessageCallbackAMD" => 1,
"glDebugMessageCallbackARB" => 1,
"glGetIntegerv" => 1,
"glGetString" => 1,
"glGetStringi" => 1,
"wglGetCurrentReadDCARB" => 1,
"wglGetPixelFormat" => 1,
"wglGetProcAddress" => 1,
"wglSwapBuffers" => 1,
);
my ($name, $func) = @_;
return 1 if defined $funcs{$name};
return 1 if $name =~ /^glDebugMessageCallback/;
# check if return value needs special handling
(my $type = $func->[0]->textContent()) =~ s/ $//;
return 1 if defined $remap_types{$type};
......@@ -881,26 +879,26 @@ print OUT "WINE_DEFAULT_DEBUG_CHANNEL(opengl);\n";
foreach (sort keys %wgl_functions)
{
next if defined $manual_win_functions{$_};
next if needs_wrapper( $_, $wgl_functions{$_} );
next if defined $manual_win_thunks{$_};
print OUT "\n" . generate_win_thunk($_, $wgl_functions{$_});
}
foreach (sort keys %norm_functions)
{
next if defined $manual_win_functions{$_};
next if needs_wrapper( $_, $norm_functions{$_} );
next if defined $manual_win_thunks{$_};
print OUT "\n" . generate_win_thunk($_, $norm_functions{$_});
}
foreach (sort keys %ext_functions)
{
next if defined $manual_win_functions{$_};
next if needs_wrapper( $_, $ext_functions{$_} );
next if defined $manual_win_thunks{$_};
print OUT "\nstatic " . generate_win_thunk($_, $ext_functions{$_});
}
print OUT "\n";
foreach (sort keys %ext_functions)
{
next unless defined $manual_win_functions{$_} || needs_wrapper( $_, $ext_functions{$_} );
next unless defined $manual_win_functions{$_} || $manual_win_thunks{$_};
my $decl_args = get_func_args( $ext_functions{$_}, 1, 0, "" );
my $func_ret = get_func_ret( $ext_functions{$_}, 0 );
printf OUT "extern %s WINAPI %s(%s) DECLSPEC_HIDDEN;\n", $func_ret, $_, $decl_args;
......@@ -941,6 +939,21 @@ print OUT "#include \"opengl_ext.h\"\n\n";
foreach (sort keys %wgl_functions)
{
next if defined $manual_win_functions{$_};
next unless needs_wrapper( $_, $wgl_functions{$_} );
print OUT "extern NTSTATUS wgl_$_( void *args ) DECLSPEC_HIDDEN;\n";
}
foreach (sort keys %ext_functions)
{
next if defined $manual_win_functions{$_};
next unless needs_wrapper( $_, $ext_functions{$_} );
print OUT "extern NTSTATUS ext_$_( void *args ) DECLSPEC_HIDDEN;\n";
}
print OUT "\n";
foreach (sort keys %wgl_functions)
{
next if defined $manual_win_functions{$_};
next if needs_wrapper( $_, $wgl_functions{$_} );
print OUT generate_unix_thunk($_, $wgl_functions{$_}, "wgl");
}
foreach (sort keys %norm_functions)
......@@ -951,6 +964,7 @@ foreach (sort keys %norm_functions)
foreach (sort keys %ext_functions)
{
next if defined $manual_win_functions{$_};
next if needs_wrapper( $_, $ext_functions{$_} );
print OUT generate_unix_thunk($_, $ext_functions{$_}, "ext");
}
......
......@@ -13,30 +13,24 @@
#include "opengl_ext.h"
static NTSTATUS wgl_wglCopyContext( void *args )
{
struct wglCopyContext_params *params = args;
const struct opengl_funcs *funcs = NtCurrentTeb()->glTable;
params->ret = funcs->wgl.p_wglCopyContext( (struct wgl_context *)params->hglrcSrc, (struct wgl_context *)params->hglrcDst, params->mask );
return STATUS_SUCCESS;
}
static NTSTATUS wgl_wglCreateContext( void *args )
{
struct wglCreateContext_params *params = args;
const struct opengl_funcs *funcs = get_dc_funcs( params->hDc );
if (!funcs || !funcs->wgl.p_wglCreateContext) return STATUS_NOT_IMPLEMENTED;
params->ret = (HGLRC)funcs->wgl.p_wglCreateContext( params->hDc );
return STATUS_SUCCESS;
}
static NTSTATUS wgl_wglDeleteContext( void *args )
{
struct wglDeleteContext_params *params = args;
const struct opengl_funcs *funcs = NtCurrentTeb()->glTable;
params->ret = funcs->wgl.p_wglDeleteContext( (struct wgl_context *)params->oldContext );
return STATUS_SUCCESS;
}
extern NTSTATUS wgl_wglCopyContext( void *args ) DECLSPEC_HIDDEN;
extern NTSTATUS wgl_wglCreateContext( void *args ) DECLSPEC_HIDDEN;
extern NTSTATUS wgl_wglDeleteContext( void *args ) DECLSPEC_HIDDEN;
extern NTSTATUS wgl_wglMakeCurrent( void *args ) DECLSPEC_HIDDEN;
extern NTSTATUS wgl_wglShareLists( void *args ) DECLSPEC_HIDDEN;
extern NTSTATUS ext_glDebugMessageCallback( void *args ) DECLSPEC_HIDDEN;
extern NTSTATUS ext_glDebugMessageCallbackAMD( void *args ) DECLSPEC_HIDDEN;
extern NTSTATUS ext_glDebugMessageCallbackARB( void *args ) DECLSPEC_HIDDEN;
extern NTSTATUS ext_wglBindTexImageARB( void *args ) DECLSPEC_HIDDEN;
extern NTSTATUS ext_wglCreateContextAttribsARB( void *args ) DECLSPEC_HIDDEN;
extern NTSTATUS ext_wglCreatePbufferARB( void *args ) DECLSPEC_HIDDEN;
extern NTSTATUS ext_wglDestroyPbufferARB( void *args ) DECLSPEC_HIDDEN;
extern NTSTATUS ext_wglGetPbufferDCARB( void *args ) DECLSPEC_HIDDEN;
extern NTSTATUS ext_wglMakeContextCurrentARB( void *args ) DECLSPEC_HIDDEN;
extern NTSTATUS ext_wglQueryPbufferARB( void *args ) DECLSPEC_HIDDEN;
extern NTSTATUS ext_wglReleasePbufferDCARB( void *args ) DECLSPEC_HIDDEN;
extern NTSTATUS ext_wglReleaseTexImageARB( void *args ) DECLSPEC_HIDDEN;
extern NTSTATUS ext_wglSetPbufferAttribARB( void *args ) DECLSPEC_HIDDEN;
static NTSTATUS wgl_wglDescribePixelFormat( void *args )
{
......@@ -64,15 +58,6 @@ static NTSTATUS wgl_wglGetProcAddress( void *args )
return STATUS_SUCCESS;
}
static NTSTATUS wgl_wglMakeCurrent( void *args )
{
struct wglMakeCurrent_params *params = args;
const struct opengl_funcs *funcs = get_dc_funcs( params->hDc );
if (!funcs || !funcs->wgl.p_wglMakeCurrent) return STATUS_NOT_IMPLEMENTED;
params->ret = funcs->wgl.p_wglMakeCurrent( params->hDc, (struct wgl_context *)params->newContext );
return STATUS_SUCCESS;
}
static NTSTATUS wgl_wglSetPixelFormat( void *args )
{
struct wglSetPixelFormat_params *params = args;
......@@ -82,14 +67,6 @@ static NTSTATUS wgl_wglSetPixelFormat( void *args )
return STATUS_SUCCESS;
}
static NTSTATUS wgl_wglShareLists( void *args )
{
struct wglShareLists_params *params = args;
const struct opengl_funcs *funcs = NtCurrentTeb()->glTable;
params->ret = funcs->wgl.p_wglShareLists( (struct wgl_context *)params->hrcSrvShare, (struct wgl_context *)params->hrcSrvSource );
return STATUS_SUCCESS;
}
static NTSTATUS wgl_wglSwapBuffers( void *args )
{
struct wglSwapBuffers_params *params = args;
......@@ -5451,30 +5428,6 @@ static NTSTATUS ext_glCurrentPaletteMatrixARB( void *args )
return STATUS_SUCCESS;
}
static NTSTATUS ext_glDebugMessageCallback( void *args )
{
struct glDebugMessageCallback_params *params = args;
const struct opengl_funcs *funcs = NtCurrentTeb()->glTable;
funcs->ext.p_glDebugMessageCallback( params->callback, params->userParam );
return STATUS_SUCCESS;
}
static NTSTATUS ext_glDebugMessageCallbackAMD( void *args )
{
struct glDebugMessageCallbackAMD_params *params = args;
const struct opengl_funcs *funcs = NtCurrentTeb()->glTable;
funcs->ext.p_glDebugMessageCallbackAMD( params->callback, params->userParam );
return STATUS_SUCCESS;
}
static NTSTATUS ext_glDebugMessageCallbackARB( void *args )
{
struct glDebugMessageCallbackARB_params *params = args;
const struct opengl_funcs *funcs = NtCurrentTeb()->glTable;
funcs->ext.p_glDebugMessageCallbackARB( params->callback, params->userParam );
return STATUS_SUCCESS;
}
static NTSTATUS ext_glDebugMessageControl( void *args )
{
struct glDebugMessageControl_params *params = args;
......@@ -24098,14 +24051,6 @@ static NTSTATUS ext_wglAllocateMemoryNV( void *args )
return STATUS_SUCCESS;
}
static NTSTATUS ext_wglBindTexImageARB( void *args )
{
struct wglBindTexImageARB_params *params = args;
const struct opengl_funcs *funcs = NtCurrentTeb()->glTable;
params->ret = funcs->ext.p_wglBindTexImageARB( (struct wgl_pbuffer *)params->hPbuffer, params->iBuffer );
return STATUS_SUCCESS;
}
static NTSTATUS ext_wglChoosePixelFormatARB( void *args )
{
struct wglChoosePixelFormatARB_params *params = args;
......@@ -24115,32 +24060,6 @@ static NTSTATUS ext_wglChoosePixelFormatARB( void *args )
return STATUS_SUCCESS;
}
static NTSTATUS ext_wglCreateContextAttribsARB( void *args )
{
struct wglCreateContextAttribsARB_params *params = args;
const struct opengl_funcs *funcs = get_dc_funcs( params->hDC );
if (!funcs || !funcs->ext.p_wglCreateContextAttribsARB) return STATUS_NOT_IMPLEMENTED;
params->ret = (HGLRC)funcs->ext.p_wglCreateContextAttribsARB( params->hDC, (struct wgl_context *)params->hShareContext, params->attribList );
return STATUS_SUCCESS;
}
static NTSTATUS ext_wglCreatePbufferARB( void *args )
{
struct wglCreatePbufferARB_params *params = args;
const struct opengl_funcs *funcs = get_dc_funcs( params->hDC );
if (!funcs || !funcs->ext.p_wglCreatePbufferARB) return STATUS_NOT_IMPLEMENTED;
params->ret = (HPBUFFERARB)funcs->ext.p_wglCreatePbufferARB( params->hDC, params->iPixelFormat, params->iWidth, params->iHeight, params->piAttribList );
return STATUS_SUCCESS;
}
static NTSTATUS ext_wglDestroyPbufferARB( void *args )
{
struct wglDestroyPbufferARB_params *params = args;
const struct opengl_funcs *funcs = NtCurrentTeb()->glTable;
params->ret = funcs->ext.p_wglDestroyPbufferARB( (struct wgl_pbuffer *)params->hPbuffer );
return STATUS_SUCCESS;
}
static NTSTATUS ext_wglFreeMemoryNV( void *args )
{
struct wglFreeMemoryNV_params *params = args;
......@@ -24174,14 +24093,6 @@ static NTSTATUS ext_wglGetExtensionsStringEXT( void *args )
return STATUS_SUCCESS;
}
static NTSTATUS ext_wglGetPbufferDCARB( void *args )
{
struct wglGetPbufferDCARB_params *params = args;
const struct opengl_funcs *funcs = NtCurrentTeb()->glTable;
params->ret = funcs->ext.p_wglGetPbufferDCARB( (struct wgl_pbuffer *)params->hPbuffer );
return STATUS_SUCCESS;
}
static NTSTATUS ext_wglGetPixelFormatAttribfvARB( void *args )
{
struct wglGetPixelFormatAttribfvARB_params *params = args;
......@@ -24208,15 +24119,6 @@ static NTSTATUS ext_wglGetSwapIntervalEXT( void *args )
return STATUS_SUCCESS;
}
static NTSTATUS ext_wglMakeContextCurrentARB( void *args )
{
struct wglMakeContextCurrentARB_params *params = args;
const struct opengl_funcs *funcs = get_dc_funcs( params->hDrawDC );
if (!funcs || !funcs->ext.p_wglMakeContextCurrentARB) return STATUS_NOT_IMPLEMENTED;
params->ret = funcs->ext.p_wglMakeContextCurrentARB( params->hDrawDC, params->hReadDC, (struct wgl_context *)params->hglrc );
return STATUS_SUCCESS;
}
static NTSTATUS ext_wglQueryCurrentRendererIntegerWINE( void *args )
{
struct wglQueryCurrentRendererIntegerWINE_params *params = args;
......@@ -24233,14 +24135,6 @@ static NTSTATUS ext_wglQueryCurrentRendererStringWINE( void *args )
return STATUS_SUCCESS;
}
static NTSTATUS ext_wglQueryPbufferARB( void *args )
{
struct wglQueryPbufferARB_params *params = args;
const struct opengl_funcs *funcs = NtCurrentTeb()->glTable;
params->ret = funcs->ext.p_wglQueryPbufferARB( (struct wgl_pbuffer *)params->hPbuffer, params->iAttribute, params->piValue );
return STATUS_SUCCESS;
}
static NTSTATUS ext_wglQueryRendererIntegerWINE( void *args )
{
struct wglQueryRendererIntegerWINE_params *params = args;
......@@ -24259,30 +24153,6 @@ static NTSTATUS ext_wglQueryRendererStringWINE( void *args )
return STATUS_SUCCESS;
}
static NTSTATUS ext_wglReleasePbufferDCARB( void *args )
{
struct wglReleasePbufferDCARB_params *params = args;
const struct opengl_funcs *funcs = NtCurrentTeb()->glTable;
params->ret = funcs->ext.p_wglReleasePbufferDCARB( (struct wgl_pbuffer *)params->hPbuffer, params->hDC );
return STATUS_SUCCESS;
}
static NTSTATUS ext_wglReleaseTexImageARB( void *args )
{
struct wglReleaseTexImageARB_params *params = args;
const struct opengl_funcs *funcs = NtCurrentTeb()->glTable;
params->ret = funcs->ext.p_wglReleaseTexImageARB( (struct wgl_pbuffer *)params->hPbuffer, params->iBuffer );
return STATUS_SUCCESS;
}
static NTSTATUS ext_wglSetPbufferAttribARB( void *args )
{
struct wglSetPbufferAttribARB_params *params = args;
const struct opengl_funcs *funcs = NtCurrentTeb()->glTable;
params->ret = funcs->ext.p_wglSetPbufferAttribARB( (struct wgl_pbuffer *)params->hPbuffer, params->piAttribList );
return STATUS_SUCCESS;
}
static NTSTATUS ext_wglSetPixelFormatWINE( void *args )
{
struct wglSetPixelFormatWINE_params *params = args;
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