From: Rémi Bernon <rbernon@codeweavers.com> --- dlls/opengl32/Makefile.in | 3 +- dlls/opengl32/make_opengl | 6 +++ dlls/opengl32/mesa.c | 51 +++++++++++++++++++++++++ dlls/opengl32/thunks.c | 2 + dlls/opengl32/unix_thunks.c | 2 + dlls/opengl32/unix_wgl.c | 4 ++ dlls/opengl32/unixlib.h | 2 + dlls/opengl32/wgl.c | 4 ++ libs/mesa/src/gallium/targets/wgl/wgl.c | 4 +- 9 files changed, 75 insertions(+), 3 deletions(-) create mode 100644 dlls/opengl32/mesa.c diff --git a/dlls/opengl32/Makefile.in b/dlls/opengl32/Makefile.in index 24b3d6efa6e..b8a26c397d8 100644 --- a/dlls/opengl32/Makefile.in +++ b/dlls/opengl32/Makefile.in @@ -2,7 +2,7 @@ MODULE = opengl32.dll UNIXLIB = opengl32.so EXTRADEFS = -D_OPENGL32_ $(MESA_PE_CFLAGS) IMPORTLIB = opengl32 -IMPORTS = $(MESA_PE_LIBS) user32 gdi32 advapi32 win32u +IMPORTS = $(MESA_PE_LIBS) $(CXX_PE_LIBS) user32 gdi32 advapi32 win32u kernelbase DELAYIMPORTS = glu32 UNIX_LIBS = -lwin32u @@ -15,6 +15,7 @@ VER_LEGALCOPYRIGHT_STR = "Copyright (c) 1993-2026 the Wine project. Not Microso SOURCES = \ thunks.c \ + mesa.c \ unix_thunks.c \ unix_wgl.c \ wgl.c diff --git a/dlls/opengl32/make_opengl b/dlls/opengl32/make_opengl index c8f6c5f22f2..80b323edf46 100755 --- a/dlls/opengl32/make_opengl +++ b/dlls/opengl32/make_opengl @@ -1581,6 +1581,7 @@ print OUT "/* Automatically generated from http://www.opengl.org/registry files; print OUT "#ifndef __WINE_OPENGL32_UNIXLIB_H\n"; print OUT "#define __WINE_OPENGL32_UNIXLIB_H\n\n"; +print OUT "#ifndef ENABLE_MESA\n"; print OUT "#include <stdarg.h>\n"; print OUT "#include <stddef.h>\n\n"; @@ -1665,6 +1666,7 @@ print OUT "};\n\n"; print OUT "#define UNIX_CALL( func, params ) WINE_UNIX_CALL( unix_ ## func, params )\n\n"; +print OUT "#endif /* ENABLE_MESA */\n"; print OUT "#endif /* __WINE_OPENGL32_UNIXLIB_H */\n"; close OUT; @@ -1674,6 +1676,7 @@ close OUT; open OUT, ">thunks.c" or die "cannot create thunks.c"; print OUT "/* Automatically generated from http://www.opengl.org/registry files; DO NOT EDIT! */\n\n"; +print OUT "#ifndef ENABLE_MESA\n"; print OUT "#include <stdarg.h>\n"; print OUT "#include <stddef.h>\n\n"; @@ -1726,6 +1729,7 @@ foreach (sort keys %ext_functions) } print OUT "};\n"; +print OUT "#endif /* ENABLE_MESA */\n"; close OUT; # @@ -1785,6 +1789,7 @@ print OUT "#if 0\n"; print OUT "#pragma makedep unix\n"; print OUT "#endif\n\n"; +print OUT "#ifndef ENABLE_MESA\n"; print OUT "#include <stdarg.h>\n"; print OUT "#include <stddef.h>\n\n"; @@ -1947,4 +1952,5 @@ foreach (sort keys %ext_functions) } print OUT "};\n"; +print OUT "#endif /* ENABLE_MESA */\n"; close OUT; diff --git a/dlls/opengl32/mesa.c b/dlls/opengl32/mesa.c new file mode 100644 index 00000000000..749e1e8156e --- /dev/null +++ b/dlls/opengl32/mesa.c @@ -0,0 +1,51 @@ +/* + * Copyright 2024 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 + */ + +#ifdef ENABLE_MESA + +#include <stdarg.h> +#include <stddef.h> + +#include "windef.h" +#include "winbase.h" + +#include "wine/wgl.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(opengl); + +extern BOOL WINAPI mesa_dllmain( HINSTANCE hinst, DWORD reason, LPVOID reserved ); + +BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved ) +{ + return mesa_dllmain( hinst, reason, reserved ); +} + +GLint WINAPI glDebugEntry( GLint unknown1, GLint unknown2 ) +{ + FIXME( "sub!\n" ); + return 0; +} + +PROC WINAPI wglGetDefaultProcAddress( const char *name ) +{ + FIXME( "sub!\n" ); + return NULL; +} + +#endif /* ENABLE_MESA */ diff --git a/dlls/opengl32/thunks.c b/dlls/opengl32/thunks.c index 5e69946db38..646b0235878 100644 --- a/dlls/opengl32/thunks.c +++ b/dlls/opengl32/thunks.c @@ -1,5 +1,6 @@ /* Automatically generated from http://www.opengl.org/registry files; DO NOT EDIT! */ +#ifndef ENABLE_MESA #include <stdarg.h> #include <stddef.h> @@ -27601,3 +27602,4 @@ const void *extension_procs[] = wglSetPixelFormatWINE, wglSwapIntervalEXT, }; +#endif /* ENABLE_MESA */ diff --git a/dlls/opengl32/unix_thunks.c b/dlls/opengl32/unix_thunks.c index 75a8baf0e55..81d69a2cb43 100644 --- a/dlls/opengl32/unix_thunks.c +++ b/dlls/opengl32/unix_thunks.c @@ -4,6 +4,7 @@ #pragma makedep unix #endif +#ifndef ENABLE_MESA #include <stdarg.h> #include <stddef.h> @@ -94614,3 +94615,4 @@ const struct registry_entry extension_registry[2758] = { "wglSetPixelFormatWINE", "WGL_WINE_pixel_format_passthrough\0", offsetof(struct opengl_funcs, p_wglSetPixelFormatWINE) }, { "wglSwapIntervalEXT", "WGL_EXT_swap_control\0", offsetof(struct opengl_funcs, p_wglSwapIntervalEXT) }, }; +#endif /* ENABLE_MESA */ diff --git a/dlls/opengl32/unix_wgl.c b/dlls/opengl32/unix_wgl.c index 00dfd96a551..2a87ab23b92 100644 --- a/dlls/opengl32/unix_wgl.c +++ b/dlls/opengl32/unix_wgl.c @@ -22,6 +22,8 @@ #pragma makedep unix #endif +#ifndef ENABLE_MESA + #include "config.h" #include <stdarg.h> @@ -2870,3 +2872,5 @@ NTSTATUS wow64_get_pixel_formats( void *args ) } #endif + +#endif /* ENABLE_MESA */ diff --git a/dlls/opengl32/unixlib.h b/dlls/opengl32/unixlib.h index 0731b244c01..6446ef79b3a 100644 --- a/dlls/opengl32/unixlib.h +++ b/dlls/opengl32/unixlib.h @@ -3,6 +3,7 @@ #ifndef __WINE_OPENGL32_UNIXLIB_H #define __WINE_OPENGL32_UNIXLIB_H +#ifndef ENABLE_MESA #include <stdarg.h> #include <stddef.h> @@ -29010,4 +29011,5 @@ struct gl_debug_message_callback_params #define UNIX_CALL( func, params ) WINE_UNIX_CALL( unix_ ## func, params ) +#endif /* ENABLE_MESA */ #endif /* __WINE_OPENGL32_UNIXLIB_H */ diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c index ce98e049a77..a009a90e914 100644 --- a/dlls/opengl32/wgl.c +++ b/dlls/opengl32/wgl.c @@ -18,6 +18,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#ifndef ENABLE_MESA + #include <assert.h> #include <stdarg.h> #include <stdlib.h> @@ -2185,3 +2187,5 @@ BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved ) } return TRUE; } + +#endif /* ENABLE_MESA */ diff --git a/libs/mesa/src/gallium/targets/wgl/wgl.c b/libs/mesa/src/gallium/targets/wgl/wgl.c index 75ec547cfd7..687aedefff4 100644 --- a/libs/mesa/src/gallium/targets/wgl/wgl.c +++ b/libs/mesa/src/gallium/targets/wgl/wgl.c @@ -257,11 +257,11 @@ static const struct stw_winsys stw_winsys = { EXTERN_C BOOL WINAPI -DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved); +mesa_dllmain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved); BOOL WINAPI -DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +mesa_dllmain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { switch (fdwReason) { case DLL_PROCESS_ATTACH: -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10531