From: Rémi Bernon rbernon@codeweavers.com
--- .gitattributes | 2 - dlls/opengl32/make_opengl | 83 ------------------- dlls/opengl32/unix_private.h | 5 +- dlls/opengl32/wgl.c | 2 +- dlls/win32u/opengl.c | 9 +- dlls/wineandroid.drv/opengl.c | 9 +- dlls/winemac.drv/opengl.c | 7 +- dlls/winewayland.drv/opengl.c | 7 +- dlls/winex11.drv/opengl.c | 7 +- include/Makefile.in | 2 +- .../wine/{wgl_driver.h => opengl_driver.h} | 44 ++++++++-- 11 files changed, 56 insertions(+), 121 deletions(-) rename include/wine/{wgl_driver.h => opengl_driver.h} (78%)
diff --git a/.gitattributes b/.gitattributes index 8677ddb299f..b2a904cf5e6 100644 --- a/.gitattributes +++ b/.gitattributes @@ -20,7 +20,6 @@ dlls/opengl32/thunks.c generated dlls/opengl32/unix_thunks.c generated dlls/opengl32/unixlib.h generated include/wine/wgl.h generated -include/wine/wgl_driver.h generated
# generated by dlls/winevulkan/make_vulkan dlls/vulkan-1/vulkan-1.spec generated @@ -31,7 +30,6 @@ dlls/winevulkan/vulkan_thunks.h generated dlls/winevulkan/winevulkan.json generated dlls/winevulkan/winevulkan.spec generated include/wine/vulkan.h generated -include/wine/vulkan_driver.h generated
# generated by tools/make_requests include/wine/server_protocol.h generated diff --git a/dlls/opengl32/make_opengl b/dlls/opengl32/make_opengl index ee6aed1b554..97bd5dbfc3a 100755 --- a/dlls/opengl32/make_opengl +++ b/dlls/opengl32/make_opengl @@ -51,7 +51,6 @@ use File::Basename; # Files to generate # my $spec_file = "opengl32.spec"; -my $wgl_driver_file = "../../include/wine/wgl_driver.h"; my $wgl_file = "../../include/wine/wgl.h";
# If set to 1, generate TRACEs for each OpenGL function @@ -858,88 +857,6 @@ parse_file( "$cache/gl-$commit.xml" ); parse_file( "$cache/wgl-$commit.xml" ); parse_file( "winegl.xml" );
-# -# Get the current wgl_driver.h version -# -my $wgl_version = 0; -open HEADER, "<$wgl_driver_file" or die "cannot open $wgl_driver_file"; -while (<HEADER>) -{ - next unless /^#define WINE_WGL_DRIVER_VERSION (\d+)/; - $wgl_version = $1; - last; -} -close HEADER; - -# -# Generate the wgl_driver.h file -# -open HEADER, ">$wgl_driver_file" or die "cannot create $wgl_driver_file"; -print HEADER "/* Automatically generated from http://www.opengl.org/registry files; DO NOT EDIT! */\n\n"; -print HEADER "#ifndef __WINE_WGL_DRIVER_H\n"; -print HEADER "#define __WINE_WGL_DRIVER_H\n\n"; -print HEADER "#include "wine/wgl.h"\n\n"; - -printf HEADER "#define WINE_WGL_DRIVER_VERSION %u\n\n", $wgl_version + 1; - -print HEADER "struct wgl_context;\n"; -print HEADER "struct wgl_pbuffer;\n\n"; - -print HEADER "struct wgl_pixel_format\n"; -print HEADER "{\n"; -print HEADER " PIXELFORMATDESCRIPTOR pfd;\n"; -print HEADER " int swap_method;\n"; -print HEADER " int transparent;\n"; -print HEADER " int pixel_type;\n"; -print HEADER " int draw_to_pbuffer;\n"; -print HEADER " int max_pbuffer_pixels;\n"; -print HEADER " int max_pbuffer_width;\n"; -print HEADER " int max_pbuffer_height;\n"; -print HEADER " int transparent_red_value;\n"; -print HEADER " int transparent_red_value_valid;\n"; -print HEADER " int transparent_green_value;\n"; -print HEADER " int transparent_green_value_valid;\n"; -print HEADER " int transparent_blue_value;\n"; -print HEADER " int transparent_blue_value_valid;\n"; -print HEADER " int transparent_alpha_value;\n"; -print HEADER " int transparent_alpha_value_valid;\n"; -print HEADER " int transparent_index_value;\n"; -print HEADER " int transparent_index_value_valid;\n"; -print HEADER " int sample_buffers;\n"; -print HEADER " int samples;\n"; -print HEADER " int bind_to_texture_rgb;\n"; -print HEADER " int bind_to_texture_rgba;\n"; -print HEADER " int bind_to_texture_rectangle_rgb;\n"; -print HEADER " int bind_to_texture_rectangle_rgba;\n"; -print HEADER " int framebuffer_srgb_capable;\n"; -print HEADER " int float_components;\n"; -print HEADER "};\n\n"; - -print HEADER "struct opengl_funcs\n{\n"; -foreach (sort keys %wgl_functions) -{ - next if defined $manual_win_functions{$_}; - my $decl_args = get_func_args( $wgl_functions{$_}, 1, 1, "" ); - my $func_ret = get_func_ret( $wgl_functions{$_}, 1 ); - printf HEADER " %-10s (*p_$_)($decl_args);\n", $func_ret; -} -print HEADER " void (*p_get_pixel_formats)( struct wgl_pixel_format *formats, UINT max_formats, UINT *num_formats, UINT *num_onscreen_formats );\n"; -foreach (sort keys %ext_functions) -{ - next unless $_ =~ /^wgl/; - next if defined $manual_win_functions{$_}; - my $decl_args = get_func_args( $ext_functions{$_}, 1, 1, "" ); - my $func_ret = get_func_ret( $ext_functions{$_}, 1 ); - printf HEADER " %-10s (*p_$_)($decl_args);\n", $func_ret; -} -print HEADER "#define USE_GL_FUNC(x) PFN_##x p_##x;\n"; -print HEADER " ALL_GL_FUNCS\n"; -print HEADER " ALL_GL_EXT_FUNCS\n"; -print HEADER "#undef USE_GL_FUNC\n"; -print HEADER "};\n\n"; -print HEADER "#endif /* __WINE_WGL_DRIVER_H */\n"; -close HEADER; - # # Generate the wgl.h file # diff --git a/dlls/opengl32/unix_private.h b/dlls/opengl32/unix_private.h index b63014cdc8b..7566d5ca780 100644 --- a/dlls/opengl32/unix_private.h +++ b/dlls/opengl32/unix_private.h @@ -30,8 +30,7 @@ #include "wingdi.h" #include "ntgdi.h"
-#include "wine/wgl.h" -#include "wine/wgl_driver.h" +#include "wine/opengl_driver.h"
struct registry_entry { @@ -47,7 +46,7 @@ extern struct opengl_funcs null_opengl_funcs;
static inline const struct opengl_funcs *get_dc_funcs( HDC hdc ) { - const struct opengl_funcs *funcs = __wine_get_wgl_driver( hdc, WINE_WGL_DRIVER_VERSION ); + const struct opengl_funcs *funcs = __wine_get_wgl_driver( hdc, WINE_OPENGL_DRIVER_VERSION ); if (!funcs) RtlSetLastWin32Error( ERROR_INVALID_HANDLE ); else if (funcs == (void *)-1) funcs = &null_opengl_funcs; return funcs; diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c index 01e0e66f0fd..4fd55bc3791 100644 --- a/dlls/opengl32/wgl.c +++ b/dlls/opengl32/wgl.c @@ -36,7 +36,7 @@
#include "wine/glu.h" #include "wine/debug.h" -#include "wine/wgl_driver.h" +#include "wine/opengl_driver.h"
WINE_DEFAULT_DEBUG_CHANNEL(opengl); WINE_DECLARE_DEBUG_CHANNEL(fps); diff --git a/dlls/win32u/opengl.c b/dlls/win32u/opengl.c index e3f9b743c09..a65f6567dc7 100644 --- a/dlls/win32u/opengl.c +++ b/dlls/win32u/opengl.c @@ -32,8 +32,7 @@ #include "win32u_private.h" #include "ntuser_private.h"
-#include "wine/wgl.h" -#include "wine/wgl_driver.h" +#include "wine/opengl_driver.h"
#include "dibdrv/dibdrv.h"
@@ -363,7 +362,7 @@ static void memory_funcs_init(void)
static void display_funcs_init(void) { - display_funcs = user_driver->pwine_get_wgl_driver( WINE_WGL_DRIVER_VERSION ); + display_funcs = user_driver->pwine_get_wgl_driver( WINE_OPENGL_DRIVER_VERSION ); }
static struct opengl_funcs *get_dc_funcs( HDC hdc, void *null_funcs ) @@ -398,10 +397,10 @@ static struct opengl_funcs *get_dc_funcs( HDC hdc, void *null_funcs ) */ const struct opengl_funcs *__wine_get_wgl_driver( HDC hdc, UINT version ) { - if (version != WINE_WGL_DRIVER_VERSION) + if (version != WINE_OPENGL_DRIVER_VERSION) { ERR( "version mismatch, opengl32 wants %u but dibdrv has %u\n", - version, WINE_WGL_DRIVER_VERSION ); + version, WINE_OPENGL_DRIVER_VERSION ); return NULL; }
diff --git a/dlls/wineandroid.drv/opengl.c b/dlls/wineandroid.drv/opengl.c index 03ebb51ed73..fdd4ceddd73 100644 --- a/dlls/wineandroid.drv/opengl.c +++ b/dlls/wineandroid.drv/opengl.c @@ -42,10 +42,7 @@ #include "android.h" #include "winternl.h"
-#define GLAPIENTRY /* nothing */ -#include "wine/wgl.h" -#undef GLAPIENTRY -#include "wine/wgl_driver.h" +#include "wine/opengl_driver.h" #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(android); @@ -966,9 +963,9 @@ struct opengl_funcs *ANDROID_wine_get_wgl_driver( UINT version ) EGLConfig *configs; EGLint major, minor, count, i, pass;
- if (version != WINE_WGL_DRIVER_VERSION) + if (version != WINE_OPENGL_DRIVER_VERSION) { - ERR( "version mismatch, opengl32 wants %u but driver has %u\n", version, WINE_WGL_DRIVER_VERSION ); + ERR( "version mismatch, opengl32 wants %u but driver has %u\n", version, WINE_OPENGL_DRIVER_VERSION ); return NULL; } if (!(egl_handle = dlopen( SONAME_LIBEGL, RTLD_NOW|RTLD_GLOBAL ))) diff --git a/dlls/winemac.drv/opengl.c b/dlls/winemac.drv/opengl.c index b70009a0366..13a64bda372 100644 --- a/dlls/winemac.drv/opengl.c +++ b/dlls/winemac.drv/opengl.c @@ -31,8 +31,7 @@ #include "winternl.h" #include "winnt.h" #include "wine/debug.h" -#include "wine/wgl.h" -#include "wine/wgl_driver.h" +#include "wine/opengl_driver.h"
#define GL_SILENCE_DEPRECATION #define __gl_h_ @@ -4172,9 +4171,9 @@ struct opengl_funcs *macdrv_wine_get_wgl_driver(UINT version) { TRACE("()\n");
- if (version != WINE_WGL_DRIVER_VERSION) + if (version != WINE_OPENGL_DRIVER_VERSION) { - ERR("version mismatch, opengl32 wants %u but macdrv has %u\n", version, WINE_WGL_DRIVER_VERSION); + ERR("version mismatch, opengl32 wants %u but macdrv has %u\n", version, WINE_OPENGL_DRIVER_VERSION); return NULL; }
diff --git a/dlls/winewayland.drv/opengl.c b/dlls/winewayland.drv/opengl.c index 85e6e06a9d9..501b17550d2 100644 --- a/dlls/winewayland.drv/opengl.c +++ b/dlls/winewayland.drv/opengl.c @@ -40,8 +40,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(waylanddrv); #include <EGL/egl.h> #include <EGL/eglext.h>
-#include "wine/wgl.h" -#include "wine/wgl_driver.h" +#include "wine/opengl_driver.h"
static void *egl_handle; static struct opengl_funcs opengl_funcs; @@ -1319,10 +1318,10 @@ struct opengl_funcs *WAYLAND_wine_get_wgl_driver(UINT version) EGLint egl_version[2]; const char *egl_client_exts, *egl_exts;
- if (version != WINE_WGL_DRIVER_VERSION) + if (version != WINE_OPENGL_DRIVER_VERSION) { ERR("Version mismatch, opengl32 wants %u but driver has %u\n", - version, WINE_WGL_DRIVER_VERSION); + version, WINE_OPENGL_DRIVER_VERSION); return NULL; }
diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index 224c7f262b8..4524e7c46fa 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -48,8 +48,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(wgl); WINE_DECLARE_DEBUG_CHANNEL(winediag);
-#include "wine/wgl.h" -#include "wine/wgl_driver.h" +#include "wine/opengl_driver.h"
typedef struct __GLXcontextRec *GLXContext; typedef struct __GLXFBConfigRec *GLXFBConfig; @@ -543,9 +542,9 @@ struct opengl_funcs *X11DRV_wine_get_wgl_driver(UINT version) { int error_base, event_base;
- if (version != WINE_WGL_DRIVER_VERSION) + if (version != WINE_OPENGL_DRIVER_VERSION) { - ERR( "version mismatch, opengl32 wants %u but driver has %u\n", version, WINE_WGL_DRIVER_VERSION ); + ERR( "version mismatch, opengl32 wants %u but driver has %u\n", version, WINE_OPENGL_DRIVER_VERSION ); return NULL; }
diff --git a/include/Makefile.in b/include/Makefile.in index 5938a0b05ba..b63f3171d0d 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -942,6 +942,7 @@ SOURCES = \ wine/mscvpdb.h \ wine/mssign.h \ wine/nsi.h \ + wine/opengl_driver.h \ wine/orpc.idl \ wine/plugplay.idl \ wine/rbtree.h \ @@ -955,7 +956,6 @@ SOURCES = \ wine/vulkan.h \ wine/vulkan_driver.h \ wine/wgl.h \ - wine/wgl_driver.h \ wine/winbase16.h \ wine/windef16.h \ wine/wine_common_ver.rc \ diff --git a/include/wine/wgl_driver.h b/include/wine/opengl_driver.h similarity index 78% rename from include/wine/wgl_driver.h rename to include/wine/opengl_driver.h index e217a910312..c5540e379ad 100644 --- a/include/wine/wgl_driver.h +++ b/include/wine/opengl_driver.h @@ -1,14 +1,32 @@ -/* Automatically generated from http://www.opengl.org/registry files; DO NOT EDIT! */ +/* + * Copyright 2025 Rémi Bernon for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */
-#ifndef __WINE_WGL_DRIVER_H -#define __WINE_WGL_DRIVER_H +#ifndef __WINE_OPENGL_DRIVER_H +#define __WINE_OPENGL_DRIVER_H
-#include "wine/wgl.h" +#include <stdarg.h> +#include <stddef.h>
-#define WINE_WGL_DRIVER_VERSION 30 +#include <windef.h> +#include <winbase.h> +#include <wingdi.h>
-struct wgl_context; -struct wgl_pbuffer; +#include "wine/wgl.h"
struct wgl_pixel_format { @@ -40,6 +58,14 @@ struct wgl_pixel_format int float_components; };
+#ifdef WINE_UNIX_LIB + +/* Wine internal opengl driver version, needs to be bumped upon opengl_funcs changes. */ +#define WINE_OPENGL_DRIVER_VERSION 30 + +struct wgl_context; +struct wgl_pbuffer; + struct opengl_funcs { BOOL (*p_wglCopyContext)( struct wgl_context * hglrcSrc, struct wgl_context * hglrcDst, UINT mask ); @@ -83,4 +109,6 @@ struct opengl_funcs #undef USE_GL_FUNC };
-#endif /* __WINE_WGL_DRIVER_H */ +#endif /* WINE_UNIX_LIB */ + +#endif /* __WINE_OPENGL_DRIVER_H */