Introduce wow64 wrappers, similar to regular wrappers but used only for wow64 thunks, and use them instead of fully manual wow64 thunks.
From: Jacek Caban jacek@codeweavers.com
--- dlls/opengl32/make_opengl | 1 + dlls/opengl32/unix_thunks.h | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/dlls/opengl32/make_opengl b/dlls/opengl32/make_opengl index 204e226922c..7cd773c8e30 100755 --- a/dlls/opengl32/make_opengl +++ b/dlls/opengl32/make_opengl @@ -802,6 +802,7 @@ sub needs_wrapper($$) { my ($name, $func) = @_;
+ return 0 if defined $manual_win_functions{$name}; return 1 if defined $manual_unix_thunks{$name};
# check if return value needs special handling diff --git a/dlls/opengl32/unix_thunks.h b/dlls/opengl32/unix_thunks.h index 5b91de1ee20..c93c3dc34e7 100644 --- a/dlls/opengl32/unix_thunks.h +++ b/dlls/opengl32/unix_thunks.h @@ -2,9 +2,7 @@
extern BOOL wrap_wglCopyContext( TEB *teb , HGLRC hglrcSrc, HGLRC hglrcDst, UINT mask ); extern HGLRC wrap_wglCreateContext( TEB *teb , HDC hDc ); -extern HGLRC wrap_wglCreateLayerContext( TEB *teb , HDC hDc, int level ); extern BOOL wrap_wglDeleteContext( TEB *teb , HGLRC oldContext ); -extern HGLRC wrap_wglGetCurrentContext( TEB *teb); extern PROC wrap_wglGetProcAddress( TEB *teb , LPCSTR lpszProc ); extern BOOL wrap_wglMakeCurrent( TEB *teb , HDC hDc, HGLRC newContext ); extern BOOL wrap_wglShareLists( TEB *teb , HGLRC hrcSrvShare, HGLRC hrcSrvSource );
From: Jacek Caban jacek@codeweavers.com
--- dlls/opengl32/make_opengl | 51 +++++++++++++++++++++++++++++-------- dlls/opengl32/unix_thunks.c | 20 ++++++++++++++- dlls/opengl32/unix_thunks.h | 6 +++-- dlls/opengl32/unix_wgl.c | 33 +++--------------------- 4 files changed, 67 insertions(+), 43 deletions(-)
diff --git a/dlls/opengl32/make_opengl b/dlls/opengl32/make_opengl index 7cd773c8e30..53f2f9fad8f 100755 --- a/dlls/opengl32/make_opengl +++ b/dlls/opengl32/make_opengl @@ -214,7 +214,6 @@ my %manual_unix_thunks = ); my %manual_wow64_thunks = ( - "glClientWaitSync" => 1, "glDeleteSync" => 1, "glFenceSync" => 1, "glGetBufferPointerv" => 1, @@ -247,6 +246,10 @@ my %manual_wow64_thunks = "wglQueryCurrentRendererStringWINE" => 1, "wglQueryRendererStringWINE" => 1, ); +my %manual_wow64_wrappers = + ( + "glClientWaitSync" => 1, + ); my %pointer_array_count = ( "glCompileShaderIncludeARB" => "count", @@ -363,7 +366,8 @@ sub generate_unix_thunk($$$$) { my ($name, $func, $is_wow64, $prefix) = @_; my $func_ret = get_func_ret( $func, 0 ); - my $need_wrap = needs_wrapper( $name, $func ); + my $manual_wow64_wrapper = $is_wow64 && defined $manual_wow64_wrappers{$name}; + my $need_wrap = $manual_wow64_wrapper || needs_wrapper( $name, $func ); my $need_lock = $func_ret =~ /HGLRC|HPBUFFERARB/; my $teb = $is_wow64 ? "teb" : "params->teb"; my $input_conv = ""; @@ -434,6 +438,7 @@ sub generate_unix_thunk($$$$) { $call_args .= " ULongToPtr(params->$pname),"; $need_manual_thunk = 1 if $arg->textContent() =~ /(*.**|[|(sizei|int)ptr.**)/; + $need_lock = 1 if $arg->textContent() =~ /GLsync/; } } if (!is_void_func($func)) @@ -442,7 +447,7 @@ sub generate_unix_thunk($$$$) $ret .= " $ptype ret;\n"; } $ret .= " } *params = args;\n"; - if ($need_manual_thunk || $func->[0]->textContent() =~ /(GLsync|PROC|GLintptr|*)/) + if (!$need_wrap && ($need_manual_thunk || $func->[0]->textContent() =~ /(GLsync|PROC|GLintptr|*)/)) { $ret .= " FIXME( "params %p stub!\n", params );\n"; $ret .= " return STATUS_NOT_IMPLEMENTED;\n"; @@ -488,7 +493,11 @@ sub generate_unix_thunk($$$$) $ret .= "(UINT_PTR)" if $is_wow64 && get_wow64_arg_type( $func->[0] ) =~ /PTR32/; } $call_args =~ s/,$/ /; - if ($need_wrap) + if ($manual_wow64_wrapper) + { + $ret .= "wow64_$name($call_args);\n"; + } + elsif ($need_wrap) { $ret .= "wrap_$name($call_args);\n"; } @@ -522,12 +531,13 @@ sub generate_unix_thunk($$$$) return $ret; }
-sub generate_wrapper_declaration($$) +sub generate_wrapper_declaration($$$) { - my ($name, $func) = @_; + my ($name, $func, $is_wow64) = @_; my $ret = "extern " . get_func_ret( $func, 0 ); my $decl_args = get_func_args( $func, 0 ); - $ret .= " wrap_$name( TEB *teb"; + $ret .= $is_wow64 ? " wow64_" : " wrap_"; + $ret .= "$name( TEB *teb"; $ret .= " ,$decl_args" unless $decl_args eq "void"; $ret .= ");\n"; return $ret; @@ -1284,21 +1294,40 @@ print OUT "/* Automatically generated from http://www.opengl.org/registry files; foreach (sort keys %wgl_functions) { next if !needs_wrapper( $_, $wgl_functions{$_} ); - print OUT generate_wrapper_declaration($_, $wgl_functions{$_}); + print OUT generate_wrapper_declaration($_, $wgl_functions{$_}, 0); } foreach (sort keys %norm_functions) { next if !needs_wrapper( $_, $norm_functions{$_} ); - print OUT generate_wrapper_declaration($_, $norm_functions{$_}); + print OUT generate_wrapper_declaration($_, $norm_functions{$_}, 0); } foreach (sort keys %ext_functions) { next if $_ =~ /^egl/; # unix-side only API next if !needs_wrapper( $_, $ext_functions{$_} ); - print OUT generate_wrapper_declaration($_, $ext_functions{$_}); + print OUT generate_wrapper_declaration($_, $ext_functions{$_}, 0); }
-print OUT "\n"; +print OUT "\n#ifdef _WIN64\n"; + +foreach (sort keys %wgl_functions) +{ + next unless defined $manual_wow64_wrappers{$_}; + print OUT generate_wrapper_declaration($_, $wgl_functions{$_}, 1); +} +foreach (sort keys %norm_functions) +{ + next unless defined $manual_wow64_wrappers{$_}; + print OUT generate_wrapper_declaration($_, $norm_functions{$_}, 1); +} +foreach (sort keys %ext_functions) +{ + next if $_ =~ /^egl/; # unix-side only API + next unless defined $manual_wow64_wrappers{$_}; + print OUT generate_wrapper_declaration($_, $ext_functions{$_}, 1); +} + +print OUT "#endif\n\n";
foreach (sort keys %wgl_functions) { diff --git a/dlls/opengl32/unix_thunks.c b/dlls/opengl32/unix_thunks.c index f544d723739..51c16726688 100644 --- a/dlls/opengl32/unix_thunks.c +++ b/dlls/opengl32/unix_thunks.c @@ -4669,7 +4669,7 @@ static NTSTATUS ext_glClientWaitSemaphoreui64NVX( void *args ) return STATUS_SUCCESS; }
-NTSTATUS ext_glClientWaitSync( void *args ) +static NTSTATUS ext_glClientWaitSync( void *args ) { struct glClientWaitSync_params *params = args; const struct opengl_funcs *funcs = params->teb->glTable; @@ -38000,6 +38000,24 @@ static NTSTATUS wow64_ext_glClientWaitSemaphoreui64NVX( void *args ) return STATUS_SUCCESS; }
+static NTSTATUS wow64_ext_glClientWaitSync( void *args ) +{ + struct + { + PTR32 teb; + PTR32 sync; + GLbitfield flags; + GLuint64 timeout; + GLenum ret; + } *params = args; + TEB *teb = get_teb64( params->teb ); + pthread_mutex_lock( &wgl_lock ); + params->ret = wow64_glClientWaitSync( teb, ULongToPtr(params->sync), params->flags, params->timeout ); + pthread_mutex_unlock( &wgl_lock ); + set_context_attribute( teb, -1 /* unsupported */, NULL, 0 ); + return STATUS_SUCCESS; +} + static NTSTATUS wow64_ext_glClipControl( void *args ) { struct diff --git a/dlls/opengl32/unix_thunks.h b/dlls/opengl32/unix_thunks.h index c93c3dc34e7..990a6762693 100644 --- a/dlls/opengl32/unix_thunks.h +++ b/dlls/opengl32/unix_thunks.h @@ -30,12 +30,14 @@ extern int wrap_wglReleasePbufferDCARB( TEB *teb , HPBUFFERARB hPbuffer, HDC hDC extern BOOL wrap_wglReleaseTexImageARB( TEB *teb , HPBUFFERARB hPbuffer, int iBuffer ); extern BOOL wrap_wglSetPbufferAttribARB( TEB *teb , HPBUFFERARB hPbuffer, const int *piAttribList );
+#ifdef _WIN64 +extern GLenum wow64_glClientWaitSync( TEB *teb , GLsync sync, GLbitfield flags, GLuint64 timeout ); +#endif + extern NTSTATUS wgl_wglGetProcAddress( void *args ); extern NTSTATUS wow64_wgl_wglGetProcAddress( void *args ); extern NTSTATUS gl_glGetString( void *args ); extern NTSTATUS wow64_gl_glGetString( void *args ); -extern NTSTATUS ext_glClientWaitSync( void *args ); -extern NTSTATUS wow64_ext_glClientWaitSync( void *args ); extern NTSTATUS ext_glDeleteSync( void *args ); extern NTSTATUS wow64_ext_glDeleteSync( void *args ); extern NTSTATUS ext_glFenceSync( void *args ); diff --git a/dlls/opengl32/unix_wgl.c b/dlls/opengl32/unix_wgl.c index 6560b0f3082..ebcf7ce5637 100644 --- a/dlls/opengl32/unix_wgl.c +++ b/dlls/opengl32/unix_wgl.c @@ -1694,38 +1694,13 @@ NTSTATUS wow64_ext_wglQueryRendererStringWINE( void *args ) return STATUS_SUCCESS; }
-NTSTATUS wow64_ext_glClientWaitSync( void *args ) +GLenum wow64_glClientWaitSync( TEB *teb, GLsync sync, GLbitfield flags, GLuint64 timeout ) { + const struct opengl_funcs *funcs = teb->glTable; struct wgl_handle *handle; - struct - { - PTR32 teb; - PTR32 sync; - GLbitfield flags; - GLuint64 timeout; - GLenum ret; - } *params32 = args; - NTSTATUS status;
- pthread_mutex_lock( &wgl_lock ); - - if (!(handle = get_handle_ptr( ULongToPtr(params32->sync) ))) - status = STATUS_INVALID_HANDLE; - else - { - struct glClientWaitSync_params params = - { - .teb = get_teb64(params32->teb), - .sync = handle->u.sync, - .flags = params32->flags, - .timeout = params32->timeout, - }; - status = ext_glClientWaitSync( ¶ms ); - params32->ret = params.ret; - } - - pthread_mutex_unlock( &wgl_lock ); - return status; + if (!(handle = get_handle_ptr( sync ))) return GL_INVALID_VALUE; + return funcs->p_glClientWaitSync( handle->u.sync, flags, timeout ); }
NTSTATUS wow64_ext_glDeleteSync( void *args )
From: Jacek Caban jacek@codeweavers.com
--- dlls/opengl32/make_opengl | 2 +- dlls/opengl32/unix_thunks.c | 17 ++++++++++++++++- dlls/opengl32/unix_thunks.h | 3 +-- dlls/opengl32/unix_wgl.c | 36 ++++++------------------------------ 4 files changed, 24 insertions(+), 34 deletions(-)
diff --git a/dlls/opengl32/make_opengl b/dlls/opengl32/make_opengl index 53f2f9fad8f..74b5f4a53d6 100755 --- a/dlls/opengl32/make_opengl +++ b/dlls/opengl32/make_opengl @@ -215,7 +215,6 @@ my %manual_unix_thunks = my %manual_wow64_thunks = ( "glDeleteSync" => 1, - "glFenceSync" => 1, "glGetBufferPointerv" => 1, "glGetBufferPointervARB" => 1, "glGetNamedBufferPointerv" => 1, @@ -249,6 +248,7 @@ my %manual_wow64_thunks = my %manual_wow64_wrappers = ( "glClientWaitSync" => 1, + "glFenceSync" => 1, ); my %pointer_array_count = ( diff --git a/dlls/opengl32/unix_thunks.c b/dlls/opengl32/unix_thunks.c index 51c16726688..dbd2ed47b8b 100644 --- a/dlls/opengl32/unix_thunks.c +++ b/dlls/opengl32/unix_thunks.c @@ -7528,7 +7528,7 @@ static NTSTATUS ext_glFeedbackBufferxOES( void *args ) return STATUS_SUCCESS; }
-NTSTATUS ext_glFenceSync( void *args ) +static NTSTATUS ext_glFenceSync( void *args ) { struct glFenceSync_params *params = args; const struct opengl_funcs *funcs = params->teb->glTable; @@ -43368,6 +43368,21 @@ static NTSTATUS wow64_ext_glFeedbackBufferxOES( void *args ) return STATUS_SUCCESS; }
+static NTSTATUS wow64_ext_glFenceSync( void *args ) +{ + struct + { + PTR32 teb; + GLenum condition; + GLbitfield flags; + PTR32 ret; + } *params = args; + TEB *teb = get_teb64( params->teb ); + params->ret = (UINT_PTR)wow64_glFenceSync( teb, params->condition, params->flags ); + set_context_attribute( teb, -1 /* unsupported */, NULL, 0 ); + return STATUS_SUCCESS; +} + static NTSTATUS wow64_ext_glFinalCombinerInputNV( void *args ) { struct diff --git a/dlls/opengl32/unix_thunks.h b/dlls/opengl32/unix_thunks.h index 990a6762693..f76dbe410f9 100644 --- a/dlls/opengl32/unix_thunks.h +++ b/dlls/opengl32/unix_thunks.h @@ -32,6 +32,7 @@ extern BOOL wrap_wglSetPbufferAttribARB( TEB *teb , HPBUFFERARB hPbuffer, const
#ifdef _WIN64 extern GLenum wow64_glClientWaitSync( TEB *teb , GLsync sync, GLbitfield flags, GLuint64 timeout ); +extern GLsync wow64_glFenceSync( TEB *teb , GLenum condition, GLbitfield flags ); #endif
extern NTSTATUS wgl_wglGetProcAddress( void *args ); @@ -40,8 +41,6 @@ extern NTSTATUS gl_glGetString( void *args ); extern NTSTATUS wow64_gl_glGetString( void *args ); extern NTSTATUS ext_glDeleteSync( void *args ); extern NTSTATUS wow64_ext_glDeleteSync( void *args ); -extern NTSTATUS ext_glFenceSync( void *args ); -extern NTSTATUS wow64_ext_glFenceSync( void *args ); extern NTSTATUS ext_glGetBufferPointerv( void *args ); extern NTSTATUS wow64_ext_glGetBufferPointerv( void *args ); extern NTSTATUS ext_glGetBufferPointervARB( void *args ); diff --git a/dlls/opengl32/unix_wgl.c b/dlls/opengl32/unix_wgl.c index ebcf7ce5637..25c82bec6c8 100644 --- a/dlls/opengl32/unix_wgl.c +++ b/dlls/opengl32/unix_wgl.c @@ -1732,41 +1732,17 @@ NTSTATUS wow64_ext_glDeleteSync( void *args ) return status; }
-NTSTATUS wow64_ext_glFenceSync( void *args ) +GLsync wow64_glFenceSync( TEB *teb, GLenum condition, GLbitfield flags ) { - struct - { - PTR32 teb; - GLenum condition; - GLbitfield flags; - PTR32 ret; - } *params32 = args; - struct glFenceSync_params params = - { - .teb = get_teb64(params32->teb), - .condition = params32->condition, - .flags = params32->flags, - }; - NTSTATUS status; + const struct opengl_funcs *funcs = teb->glTable; + GLsync sync, handle;
- if ((status = ext_glFenceSync( ¶ms ))) return status; + if (!(sync = funcs->p_glFenceSync( condition, flags ))) return NULL;
pthread_mutex_lock( &wgl_lock ); - - if (!(params32->ret = (UINT_PTR)alloc_handle( HANDLE_GLSYNC, NULL, params.ret ))) - { - struct glDeleteSync_params delete_params = - { - .teb = params.teb, - .sync = params.ret, - }; - - ext_glDeleteSync( &delete_params ); - status = STATUS_NO_MEMORY; - } - + if (!(handle = alloc_handle( HANDLE_GLSYNC, NULL, sync ))) funcs->p_glDeleteSync( sync ); pthread_mutex_unlock( &wgl_lock ); - return status; + return handle; }
NTSTATUS wow64_ext_glGetSynciv( void *args )
From: Jacek Caban jacek@codeweavers.com
--- dlls/opengl32/make_opengl | 2 +- dlls/opengl32/unix_thunks.c | 17 ++++++++++++++++- dlls/opengl32/unix_thunks.h | 3 +-- dlls/opengl32/unix_wgl.c | 25 ++++--------------------- 4 files changed, 22 insertions(+), 25 deletions(-)
diff --git a/dlls/opengl32/make_opengl b/dlls/opengl32/make_opengl index 74b5f4a53d6..fabc11665c1 100755 --- a/dlls/opengl32/make_opengl +++ b/dlls/opengl32/make_opengl @@ -214,7 +214,6 @@ my %manual_unix_thunks = ); my %manual_wow64_thunks = ( - "glDeleteSync" => 1, "glGetBufferPointerv" => 1, "glGetBufferPointervARB" => 1, "glGetNamedBufferPointerv" => 1, @@ -248,6 +247,7 @@ my %manual_wow64_thunks = my %manual_wow64_wrappers = ( "glClientWaitSync" => 1, + "glDeleteSync" => 1, "glFenceSync" => 1, ); my %pointer_array_count = diff --git a/dlls/opengl32/unix_thunks.c b/dlls/opengl32/unix_thunks.c index dbd2ed47b8b..a95c67213ae 100644 --- a/dlls/opengl32/unix_thunks.c +++ b/dlls/opengl32/unix_thunks.c @@ -6493,7 +6493,7 @@ static NTSTATUS ext_glDeleteStatesNV( void *args ) return STATUS_SUCCESS; }
-NTSTATUS ext_glDeleteSync( void *args ) +static NTSTATUS ext_glDeleteSync( void *args ) { struct glDeleteSync_params *params = args; const struct opengl_funcs *funcs = params->teb->glTable; @@ -41582,6 +41582,21 @@ static NTSTATUS wow64_ext_glDeleteStatesNV( void *args ) return STATUS_SUCCESS; }
+static NTSTATUS wow64_ext_glDeleteSync( void *args ) +{ + struct + { + PTR32 teb; + PTR32 sync; + } *params = args; + TEB *teb = get_teb64( params->teb ); + pthread_mutex_lock( &wgl_lock ); + wow64_glDeleteSync( teb, ULongToPtr(params->sync) ); + pthread_mutex_unlock( &wgl_lock ); + set_context_attribute( teb, -1 /* unsupported */, NULL, 0 ); + return STATUS_SUCCESS; +} + static NTSTATUS wow64_ext_glDeleteTexturesEXT( void *args ) { struct diff --git a/dlls/opengl32/unix_thunks.h b/dlls/opengl32/unix_thunks.h index f76dbe410f9..bc30e3672b8 100644 --- a/dlls/opengl32/unix_thunks.h +++ b/dlls/opengl32/unix_thunks.h @@ -32,6 +32,7 @@ extern BOOL wrap_wglSetPbufferAttribARB( TEB *teb , HPBUFFERARB hPbuffer, const
#ifdef _WIN64 extern GLenum wow64_glClientWaitSync( TEB *teb , GLsync sync, GLbitfield flags, GLuint64 timeout ); +extern void wow64_glDeleteSync( TEB *teb , GLsync sync ); extern GLsync wow64_glFenceSync( TEB *teb , GLenum condition, GLbitfield flags ); #endif
@@ -39,8 +40,6 @@ extern NTSTATUS wgl_wglGetProcAddress( void *args ); extern NTSTATUS wow64_wgl_wglGetProcAddress( void *args ); extern NTSTATUS gl_glGetString( void *args ); extern NTSTATUS wow64_gl_glGetString( void *args ); -extern NTSTATUS ext_glDeleteSync( void *args ); -extern NTSTATUS wow64_ext_glDeleteSync( void *args ); extern NTSTATUS ext_glGetBufferPointerv( void *args ); extern NTSTATUS wow64_ext_glGetBufferPointerv( void *args ); extern NTSTATUS ext_glGetBufferPointervARB( void *args ); diff --git a/dlls/opengl32/unix_wgl.c b/dlls/opengl32/unix_wgl.c index 25c82bec6c8..54cd0bc6c88 100644 --- a/dlls/opengl32/unix_wgl.c +++ b/dlls/opengl32/unix_wgl.c @@ -1703,33 +1703,16 @@ GLenum wow64_glClientWaitSync( TEB *teb, GLsync sync, GLbitfield flags, GLuint64 return funcs->p_glClientWaitSync( handle->u.sync, flags, timeout ); }
-NTSTATUS wow64_ext_glDeleteSync( void *args ) +void wow64_glDeleteSync( TEB *teb, GLsync sync ) { + const struct opengl_funcs *funcs = teb->glTable; struct wgl_handle *handle; - struct - { - PTR32 teb; - PTR32 sync; - } *params32 = args; - NTSTATUS status;
- pthread_mutex_lock( &wgl_lock ); - - if (!(handle = get_handle_ptr( ULongToPtr(params32->sync) ))) - status = STATUS_INVALID_HANDLE; - else + if ((handle = get_handle_ptr( sync ))) { - struct glDeleteSync_params params = - { - .teb = get_teb64(params32->teb), - .sync = handle->u.sync, - }; - status = ext_glDeleteSync( ¶ms ); + funcs->p_glDeleteSync( handle->u.sync ); free_handle_ptr( handle ); } - - pthread_mutex_unlock( &wgl_lock ); - return status; }
GLsync wow64_glFenceSync( TEB *teb, GLenum condition, GLbitfield flags )
From: Jacek Caban jacek@codeweavers.com
--- dlls/opengl32/make_opengl | 2 +- dlls/opengl32/unix_thunks.c | 20 +++++++++++++++++++- dlls/opengl32/unix_thunks.h | 3 +-- dlls/opengl32/unix_wgl.c | 34 +++------------------------------- 4 files changed, 24 insertions(+), 35 deletions(-)
diff --git a/dlls/opengl32/make_opengl b/dlls/opengl32/make_opengl index fabc11665c1..78d51dea8ea 100755 --- a/dlls/opengl32/make_opengl +++ b/dlls/opengl32/make_opengl @@ -220,7 +220,6 @@ my %manual_wow64_thunks = "glGetNamedBufferPointervEXT" => 1, "glGetString" => 1, "glGetStringi" => 1, - "glGetSynciv" => 1, "glIsSync" => 1, "glMapBuffer" => 1, "glMapBufferARB" => 1, @@ -249,6 +248,7 @@ my %manual_wow64_wrappers = "glClientWaitSync" => 1, "glDeleteSync" => 1, "glFenceSync" => 1, + "glGetSynciv" => 1, ); my %pointer_array_count = ( diff --git a/dlls/opengl32/unix_thunks.c b/dlls/opengl32/unix_thunks.c index a95c67213ae..4ab92a1bcd2 100644 --- a/dlls/opengl32/unix_thunks.c +++ b/dlls/opengl32/unix_thunks.c @@ -10799,7 +10799,7 @@ static NTSTATUS ext_glGetSubroutineUniformLocation( void *args ) return STATUS_SUCCESS; }
-NTSTATUS ext_glGetSynciv( void *args ) +static NTSTATUS ext_glGetSynciv( void *args ) { struct glGetSynciv_params *params = args; const struct opengl_funcs *funcs = params->teb->glTable; @@ -49488,6 +49488,24 @@ static NTSTATUS wow64_ext_glGetSubroutineUniformLocation( void *args ) return STATUS_SUCCESS; }
+static NTSTATUS wow64_ext_glGetSynciv( void *args ) +{ + struct + { + PTR32 teb; + PTR32 sync; + GLenum pname; + GLsizei count; + PTR32 length; + PTR32 values; + } *params = args; + TEB *teb = get_teb64( params->teb ); + pthread_mutex_lock( &wgl_lock ); + wow64_glGetSynciv( teb, ULongToPtr(params->sync), params->pname, params->count, ULongToPtr(params->length), ULongToPtr(params->values) ); + pthread_mutex_unlock( &wgl_lock ); + return STATUS_SUCCESS; +} + static NTSTATUS wow64_ext_glGetTexBumpParameterfvATI( void *args ) { struct diff --git a/dlls/opengl32/unix_thunks.h b/dlls/opengl32/unix_thunks.h index bc30e3672b8..a2e4d2eca51 100644 --- a/dlls/opengl32/unix_thunks.h +++ b/dlls/opengl32/unix_thunks.h @@ -34,6 +34,7 @@ extern BOOL wrap_wglSetPbufferAttribARB( TEB *teb , HPBUFFERARB hPbuffer, const extern GLenum wow64_glClientWaitSync( TEB *teb , GLsync sync, GLbitfield flags, GLuint64 timeout ); extern void wow64_glDeleteSync( TEB *teb , GLsync sync ); extern GLsync wow64_glFenceSync( TEB *teb , GLenum condition, GLbitfield flags ); +extern void wow64_glGetSynciv( TEB *teb , GLsync sync, GLenum pname, GLsizei count, GLsizei *length, GLint *values ); #endif
extern NTSTATUS wgl_wglGetProcAddress( void *args ); @@ -50,8 +51,6 @@ extern NTSTATUS ext_glGetNamedBufferPointervEXT( void *args ); extern NTSTATUS wow64_ext_glGetNamedBufferPointervEXT( void *args ); extern NTSTATUS ext_glGetStringi( void *args ); extern NTSTATUS wow64_ext_glGetStringi( void *args ); -extern NTSTATUS ext_glGetSynciv( void *args ); -extern NTSTATUS wow64_ext_glGetSynciv( void *args ); extern NTSTATUS ext_glIsSync( void *args ); extern NTSTATUS wow64_ext_glIsSync( void *args ); extern NTSTATUS ext_glMapBuffer( void *args ); diff --git a/dlls/opengl32/unix_wgl.c b/dlls/opengl32/unix_wgl.c index 54cd0bc6c88..f66e5340163 100644 --- a/dlls/opengl32/unix_wgl.c +++ b/dlls/opengl32/unix_wgl.c @@ -1728,40 +1728,12 @@ GLsync wow64_glFenceSync( TEB *teb, GLenum condition, GLbitfield flags ) return handle; }
-NTSTATUS wow64_ext_glGetSynciv( void *args ) +void wow64_glGetSynciv( TEB *teb, GLsync sync, GLenum pname, GLsizei count, GLsizei *length, GLint *values ) { + const struct opengl_funcs *funcs = teb->glTable; struct wgl_handle *handle; - struct - { - PTR32 teb; - PTR32 sync; - GLenum pname; - GLsizei count; - PTR32 length; - PTR32 values; - } *params32 = args; - NTSTATUS status;
- pthread_mutex_lock( &wgl_lock ); - - if (!(handle = get_handle_ptr( ULongToPtr(params32->sync) ))) - status = STATUS_INVALID_HANDLE; - else - { - struct glGetSynciv_params params = - { - .teb = get_teb64(params32->teb), - .sync = handle->u.sync, - .pname = params32->pname, - .count = params32->count, - .length = ULongToPtr(params32->length), - .values = ULongToPtr(params32->values), - }; - status = ext_glGetSynciv( ¶ms ); - } - - pthread_mutex_unlock( &wgl_lock ); - return status; + if ((handle = get_handle_ptr( sync ))) funcs->p_glGetSynciv( handle->u.sync, pname, count, length, values ); }
NTSTATUS wow64_ext_glIsSync( void *args )
From: Jacek Caban jacek@codeweavers.com
--- dlls/opengl32/make_opengl | 2 +- dlls/opengl32/unix_thunks.c | 17 ++++++++++++++++- dlls/opengl32/unix_thunks.h | 3 +-- dlls/opengl32/unix_wgl.c | 29 ++++------------------------- 4 files changed, 22 insertions(+), 29 deletions(-)
diff --git a/dlls/opengl32/make_opengl b/dlls/opengl32/make_opengl index 78d51dea8ea..73a1a4cf846 100755 --- a/dlls/opengl32/make_opengl +++ b/dlls/opengl32/make_opengl @@ -220,7 +220,6 @@ my %manual_wow64_thunks = "glGetNamedBufferPointervEXT" => 1, "glGetString" => 1, "glGetStringi" => 1, - "glIsSync" => 1, "glMapBuffer" => 1, "glMapBufferARB" => 1, "glMapBufferRange" => 1, @@ -249,6 +248,7 @@ my %manual_wow64_wrappers = "glDeleteSync" => 1, "glFenceSync" => 1, "glGetSynciv" => 1, + "glIsSync" => 1, ); my %pointer_array_count = ( diff --git a/dlls/opengl32/unix_thunks.c b/dlls/opengl32/unix_thunks.c index 4ab92a1bcd2..ce0410a2414 100644 --- a/dlls/opengl32/unix_thunks.c +++ b/dlls/opengl32/unix_thunks.c @@ -12593,7 +12593,7 @@ static NTSTATUS ext_glIsStateNV( void *args ) return STATUS_SUCCESS; }
-NTSTATUS ext_glIsSync( void *args ) +static NTSTATUS ext_glIsSync( void *args ) { struct glIsSync_params *params = args; const struct opengl_funcs *funcs = params->teb->glTable; @@ -52862,6 +52862,21 @@ static NTSTATUS wow64_ext_glIsStateNV( void *args ) return STATUS_SUCCESS; }
+static NTSTATUS wow64_ext_glIsSync( void *args ) +{ + struct + { + PTR32 teb; + PTR32 sync; + GLboolean ret; + } *params = args; + TEB *teb = get_teb64( params->teb ); + pthread_mutex_lock( &wgl_lock ); + params->ret = wow64_glIsSync( teb, ULongToPtr(params->sync) ); + pthread_mutex_unlock( &wgl_lock ); + return STATUS_SUCCESS; +} + static NTSTATUS wow64_ext_glIsTextureEXT( void *args ) { struct diff --git a/dlls/opengl32/unix_thunks.h b/dlls/opengl32/unix_thunks.h index a2e4d2eca51..0e7195d6e35 100644 --- a/dlls/opengl32/unix_thunks.h +++ b/dlls/opengl32/unix_thunks.h @@ -35,6 +35,7 @@ extern GLenum wow64_glClientWaitSync( TEB *teb , GLsync sync, GLbitfield flags, extern void wow64_glDeleteSync( TEB *teb , GLsync sync ); extern GLsync wow64_glFenceSync( TEB *teb , GLenum condition, GLbitfield flags ); extern void wow64_glGetSynciv( TEB *teb , GLsync sync, GLenum pname, GLsizei count, GLsizei *length, GLint *values ); +extern GLboolean wow64_glIsSync( TEB *teb , GLsync sync ); #endif
extern NTSTATUS wgl_wglGetProcAddress( void *args ); @@ -51,8 +52,6 @@ extern NTSTATUS ext_glGetNamedBufferPointervEXT( void *args ); extern NTSTATUS wow64_ext_glGetNamedBufferPointervEXT( void *args ); extern NTSTATUS ext_glGetStringi( void *args ); extern NTSTATUS wow64_ext_glGetStringi( void *args ); -extern NTSTATUS ext_glIsSync( void *args ); -extern NTSTATUS wow64_ext_glIsSync( void *args ); extern NTSTATUS ext_glMapBuffer( void *args ); extern NTSTATUS wow64_ext_glMapBuffer( void *args ); extern NTSTATUS ext_glMapBufferARB( void *args ); diff --git a/dlls/opengl32/unix_wgl.c b/dlls/opengl32/unix_wgl.c index f66e5340163..5e196914be7 100644 --- a/dlls/opengl32/unix_wgl.c +++ b/dlls/opengl32/unix_wgl.c @@ -1736,34 +1736,13 @@ void wow64_glGetSynciv( TEB *teb, GLsync sync, GLenum pname, GLsizei count, GLsi if ((handle = get_handle_ptr( sync ))) funcs->p_glGetSynciv( handle->u.sync, pname, count, length, values ); }
-NTSTATUS wow64_ext_glIsSync( void *args ) +GLboolean wow64_glIsSync( TEB *teb, GLsync sync ) { + const struct opengl_funcs *funcs = teb->glTable; struct wgl_handle *handle; - struct - { - PTR32 teb; - PTR32 sync; - GLboolean ret; - } *params32 = args; - NTSTATUS status; - - pthread_mutex_lock( &wgl_lock ); - - if (!(handle = get_handle_ptr( ULongToPtr(params32->sync) ))) - status = STATUS_INVALID_HANDLE; - else - { - struct glIsSync_params params = - { - .teb = get_teb64(params32->teb), - .sync = handle->u.sync, - }; - status = ext_glIsSync( ¶ms ); - params32->ret = params.ret; - }
- pthread_mutex_unlock( &wgl_lock ); - return status; + if (!(handle = get_handle_ptr( sync ))) return FALSE; + return funcs->p_glIsSync( handle->u.sync ); }
NTSTATUS wow64_ext_glWaitSync( void *args )
From: Jacek Caban jacek@codeweavers.com
--- dlls/opengl32/make_opengl | 2 +- dlls/opengl32/unix_thunks.c | 19 ++++++++++++++++++- dlls/opengl32/unix_thunks.h | 3 +-- dlls/opengl32/unix_wgl.c | 30 +++--------------------------- 4 files changed, 23 insertions(+), 31 deletions(-)
diff --git a/dlls/opengl32/make_opengl b/dlls/opengl32/make_opengl index 73a1a4cf846..c8b1a865314 100755 --- a/dlls/opengl32/make_opengl +++ b/dlls/opengl32/make_opengl @@ -232,7 +232,6 @@ my %manual_wow64_thunks = "glUnmapBufferARB" => 1, "glUnmapNamedBuffer" => 1, "glUnmapNamedBufferEXT" => 1, - "glWaitSync" => 1, "wglCreatePbufferARB" => 1, "wglGetExtensionsStringARB" => 1, "wglGetExtensionsStringEXT" => 1, @@ -249,6 +248,7 @@ my %manual_wow64_wrappers = "glFenceSync" => 1, "glGetSynciv" => 1, "glIsSync" => 1, + "glWaitSync" => 1, ); my %pointer_array_count = ( diff --git a/dlls/opengl32/unix_thunks.c b/dlls/opengl32/unix_thunks.c index ce0410a2414..78bdf652b1e 100644 --- a/dlls/opengl32/unix_thunks.c +++ b/dlls/opengl32/unix_thunks.c @@ -26002,7 +26002,7 @@ static NTSTATUS ext_glWaitSemaphoreui64NVX( void *args ) return STATUS_SUCCESS; }
-NTSTATUS ext_glWaitSync( void *args ) +static NTSTATUS ext_glWaitSync( void *args ) { struct glWaitSync_params *params = args; const struct opengl_funcs *funcs = params->teb->glTable; @@ -77218,6 +77218,23 @@ static NTSTATUS wow64_ext_glWaitSemaphoreui64NVX( void *args ) return STATUS_SUCCESS; }
+static NTSTATUS wow64_ext_glWaitSync( void *args ) +{ + struct + { + PTR32 teb; + PTR32 sync; + GLbitfield flags; + GLuint64 timeout; + } *params = args; + TEB *teb = get_teb64( params->teb ); + pthread_mutex_lock( &wgl_lock ); + wow64_glWaitSync( teb, ULongToPtr(params->sync), params->flags, params->timeout ); + pthread_mutex_unlock( &wgl_lock ); + set_context_attribute( teb, -1 /* unsupported */, NULL, 0 ); + return STATUS_SUCCESS; +} + static NTSTATUS wow64_ext_glWaitVkSemaphoreNV( void *args ) { struct diff --git a/dlls/opengl32/unix_thunks.h b/dlls/opengl32/unix_thunks.h index 0e7195d6e35..76fcb67e689 100644 --- a/dlls/opengl32/unix_thunks.h +++ b/dlls/opengl32/unix_thunks.h @@ -36,6 +36,7 @@ extern void wow64_glDeleteSync( TEB *teb , GLsync sync ); extern GLsync wow64_glFenceSync( TEB *teb , GLenum condition, GLbitfield flags ); extern void wow64_glGetSynciv( TEB *teb , GLsync sync, GLenum pname, GLsizei count, GLsizei *length, GLint *values ); extern GLboolean wow64_glIsSync( TEB *teb , GLsync sync ); +extern void wow64_glWaitSync( TEB *teb , GLsync sync, GLbitfield flags, GLuint64 timeout ); #endif
extern NTSTATUS wgl_wglGetProcAddress( void *args ); @@ -76,8 +77,6 @@ extern NTSTATUS ext_glUnmapNamedBuffer( void *args ); extern NTSTATUS wow64_ext_glUnmapNamedBuffer( void *args ); extern NTSTATUS ext_glUnmapNamedBufferEXT( void *args ); extern NTSTATUS wow64_ext_glUnmapNamedBufferEXT( void *args ); -extern NTSTATUS ext_glWaitSync( void *args ); -extern NTSTATUS wow64_ext_glWaitSync( void *args ); extern NTSTATUS ext_wglCreatePbufferARB( void *args ); extern NTSTATUS wow64_ext_wglCreatePbufferARB( void *args ); extern NTSTATUS ext_wglGetExtensionsStringARB( void *args ); diff --git a/dlls/opengl32/unix_wgl.c b/dlls/opengl32/unix_wgl.c index 5e196914be7..f7eaaa54336 100644 --- a/dlls/opengl32/unix_wgl.c +++ b/dlls/opengl32/unix_wgl.c @@ -1745,36 +1745,12 @@ GLboolean wow64_glIsSync( TEB *teb, GLsync sync ) return funcs->p_glIsSync( handle->u.sync ); }
-NTSTATUS wow64_ext_glWaitSync( void *args ) +void wow64_glWaitSync( TEB *teb, GLsync sync, GLbitfield flags, GLuint64 timeout ) { + const struct opengl_funcs *funcs = teb->glTable; struct wgl_handle *handle; - struct - { - PTR32 teb; - PTR32 sync; - GLbitfield flags; - GLuint64 timeout; - } *params32 = args; - NTSTATUS status; - - pthread_mutex_lock( &wgl_lock );
- if (!(handle = get_handle_ptr( ULongToPtr(params32->sync) ))) - status = STATUS_INVALID_HANDLE; - else - { - struct glWaitSync_params params = - { - .teb = get_teb64(params32->teb), - .sync = handle->u.sync, - .flags = params32->flags, - .timeout = params32->timeout, - }; - status = ext_glWaitSync( ¶ms ); - } - - pthread_mutex_unlock( &wgl_lock ); - return status; + if ((handle = get_handle_ptr( sync ))) funcs->p_glWaitSync( handle->u.sync, flags, timeout ); }
static GLint get_buffer_param( TEB *teb, GLenum target, GLenum param )