From: Rémi Bernon <rbernon@codeweavers.com> --- dlls/opengl32/make_opengl | 1 + dlls/opengl32/thunks.c | 11 ----------- dlls/opengl32/wgl.c | 27 +++++++++++++++++++++++++++ 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/dlls/opengl32/make_opengl b/dlls/opengl32/make_opengl index 3dec39cc0f0..01dd4081ec5 100755 --- a/dlls/opengl32/make_opengl +++ b/dlls/opengl32/make_opengl @@ -172,6 +172,7 @@ my %manual_win_thunks = "wglMakeContextCurrentARB" => 1, "wglQueryCurrentRendererStringWINE" => 1, "wglQueryRendererStringWINE" => 1, + "wglShareLists" => 1, "wglSwapBuffers" => 1, ); diff --git a/dlls/opengl32/thunks.c b/dlls/opengl32/thunks.c index c62a6fdaa9f..134aecb3221 100644 --- a/dlls/opengl32/thunks.c +++ b/dlls/opengl32/thunks.c @@ -36,17 +36,6 @@ BOOL WINAPI wglSetPixelFormat( HDC hdc, int ipfd, const PIXELFORMATDESCRIPTOR *p return args.ret; } -BOOL WINAPI wglShareLists( HGLRC hrcSrvShare, HGLRC hrcSrvSource ) -{ - struct wglShareLists_params args = { .teb = NtCurrentTeb() }; - NTSTATUS status; - TRACE( "hrcSrvShare %p, hrcSrvSource %p\n", hrcSrvShare, hrcSrvSource ); - if (!get_context_from_handle( hrcSrvShare, &args.hrcSrvShare )) return 0; - if (!get_context_from_handle( hrcSrvSource, &args.hrcSrvSource )) return 0; - if ((status = UNIX_CALL( wglShareLists, &args ))) WARN( "wglShareLists returned %#lx\n", status ); - return args.ret; -} - void WINAPI glAccum( GLenum op, GLfloat value ) { struct glAccum_params args = { .teb = NtCurrentTeb(), .op = op, .value = value }; diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c index 7e56f6596a5..82387aa118f 100644 --- a/dlls/opengl32/wgl.c +++ b/dlls/opengl32/wgl.c @@ -468,6 +468,33 @@ BOOL WINAPI wglMakeContextCurrentARB( HDC draw_hdc, HDC read_hdc, HGLRC handle ) return TRUE; } +/*********************************************************************** + * wglShareLists + */ +BOOL WINAPI wglShareLists( HGLRC src_handle, HGLRC dst_handle ) +{ + struct wglShareLists_params args = { .teb = NtCurrentTeb() }; + struct context *src_context, *dst_context; + struct display_lists *lists; + NTSTATUS status; + + TRACE( "src_handle %p, dst_handle %p\n", src_handle, dst_handle ); + + if (!(src_context = context_from_handle( src_handle ))) return FALSE; + if (!(dst_context = context_from_handle( dst_handle ))) return FALSE; + + args.hrcSrvShare = &src_context->base.obj; + args.hrcSrvSource = &dst_context->base.obj; + if ((status = UNIX_CALL( wglShareLists, &args ))) WARN( "wglShareLists returned %#lx\n", status ); + if (!args.ret) return FALSE; + + lists = display_lists_acquire( src_context->lists ); + lists = InterlockedExchangePointer( (void *)&dst_context->lists, lists ); + display_lists_release( lists ); + + return TRUE; +} + /*********************************************************************** * wglGetCurrentReadDCARB * -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10870