From: Rémi Bernon <rbernon@codeweavers.com> --- dlls/opengl32/unix_wgl.c | 7 ++++ dlls/opengl32/wgl.c | 58 ++++++++++++------------- dlls/win32u/opengl.c | 79 +++++++++++++---------------------- dlls/wineandroid.drv/opengl.c | 6 +-- dlls/winemac.drv/opengl.c | 33 +++++---------- dlls/winewayland.drv/opengl.c | 2 +- dlls/winex11.drv/opengl.c | 39 ++++++----------- include/wine/opengl_driver.h | 5 ++- 8 files changed, 93 insertions(+), 136 deletions(-) diff --git a/dlls/opengl32/unix_wgl.c b/dlls/opengl32/unix_wgl.c index 5e9f6c3f0bf..2e4b6359096 100644 --- a/dlls/opengl32/unix_wgl.c +++ b/dlls/opengl32/unix_wgl.c @@ -1214,6 +1214,7 @@ static void make_context_current( TEB *teb, const struct opengl_funcs *funcs, HD { static pthread_once_t once = PTHREAD_ONCE_INIT; + struct opengl_client_context *client = opengl_client_context_from_client( ctx->base.client_context ); DWORD tid = HandleToULong(teb->ClientId.UniqueThread); size_t size = ARRAYSIZE(legacy_extensions) - 1, count = 0; const char *version, *rest = "", **extensions; @@ -1236,6 +1237,12 @@ static void make_context_current( TEB *teb, const struct opengl_funcs *funcs, HD if (!ctx->major_version) ctx->major_version = 1; TRACE( "context %p version %d.%d\n", ctx, ctx->major_version, ctx->minor_version ); + funcs->p_init_extensions( &ctx->base.extensions ); + +#define USE_GL_EXT(x) if (enabled_extensions.has_ ## x) client->extensions.has_ ## x = ctx->base.extensions.has_ ## x; + ALL_WGL_EXTS +#undef USE_GL_EXT + if (funcs->p_glImportMemoryWin32HandleEXT) size++; if (funcs->p_glImportSemaphoreWin32HandleEXT) size++; diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c index 9999bbdae2f..e098a64166b 100644 --- a/dlls/opengl32/wgl.c +++ b/dlls/opengl32/wgl.c @@ -242,6 +242,7 @@ struct context { struct opengl_client_context base; struct handle_table syncs; + char *wgl_extensions; }; static struct context *context_from_opengl_client_context( struct opengl_client_context *base ) @@ -287,6 +288,7 @@ static void free_client_context( struct handle_entry *ptr ) { struct context *context = context_from_opengl_client_context( ptr->context ); free_handle( &contexts, ptr ); + free( context->wgl_extensions ); free( context ); } @@ -2041,46 +2043,38 @@ const GLubyte * WINAPI glGetString( GLenum name ) return args.ret; } -const char * WINAPI wglGetExtensionsStringARB( HDC hdc ) +const char *get_extensions_string(void) { - struct wglGetExtensionsStringARB_params args = { .teb = NtCurrentTeb(), .hdc = hdc }; - NTSTATUS status; -#ifndef _WIN64 - char *wow64_str = NULL; -#endif + struct context *ctx; - TRACE( "hdc %p\n", hdc ); + if (!(ctx = context_from_handle( NtCurrentTeb()->glCurrentRC ))) return NULL; -#ifndef _WIN64 - if (UNIX_CALL( wglGetExtensionsStringARB, &args ) == STATUS_BUFFER_TOO_SMALL) args.ret = wow64_str = malloc( (size_t)args.ret ); -#endif - if ((status = UNIX_CALL( wglGetExtensionsStringARB, &args ))) WARN( "wglGetExtensionsStringARB returned %#lx\n", status ); -#ifndef _WIN64 - if (args.ret != wow64_str) free( wow64_str ); - else if (args.ret) append_wow64_string( wow64_str ); -#endif - return args.ret; + if (!ctx->wgl_extensions) + { +#define USE_GL_EXT(x) + (ctx->base.extensions.has_ ## x ? sizeof(#x) : 0) + UINT pos = 0, len = 0 ALL_WGL_EXTS; +#undef USE_GL_EXT + + if (!(ctx->wgl_extensions = malloc( len + 1 ))) return NULL; +#define USE_GL_EXT(x) if (ctx->base.extensions.has_ ## x) pos += sprintf( ctx->wgl_extensions + pos, "%s ", #x ); + ALL_WGL_EXTS +#undef USE_GL_EXT + ctx->wgl_extensions[pos - 1] = 0; + } + + return ctx->wgl_extensions; } -const char * WINAPI wglGetExtensionsStringEXT(void) +const char * WINAPI wglGetExtensionsStringARB( HDC hdc ) { - struct wglGetExtensionsStringEXT_params args = { .teb = NtCurrentTeb() }; - NTSTATUS status; -#ifndef _WIN64 - char *wow64_str = NULL; -#endif + TRACE( "hdc %p\n", hdc ); + return get_extensions_string(); +} +const char * WINAPI wglGetExtensionsStringEXT(void) +{ TRACE( "\n" ); - -#ifndef _WIN64 - if (UNIX_CALL( wglGetExtensionsStringEXT, &args ) == STATUS_BUFFER_TOO_SMALL) args.ret = wow64_str = malloc( (size_t)args.ret ); -#endif - if ((status = UNIX_CALL( wglGetExtensionsStringEXT, &args ))) WARN( "wglGetExtensionsStringEXT returned %#lx\n", status ); -#ifndef _WIN64 - if (args.ret != wow64_str) free( wow64_str ); - else if (args.ret) append_wow64_string( wow64_str ); -#endif - return args.ret; + return get_extensions_string(); } const GLchar * WINAPI wglQueryCurrentRendererStringWINE( GLenum attribute ) diff --git a/dlls/win32u/opengl.c b/dlls/win32u/opengl.c index e655b034cfe..764b33103be 100644 --- a/dlls/win32u/opengl.c +++ b/dlls/win32u/opengl.c @@ -64,9 +64,9 @@ static struct list devices_egl = LIST_INIT( devices_egl ); static struct egl_platform display_egl; static struct opengl_funcs display_funcs; +static struct opengl_extensions global_extensions; static struct wgl_pixel_format *pixel_formats; static UINT formats_count, onscreen_count; -static char wgl_extensions[4096]; static BOOL has_extension( const char *list, const char *ext ) { @@ -99,17 +99,6 @@ static void dump_extensions( const char *list ) TRACE( "%s\n", start ); } -static void register_extension( char *list, size_t size, const char *name ) -{ - if (!has_extension( list, name )) - { - size_t len = strlen( list ); - assert( size - len >= strlen( name ) + 1 ); - if (*list) strcat( list + len, " " ); - strcat( list + len, name ); - } -} - void *opengl_drawable_create( UINT size, const struct opengl_drawable_funcs *funcs, int format, struct client_surface *client ) { struct opengl_drawable *drawable; @@ -652,9 +641,8 @@ static BOOL egldrv_describe_pixel_format( int format, struct wgl_pixel_format *d return describe_egl_config( egl->configs[format % count], desc, pixel_format_flags[format / count] ); } -static const char *egldrv_init_wgl_extensions( struct opengl_funcs *funcs ) +static void egldrv_init_extensions( struct opengl_funcs *funcs, struct opengl_extensions *extensions ) { - return ""; } static BOOL egldrv_surface_create( HWND hwnd, int format, struct opengl_drawable **drawable ) @@ -863,7 +851,7 @@ static const struct opengl_driver_funcs egldrv_funcs = .p_get_proc_address = egldrv_get_proc_address, .p_init_pixel_formats = egldrv_init_pixel_formats, .p_describe_pixel_format = egldrv_describe_pixel_format, - .p_init_wgl_extensions = egldrv_init_wgl_extensions, + .p_init_extensions = egldrv_init_extensions, .p_surface_create = egldrv_surface_create, .p_pbuffer_create = egldrv_pbuffer_create, .p_pbuffer_updated = egldrv_pbuffer_updated, @@ -1258,9 +1246,8 @@ static BOOL nulldrv_describe_pixel_format( int format, struct wgl_pixel_format * return TRUE; } -static const char *nulldrv_init_wgl_extensions( struct opengl_funcs *funcs ) +static void nulldrv_init_extensions( struct opengl_funcs *funcs, struct opengl_extensions *extensions ) { - return ""; } static BOOL nulldrv_surface_create( HWND hwnd, int format, struct opengl_drawable **drawable ) @@ -1304,7 +1291,7 @@ static const struct opengl_driver_funcs nulldrv_funcs = .p_get_proc_address = nulldrv_get_proc_address, .p_init_pixel_formats = nulldrv_init_pixel_formats, .p_describe_pixel_format = nulldrv_describe_pixel_format, - .p_init_wgl_extensions = nulldrv_init_wgl_extensions, + .p_init_extensions = nulldrv_init_extensions, .p_surface_create = nulldrv_surface_create, .p_pbuffer_create = nulldrv_pbuffer_create, .p_pbuffer_updated = nulldrv_pbuffer_updated, @@ -1314,20 +1301,6 @@ static const struct opengl_driver_funcs nulldrv_funcs = .p_make_current = nulldrv_make_current, }; -static const char *win32u_wglGetExtensionsStringARB( HDC hdc ) -{ - TRACE( "hdc %p\n", hdc ); - if (TRACE_ON(wgl)) dump_extensions( wgl_extensions ); - return wgl_extensions; -} - -static const char *win32u_wglGetExtensionsStringEXT(void) -{ - TRACE( "\n" ); - if (TRACE_ON(wgl)) dump_extensions( wgl_extensions ); - return wgl_extensions; -} - static int win32u_wglGetPixelFormat( HDC hdc ) { BOOL is_display = is_dc_display( hdc ); @@ -1741,6 +1714,11 @@ static PROC win32u_wglGetProcAddress( const char *name ) return ret; } +static void win32u_init_extensions( struct opengl_extensions *extensions ) +{ + *extensions = global_extensions; +} + static void win32u_get_pixel_formats( struct wgl_pixel_format *formats, UINT max_formats, UINT *num_formats, UINT *num_onscreen_formats ) { @@ -2691,9 +2669,10 @@ static void display_funcs_init(void) #undef USE_GL_FUNC display_funcs.p_wglGetProcAddress = win32u_wglGetProcAddress; + display_funcs.p_init_extensions = win32u_init_extensions; display_funcs.p_get_pixel_formats = win32u_get_pixel_formats; - strcpy( wgl_extensions, driver_funcs->p_init_wgl_extensions( &display_funcs ) ); + driver_funcs->p_init_extensions( &display_funcs, &global_extensions ); display_funcs.p_wglGetPixelFormat = win32u_wglGetPixelFormat; display_funcs.p_wglSetPixelFormat = win32u_wglSetPixelFormat; @@ -2707,52 +2686,52 @@ static void display_funcs_init(void) display_funcs.p_context_reset = win32u_context_reset; display_funcs.p_context_flush = win32u_context_flush; - register_extension( wgl_extensions, ARRAY_SIZE(wgl_extensions), "WGL_ARB_pixel_format" ); + global_extensions.has_WGL_ARB_pixel_format = 1; display_funcs.p_wglChoosePixelFormatARB = (void *)1; /* never called */ display_funcs.p_wglGetPixelFormatAttribfvARB = (void *)1; /* never called */ display_funcs.p_wglGetPixelFormatAttribivARB = (void *)1; /* never called */ if (display_egl.has_EGL_EXT_pixel_format_float) { - register_extension( wgl_extensions, ARRAY_SIZE(wgl_extensions), "WGL_ARB_pixel_format_float" ); - register_extension( wgl_extensions, ARRAY_SIZE(wgl_extensions), "WGL_ATI_pixel_format_float" ); + global_extensions.has_WGL_ARB_pixel_format_float = 1; + global_extensions.has_WGL_ATI_pixel_format_float = 1; } - register_extension( wgl_extensions, ARRAY_SIZE(wgl_extensions), "WGL_ARB_extensions_string" ); - display_funcs.p_wglGetExtensionsStringARB = win32u_wglGetExtensionsStringARB; + global_extensions.has_WGL_ARB_extensions_string = 1; + display_funcs.p_wglGetExtensionsStringARB = (void *)1 /* never called */; - register_extension( wgl_extensions, ARRAY_SIZE(wgl_extensions), "WGL_EXT_extensions_string" ); - display_funcs.p_wglGetExtensionsStringEXT = win32u_wglGetExtensionsStringEXT; + global_extensions.has_WGL_EXT_extensions_string = 1; + display_funcs.p_wglGetExtensionsStringEXT = (void *)1 /* never called */; /* In WineD3D we need the ability to set the pixel format more than once (e.g. after a device reset). * The default wglSetPixelFormat doesn't allow this, so add our own which allows it. */ - register_extension( wgl_extensions, ARRAY_SIZE(wgl_extensions), "WGL_WINE_pixel_format_passthrough" ); + global_extensions.has_WGL_WINE_pixel_format_passthrough = 1; display_funcs.p_wglSetPixelFormatWINE = win32u_wglSetPixelFormatWINE; - register_extension( wgl_extensions, ARRAY_SIZE(wgl_extensions), "WGL_ARB_create_context" ); - register_extension( wgl_extensions, ARRAY_SIZE(wgl_extensions), "WGL_ARB_create_context_no_error" ); - register_extension( wgl_extensions, ARRAY_SIZE(wgl_extensions), "WGL_ARB_create_context_profile" ); + global_extensions.has_WGL_ARB_create_context = 1; + global_extensions.has_WGL_ARB_create_context_no_error = 1; + global_extensions.has_WGL_ARB_create_context_profile = 1; display_funcs.p_wglCreateContextAttribsARB = (void *)1; /* never called */ - register_extension( wgl_extensions, ARRAY_SIZE(wgl_extensions), "WGL_ARB_make_current_read" ); + global_extensions.has_WGL_ARB_make_current_read = 1; display_funcs.p_wglGetCurrentReadDCARB = (void *)1; /* never called */ display_funcs.p_wglMakeContextCurrentARB = win32u_wglMakeContextCurrentARB; - register_extension( wgl_extensions, ARRAY_SIZE(wgl_extensions), "WGL_ARB_pbuffer" ); + global_extensions.has_WGL_ARB_pbuffer = 1; display_funcs.p_wglCreatePbufferARB = win32u_wglCreatePbufferARB; display_funcs.p_wglDestroyPbufferARB = win32u_wglDestroyPbufferARB; display_funcs.p_wglGetPbufferDCARB = win32u_wglGetPbufferDCARB; display_funcs.p_wglReleasePbufferDCARB = win32u_wglReleasePbufferDCARB; display_funcs.p_wglQueryPbufferARB = win32u_wglQueryPbufferARB; - register_extension( wgl_extensions, ARRAY_SIZE(wgl_extensions), "WGL_ARB_render_texture" ); + global_extensions.has_WGL_ARB_render_texture = 1; display_funcs.p_wglBindTexImageARB = win32u_wglBindTexImageARB; display_funcs.p_wglReleaseTexImageARB = win32u_wglReleaseTexImageARB; display_funcs.p_wglSetPbufferAttribARB = win32u_wglSetPbufferAttribARB; - register_extension( wgl_extensions, ARRAY_SIZE(wgl_extensions), "WGL_EXT_swap_control" ); - register_extension( wgl_extensions, ARRAY_SIZE(wgl_extensions), "WGL_EXT_swap_control_tear" ); + global_extensions.has_WGL_EXT_swap_control = 1; + global_extensions.has_WGL_EXT_swap_control_tear = 1; display_funcs.p_wglSwapIntervalEXT = win32u_wglSwapIntervalEXT; display_funcs.p_wglGetSwapIntervalEXT = win32u_wglGetSwapIntervalEXT; @@ -2769,7 +2748,7 @@ static void display_funcs_init(void) if (!list_empty( &devices_egl )) { - register_extension( wgl_extensions, ARRAY_SIZE(wgl_extensions), "WGL_WINE_query_renderer" ); + global_extensions.has_WGL_WINE_query_renderer = 1; display_funcs.p_query_renderer = win32u_query_renderer; display_funcs.p_wglQueryCurrentRendererIntegerWINE = win32u_wglQueryCurrentRendererIntegerWINE; display_funcs.p_wglQueryCurrentRendererStringWINE = win32u_wglQueryCurrentRendererStringWINE; diff --git a/dlls/wineandroid.drv/opengl.c b/dlls/wineandroid.drv/opengl.c index 1efd312b940..35ad091e91f 100644 --- a/dlls/wineandroid.drv/opengl.c +++ b/dlls/wineandroid.drv/opengl.c @@ -157,16 +157,16 @@ static void android_drawable_flush( struct opengl_drawable *base, UINT flags ) if (flags & GL_FLUSH_INTERVAL) funcs->p_eglSwapInterval( egl->display, abs( base->interval ) ); } -static const char *android_init_wgl_extensions( struct opengl_funcs *funcs ) +static void android_init_extensions( struct opengl_funcs *funcs, struct opengl_extensions *extensions ) { - return "WGL_EXT_framebuffer_sRGB"; + extensions->has_WGL_EXT_framebuffer_sRGB = 1; } static struct opengl_driver_funcs android_driver_funcs = { .p_init_egl_platform = android_init_egl_platform, .p_get_proc_address = android_get_proc_address, - .p_init_wgl_extensions = android_init_wgl_extensions, + .p_init_extensions = android_init_extensions, .p_surface_create = android_surface_create, }; diff --git a/dlls/winemac.drv/opengl.c b/dlls/winemac.drv/opengl.c index e60fc04a82e..b7226bb07a4 100644 --- a/dlls/winemac.drv/opengl.c +++ b/dlls/winemac.drv/opengl.c @@ -46,8 +46,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(wgl); struct gl_info { char *glExtensions; - char wglExtensions[4096]; - GLint max_viewport_dims[2]; unsigned int max_major, max_minor; @@ -2537,16 +2535,7 @@ static BOOL macdrv_pbuffer_updated(HDC hdc, struct opengl_drawable *base, GLenum return GL_TRUE; } -static void register_extension(const char *ext) -{ - if (gl_info.wglExtensions[0]) - strcat(gl_info.wglExtensions, " "); - strcat(gl_info.wglExtensions, ext); - - TRACE("'%s'\n", ext); -} - -static const char *macdrv_init_wgl_extensions(struct opengl_funcs *funcs) +static void macdrv_init_extensions(struct opengl_funcs *funcs, struct opengl_extensions *extensions) { /* * ARB Extensions @@ -2554,42 +2543,40 @@ static const char *macdrv_init_wgl_extensions(struct opengl_funcs *funcs) if (gluCheckExtension((GLubyte*)"GL_ARB_color_buffer_float", (GLubyte*)gl_info.glExtensions)) { - register_extension("WGL_ARB_pixel_format_float"); - register_extension("WGL_ATI_pixel_format_float"); + extensions->has_WGL_ARB_pixel_format_float = 1; + extensions->has_WGL_ATI_pixel_format_float = 1; } if (gluCheckExtension((GLubyte*)"GL_ARB_multisample", (GLubyte*)gl_info.glExtensions)) - register_extension("WGL_ARB_multisample"); + extensions->has_WGL_ARB_multisample = 1; if (gluCheckExtension((GLubyte*)"GL_ARB_framebuffer_sRGB", (GLubyte*)gl_info.glExtensions)) - register_extension("WGL_ARB_framebuffer_sRGB"); + extensions->has_WGL_ARB_framebuffer_sRGB = 1; if (gluCheckExtension((GLubyte*)"GL_APPLE_pixel_buffer", (GLubyte*)gl_info.glExtensions)) { if (gluCheckExtension((GLubyte*)"GL_ARB_texture_rectangle", (GLubyte*)gl_info.glExtensions) || gluCheckExtension((GLubyte*)"GL_EXT_texture_rectangle", (GLubyte*)gl_info.glExtensions)) - register_extension("WGL_NV_render_texture_rectangle"); + extensions->has_WGL_NV_render_texture_rectangle = 1; } /* Presumably identical to [W]GL_ARB_framebuffer_sRGB, above, but clients may check for either, so register them separately. */ if (gluCheckExtension((GLubyte*)"GL_EXT_framebuffer_sRGB", (GLubyte*)gl_info.glExtensions)) - register_extension("WGL_EXT_framebuffer_sRGB"); + extensions->has_WGL_EXT_framebuffer_sRGB = 1; if (gluCheckExtension((GLubyte*)"GL_EXT_packed_float", (GLubyte*)gl_info.glExtensions)) - register_extension("WGL_EXT_pixel_format_packed_float"); + extensions->has_WGL_EXT_pixel_format_packed_float = 1; /* * WINE-specific WGL Extensions */ - register_extension("WGL_WINE_query_renderer"); + extensions->has_WGL_WINE_query_renderer = 1; funcs->p_wglQueryCurrentRendererIntegerWINE = macdrv_wglQueryCurrentRendererIntegerWINE; funcs->p_wglQueryCurrentRendererStringWINE = macdrv_wglQueryCurrentRendererStringWINE; funcs->p_wglQueryRendererIntegerWINE = macdrv_wglQueryRendererIntegerWINE; funcs->p_wglQueryRendererStringWINE = macdrv_wglQueryRendererStringWINE; - - return gl_info.wglExtensions; } /********************************************************************** @@ -2769,7 +2756,7 @@ static const struct opengl_driver_funcs macdrv_driver_funcs = .p_get_proc_address = macdrv_get_proc_address, .p_init_pixel_formats = macdrv_init_pixel_formats, .p_describe_pixel_format = macdrv_describe_pixel_format, - .p_init_wgl_extensions = macdrv_init_wgl_extensions, + .p_init_extensions = macdrv_init_extensions, .p_surface_create = macdrv_surface_create, .p_context_create = macdrv_context_create, .p_context_destroy = macdrv_context_destroy, diff --git a/dlls/winewayland.drv/opengl.c b/dlls/winewayland.drv/opengl.c index 9a4b14ec7d9..0e78259f3c1 100644 --- a/dlls/winewayland.drv/opengl.c +++ b/dlls/winewayland.drv/opengl.c @@ -259,7 +259,7 @@ UINT WAYLAND_OpenGLInit(UINT version, const struct opengl_funcs *opengl_funcs, c wayland_driver_funcs.p_get_proc_address = (*driver_funcs)->p_get_proc_address; wayland_driver_funcs.p_init_pixel_formats = (*driver_funcs)->p_init_pixel_formats; wayland_driver_funcs.p_describe_pixel_format = (*driver_funcs)->p_describe_pixel_format; - wayland_driver_funcs.p_init_wgl_extensions = (*driver_funcs)->p_init_wgl_extensions; + wayland_driver_funcs.p_init_extensions = (*driver_funcs)->p_init_extensions; wayland_driver_funcs.p_context_create = (*driver_funcs)->p_context_create; wayland_driver_funcs.p_context_destroy = (*driver_funcs)->p_context_destroy; wayland_driver_funcs.p_make_current = (*driver_funcs)->p_make_current; diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index 01eb3b9c356..6c4a5f08994 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -181,7 +181,6 @@ typedef XID GLXPbuffer; static const char *glExtensions; static const char *glxExtensions; -static char wglExtensions[4096]; static int glxVersion[2]; static int glx_opcode; @@ -1376,29 +1375,19 @@ static BOOL glxRequireVersion(int requiredVersion) return (requiredVersion <= glxVersion[1]); } -static void register_extension(const char *ext) +static void x11drv_init_extensions( struct opengl_funcs *funcs, struct opengl_extensions *extensions ) { - if (wglExtensions[0]) - strcat(wglExtensions, " "); - strcat(wglExtensions, ext); - - TRACE("'%s'\n", ext); -} - -static const char *x11drv_init_wgl_extensions( struct opengl_funcs *funcs ) -{ - wglExtensions[0] = 0; - /* ARB Extensions */ - if (has_extension( glxExtensions, "GLX_ARB_multisample")) register_extension( "WGL_ARB_multisample" ); + if (has_extension( glxExtensions, "GLX_ARB_multisample")) + extensions->has_WGL_ARB_multisample = 1; - register_extension("WGL_ARB_pixel_format"); + extensions->has_WGL_ARB_pixel_format = 1; if (has_extension( glxExtensions, "GLX_ARB_fbconfig_float")) { - register_extension("WGL_ARB_pixel_format_float"); - register_extension("WGL_ATI_pixel_format_float"); + extensions->has_WGL_ARB_pixel_format_float = 1; + extensions->has_WGL_ATI_pixel_format_float = 1; } /* Support WGL_ARB_render_texture when there's support or pbuffer based emulation */ @@ -1406,20 +1395,20 @@ static const char *x11drv_init_wgl_extensions( struct opengl_funcs *funcs ) { /* The WGL version of GLX_NV_float_buffer requires render_texture */ if (has_extension( glxExtensions, "GLX_NV_float_buffer")) - register_extension("WGL_NV_float_buffer"); + extensions->has_WGL_NV_float_buffer = 1; /* Again there's no GLX equivalent for this extension, so depend on the required GL extension */ if (has_extension(glExtensions, "GL_NV_texture_rectangle")) - register_extension("WGL_NV_render_texture_rectangle"); + extensions->has_WGL_NV_render_texture_rectangle = 1; } /* EXT Extensions */ if (has_extension( glxExtensions, "GLX_EXT_framebuffer_sRGB")) - register_extension("WGL_EXT_framebuffer_sRGB"); + extensions->has_WGL_EXT_framebuffer_sRGB = 1; if (has_extension( glxExtensions, "GLX_EXT_fbconfig_packed_float")) - register_extension("WGL_EXT_pixel_format_packed_float"); + extensions->has_WGL_EXT_pixel_format_packed_float = 1; if (has_extension( glxExtensions, "GLX_EXT_swap_control")) { @@ -1438,7 +1427,7 @@ static const char *x11drv_init_wgl_extensions( struct opengl_funcs *funcs ) /* The OpenGL extension GL_NV_vertex_array_range adds wgl/glX functions which aren't exported as 'real' wgl/glX extensions. */ if (has_extension(glExtensions, "GL_NV_vertex_array_range")) { - register_extension( "WGL_NV_vertex_array_range" ); + extensions->has_WGL_NV_vertex_array_range = 1; funcs->p_wglAllocateMemoryNV = pglXAllocateMemoryNV; funcs->p_wglFreeMemoryNV = pglXFreeMemoryNV; } @@ -1450,14 +1439,12 @@ static const char *x11drv_init_wgl_extensions( struct opengl_funcs *funcs ) if (has_extension( glxExtensions, "GLX_MESA_query_renderer" )) { - register_extension( "WGL_WINE_query_renderer" ); + extensions->has_WGL_WINE_query_renderer = 1; funcs->p_wglQueryCurrentRendererIntegerWINE = X11DRV_wglQueryCurrentRendererIntegerWINE; funcs->p_wglQueryCurrentRendererStringWINE = X11DRV_wglQueryCurrentRendererStringWINE; funcs->p_wglQueryRendererIntegerWINE = X11DRV_wglQueryRendererIntegerWINE; funcs->p_wglQueryRendererStringWINE = X11DRV_wglQueryRendererStringWINE; } - - return wglExtensions; } static BOOL x11drv_surface_swap( struct opengl_drawable *base ) @@ -1525,7 +1512,7 @@ static struct opengl_driver_funcs x11drv_driver_funcs = .p_get_proc_address = x11drv_get_proc_address, .p_init_pixel_formats = x11drv_init_pixel_formats, .p_describe_pixel_format = x11drv_describe_pixel_format, - .p_init_wgl_extensions = x11drv_init_wgl_extensions, + .p_init_extensions = x11drv_init_extensions, .p_surface_create = x11drv_surface_create, .p_context_create = x11drv_context_create, .p_context_destroy = x11drv_context_destroy, diff --git a/include/wine/opengl_driver.h b/include/wine/opengl_driver.h index 70cc22f63a9..4bfaaa46c42 100644 --- a/include/wine/opengl_driver.h +++ b/include/wine/opengl_driver.h @@ -75,6 +75,7 @@ struct opengl_client_context UINT64 unix_handle; UINT64 unix_funcs; GLenum last_error; + struct opengl_extensions extensions; /* exposed client extensions */ }; static inline struct opengl_client_context *opengl_client_context_from_client( HGLRC client_context ) @@ -114,6 +115,7 @@ struct opengl_context HGLRC client_context; /* client side context pointer */ void *driver_private; /* driver context / private data */ void *internal_context; /* driver context for win32u internal use */ + struct opengl_extensions extensions; /* available host extensions */ int format; /* pixel format of the context */ struct opengl_drawable *draw; /* currently bound draw surface */ struct opengl_drawable *read; /* currently bound read surface */ @@ -136,6 +138,7 @@ struct opengl_funcs ALL_GL_FUNCS ALL_GL_EXT_FUNCS #undef USE_GL_FUNC + void (*p_init_extensions)( struct opengl_extensions *extensions ); void (*p_get_pixel_formats)( struct wgl_pixel_format *formats, UINT max_formats, UINT *num_formats, UINT *num_onscreen_formats ); BOOL (*p_query_renderer)( UINT attribute, void *value ); BOOL (*p_context_flush)( struct opengl_context *context, void (*flush)(void), UINT flags ); @@ -226,7 +229,7 @@ struct opengl_driver_funcs void *(*p_get_proc_address)(const char *); UINT (*p_init_pixel_formats)(UINT*); BOOL (*p_describe_pixel_format)(int,struct wgl_pixel_format*); - const char *(*p_init_wgl_extensions)(struct opengl_funcs *funcs); + void (*p_init_extensions)( struct opengl_funcs *funcs, struct opengl_extensions *extensions ); BOOL (*p_surface_create)( HWND hwnd, int format, struct opengl_drawable **drawable ); BOOL (*p_context_create)( int format, void *share, const int *attribs, void **context ); BOOL (*p_context_destroy)(void*); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9982