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 )