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 )