From: Rémi Bernon <rbernon@codeweavers.com> Getting rid of now unnecessary unix-side context recreation. --- dlls/opengl32/make_opengl | 2 +- dlls/opengl32/unix_thunks.c | 33 ------------------------ dlls/opengl32/unix_thunks.h | 1 - dlls/opengl32/unix_wgl.c | 50 +++--------------------------------- dlls/opengl32/unixlib.h | 9 ------- dlls/opengl32/wgl.c | 7 ----- dlls/win32u/opengl.c | 9 ------- include/wine/opengl_driver.h | 1 - 8 files changed, 4 insertions(+), 108 deletions(-) diff --git a/dlls/opengl32/make_opengl b/dlls/opengl32/make_opengl index 9bc9c0a1746..fcca05838bf 100755 --- a/dlls/opengl32/make_opengl +++ b/dlls/opengl32/make_opengl @@ -150,6 +150,7 @@ my %manual_win_functions = "wglMakeCurrent" => 1, "wglRealizeLayerPalette" => 1, "wglSetLayerPaletteEntries" => 1, + "wglShareLists" => 1, "wglSwapLayerBuffers" => 1, "wglUseFontBitmapsA" => 1, "wglUseFontBitmapsW" => 1, @@ -176,7 +177,6 @@ my %manual_win_thunks = "wglMakeContextCurrentARB" => 1, "wglQueryCurrentRendererStringWINE" => 1, "wglQueryRendererStringWINE" => 1, - "wglShareLists" => 1, "wglSwapBuffers" => 1, ); diff --git a/dlls/opengl32/unix_thunks.c b/dlls/opengl32/unix_thunks.c index 74e1e0d5087..1d3f8a8dbd3 100644 --- a/dlls/opengl32/unix_thunks.c +++ b/dlls/opengl32/unix_thunks.c @@ -58,15 +58,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 = get_context_funcs( params->hrcSrvShare ); - if (!funcs || !funcs->p_wglShareLists) return STATUS_NOT_IMPLEMENTED; - params->ret = wrap_wglShareLists( params->teb, params->hrcSrvShare, params->hrcSrvSource ); - return STATUS_SUCCESS; -} - static NTSTATUS wgl_wglSwapBuffers( void *args ) { struct wglSwapBuffers_params *params = args; @@ -30537,7 +30528,6 @@ const unixlib_entry_t __wine_unix_call_funcs[] = wgl_wglDeleteContext, wgl_wglGetPixelFormat, wgl_wglSetPixelFormat, - wgl_wglShareLists, wgl_wglSwapBuffers, gl_glAccum, gl_glAlphaFunc, @@ -33699,22 +33689,6 @@ static NTSTATUS wow64_wgl_wglSetPixelFormat( void *args ) return STATUS_SUCCESS; } -static NTSTATUS wow64_wgl_wglShareLists( void *args ) -{ - struct - { - PTR32 teb; - PTR32 hrcSrvShare; - PTR32 hrcSrvSource; - BOOL ret; - } *params = args; - TEB *teb = get_teb64( params->teb ); - const struct opengl_funcs *funcs = get_context_funcs( ULongToPtr(params->hrcSrvShare) ); - if (!funcs || !funcs->p_wglShareLists) return STATUS_NOT_IMPLEMENTED; - params->ret = wrap_wglShareLists( teb, ULongToPtr(params->hrcSrvShare), ULongToPtr(params->hrcSrvSource) ); - return STATUS_SUCCESS; -} - static NTSTATUS wow64_wgl_wglSwapBuffers( void *args ) { struct @@ -86870,7 +86844,6 @@ const unixlib_entry_t __wine_unix_call_wow64_funcs[] = wow64_wgl_wglDeleteContext, wow64_wgl_wglGetPixelFormat, wow64_wgl_wglSetPixelFormat, - wow64_wgl_wglShareLists, wow64_wgl_wglSwapBuffers, wow64_gl_glAccum, wow64_gl_glAlphaFunc, @@ -89987,11 +89960,6 @@ static BOOL null_wglSetPixelFormat( HDC hdc, int ipfd, const PIXELFORMATDESCRIPT WARN( "unsupported\n" ); return 0; } -static BOOL null_wglShareLists( HGLRC hrcSrvShare, HGLRC hrcSrvSource ) -{ - WARN( "unsupported\n" ); - return 0; -} static BOOL null_wglSwapBuffers( HDC hdc ) { WARN( "unsupported\n" ); @@ -91356,7 +91324,6 @@ struct opengl_funcs null_opengl_funcs = .p_wglDeleteContext = null_wglDeleteContext, .p_wglGetPixelFormat = null_wglGetPixelFormat, .p_wglSetPixelFormat = null_wglSetPixelFormat, - .p_wglShareLists = null_wglShareLists, .p_wglSwapBuffers = null_wglSwapBuffers, .p_glAccum = null_glAccum, .p_glAlphaFunc = null_glAlphaFunc, diff --git a/dlls/opengl32/unix_thunks.h b/dlls/opengl32/unix_thunks.h index 77c5b81218d..bc83223cdef 100644 --- a/dlls/opengl32/unix_thunks.h +++ b/dlls/opengl32/unix_thunks.h @@ -4,7 +4,6 @@ typedef ULONG PTR32; extern BOOL wrap_wglCopyContext( TEB *teb, HGLRC hglrcSrc, HGLRC hglrcDst, UINT mask ); extern BOOL wrap_wglDeleteContext( TEB *teb, HGLRC oldContext ); -extern BOOL wrap_wglShareLists( TEB *teb, HGLRC hrcSrvShare, HGLRC hrcSrvSource ); extern BOOL wrap_wglSwapBuffers( TEB *teb, HDC hdc ); extern void wrap_glClear( TEB *teb, GLbitfield mask, PFN_glClear func ); extern void wrap_glDrawBuffer( TEB *teb, GLenum buf, PFN_glDrawBuffer func ); diff --git a/dlls/opengl32/unix_wgl.c b/dlls/opengl32/unix_wgl.c index 2abeda46196..f1c42b1b579 100644 --- a/dlls/opengl32/unix_wgl.c +++ b/dlls/opengl32/unix_wgl.c @@ -127,7 +127,6 @@ struct context struct opengl_context base; HGLRC client; /* client-side context handle */ - HGLRC share; /* context to be shared with */ int *attribs; /* creation attributes */ UINT64 debug_callback; /* client pointer */ UINT64 debug_user; /* client pointer */ @@ -439,33 +438,6 @@ static struct context *context_from_client_context( HGLRC client_context ) return base ? CONTAINING_RECORD( base, struct context, base ) : NULL; } -static struct context *get_updated_context( TEB *teb, HGLRC client_context ); - -/* update context if it has been re-shared with another one */ -static struct context *update_context( TEB *teb, HGLRC client_context, struct context *ctx ) -{ - struct opengl_client_context *client = opengl_client_context_from_client( client_context ); - const struct opengl_funcs *funcs = get_context_funcs( client_context ); - - if (client->current_tid) return ctx; /* currently in use */ - if (ctx->share == (HGLRC)-1) return ctx; /* not re-shared */ - - if (!funcs->p_context_reset( &ctx->base, ctx->attribs )) - { - WARN( "Failed to re-create context for wglShareLists\n" ); - return ctx; - } - ctx->share = (HGLRC)-1; /* initial shared context */ - copy_context_attributes( teb, client_context, ctx, client_context, ctx, ctx->used ); - return ctx; -} - -static struct context *get_updated_context( TEB *teb, HGLRC client_context ) -{ - struct context *context = context_from_client_context( client_context ); - return client_context ? update_context( teb, client_context, context ) : NULL; -} - static int *memdup_attribs( const int *attribs ) { const int *attr; @@ -854,8 +826,8 @@ const GLubyte *wrap_glGetString( TEB *teb, GLenum name, PFN_glGetString p_glGetS BOOL wrap_wglCopyContext( TEB *teb, HGLRC client_src, HGLRC client_dst, UINT mask ) { struct context *src, *dst; - if (!(src = get_updated_context( teb, client_src ))) return FALSE; - if (!(dst = get_updated_context( teb, client_dst ))) return FALSE; + if (!(src = context_from_client_context( client_src ))) return FALSE; + if (!(dst = context_from_client_context( client_dst ))) return FALSE; return copy_context_attributes( teb, client_dst, dst, client_src, src, mask ); } @@ -1306,21 +1278,6 @@ BOOL wrap_wglSwapBuffers( TEB *teb, HDC hdc ) return ret; } -BOOL wrap_wglShareLists( TEB *teb, HGLRC client_src, HGLRC client_dst ) -{ - const struct opengl_funcs *src_funcs = get_context_funcs( client_src ), *dst_funcs = get_context_funcs( client_dst ); - struct context *src, *dst; - BOOL ret = FALSE; - - if (!(src = context_from_client_context( client_src ))) return FALSE; - if (!(dst = context_from_client_context( client_dst ))) return FALSE; - if (src_funcs != dst_funcs) RtlSetLastWin32Error( ERROR_INVALID_HANDLE ); - else if ((ret = dst->used != -1)) dst->share = client_src; - else FIXME( "Unsupported attributes on context %p/%p\n", client_dst, dst ); - - return ret; -} - HGLRC wrap_wglCreateContextAttribsARB( TEB *teb, HDC hdc, HGLRC client_shared, const int *attribs, HGLRC client_context ) { const struct opengl_funcs *funcs = get_dc_funcs( hdc ); @@ -1333,7 +1290,6 @@ HGLRC wrap_wglCreateContextAttribsARB( TEB *teb, HDC hdc, HGLRC client_shared, c return 0; } context->base.client_context = client_context; - context->share = (HGLRC)-1; /* initial shared context */ context->attribs = memdup_attribs( attribs ); if (is_win64 && is_wow64()) context->buffers = acquire_buffers(); @@ -1356,7 +1312,7 @@ BOOL wrap_wglMakeContextCurrentARB( TEB *teb, HDC draw_hdc, HDC read_hdc, HGLRC if (client_context) { const struct opengl_funcs *funcs = get_context_funcs( client_context ); - if (!(ctx = get_updated_context( teb, client_context ))) return FALSE; + if (!(ctx = context_from_client_context( client_context ))) return FALSE; if (!funcs->p_wglMakeContextCurrentARB( draw_hdc, read_hdc, client_context )) return FALSE; make_context_current( teb, funcs, draw_hdc, read_hdc, client_context, ctx ); } diff --git a/dlls/opengl32/unixlib.h b/dlls/opengl32/unixlib.h index 0151d66f824..8f5f6391bbe 100644 --- a/dlls/opengl32/unixlib.h +++ b/dlls/opengl32/unixlib.h @@ -53,14 +53,6 @@ struct wglSetPixelFormat_params BOOL ret; }; -struct wglShareLists_params -{ - TEB *teb; - HGLRC hrcSrvShare; - HGLRC hrcSrvSource; - BOOL ret; -}; - struct wglSwapBuffers_params { TEB *teb; @@ -25823,7 +25815,6 @@ enum unix_funcs unix_wglDeleteContext, unix_wglGetPixelFormat, unix_wglSetPixelFormat, - unix_wglShareLists, unix_wglSwapBuffers, unix_glAccum, unix_glAlphaFunc, diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c index a66400c23f1..d7a8877d855 100644 --- a/dlls/opengl32/wgl.c +++ b/dlls/opengl32/wgl.c @@ -990,10 +990,8 @@ BOOL WINAPI wglMakeContextCurrentARB( HDC draw_hdc, HDC read_hdc, HGLRC handle ) */ 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 ); @@ -1001,11 +999,6 @@ BOOL WINAPI wglShareLists( HGLRC src_handle, HGLRC dst_handle ) if (!(dst_context = context_from_handle( dst_handle ))) return FALSE; if (ReadNoFence( &dst_context->lists->modified )) 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 ); diff --git a/dlls/win32u/opengl.c b/dlls/win32u/opengl.c index feaad7ffda9..687ff2f2ed1 100644 --- a/dlls/win32u/opengl.c +++ b/dlls/win32u/opengl.c @@ -2352,14 +2352,6 @@ static BOOL win32u_context_destroy( struct opengl_context *context ) return TRUE; } -static BOOL win32u_context_reset( struct opengl_context *context, const int *attribs ) -{ - TRACE( "context %p, attribs %p\n", context, attribs ); - - if (!win32u_context_destroy( context )) return FALSE; - return driver_funcs->p_context_create( context->format, global_context, attribs, &context->driver_private ); -} - static BOOL flush_memory_pbuffer( void (*flush)(void) ) { HDC draw_hdc = NtCurrentTeb()->glReserved1[0], read_hdc = NtCurrentTeb()->glReserved1[1]; @@ -2756,7 +2748,6 @@ static void display_funcs_init(void) display_funcs.p_context_flush = win32u_context_flush; display_funcs.p_context_create = win32u_context_create; display_funcs.p_context_destroy = win32u_context_destroy; - display_funcs.p_context_reset = win32u_context_reset; global_extensions[WGL_ARB_multisample] = 1; diff --git a/include/wine/opengl_driver.h b/include/wine/opengl_driver.h index 7c138d37e64..cf271fbd411 100644 --- a/include/wine/opengl_driver.h +++ b/include/wine/opengl_driver.h @@ -148,7 +148,6 @@ struct opengl_funcs BOOL (*p_context_flush)( struct opengl_context *context, void (*flush)(void), UINT flags ); BOOL (*p_context_create)( struct opengl_context *context, HDC hdc, const int *attribs ); BOOL (*p_context_destroy)( struct opengl_context *context ); - BOOL (*p_context_reset)( struct opengl_context *context, const int *attribs ); BOOL (*p_pbuffer_create)( HDC hdc, int format, int width, int height, const int *attribs, HPBUFFERARB client_pbuffer ); void *egl_handle; }; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11161