mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-11-21 16:46:54 -08:00
Added patch to fix calling convention of glDebugMessageCallback callback function.
This commit is contained in:
parent
fb073f008c
commit
676f8190a3
@ -0,0 +1,58 @@
|
||||
From d31370afac230bcf175872ef348030472577e3c7 Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Fri, 12 Feb 2016 01:57:11 +0100
|
||||
Subject: opengl32/tests: Include wgl.h and remove duplicate declarations.
|
||||
|
||||
---
|
||||
dlls/opengl32/tests/opengl.c | 25 +++----------------------
|
||||
1 file changed, 3 insertions(+), 22 deletions(-)
|
||||
|
||||
diff --git a/dlls/opengl32/tests/opengl.c b/dlls/opengl32/tests/opengl.c
|
||||
index e5e1507..3f203ab 100644
|
||||
--- a/dlls/opengl32/tests/opengl.c
|
||||
+++ b/dlls/opengl32/tests/opengl.c
|
||||
@@ -21,38 +21,19 @@
|
||||
#include <windows.h>
|
||||
#include <wingdi.h>
|
||||
#include "wine/test.h"
|
||||
-
|
||||
-void WINAPI glClearColor(float red, float green, float blue, float alpha);
|
||||
-void WINAPI glClear(unsigned int mask);
|
||||
-#define GL_COLOR 0x1800
|
||||
-typedef unsigned int GLenum;
|
||||
-typedef int GLint;
|
||||
-void WINAPI glCopyPixels(int x, int y, int width, int height, GLenum type);
|
||||
-void WINAPI glFinish(void);
|
||||
-#define GL_NO_ERROR 0x0
|
||||
-#define GL_INVALID_OPERATION 0x502
|
||||
-GLenum WINAPI glGetError(void);
|
||||
-#define GL_COLOR_BUFFER_BIT 0x00004000
|
||||
-const unsigned char * WINAPI glGetString(unsigned int);
|
||||
-#define GL_VENDOR 0x1F00
|
||||
-#define GL_RENDERER 0x1F01
|
||||
-#define GL_VERSION 0x1F02
|
||||
-#define GL_EXTENSIONS 0x1F03
|
||||
-
|
||||
-#define GL_VIEWPORT 0x0ba2
|
||||
-void WINAPI glGetIntegerv(GLenum pname, GLint *params);
|
||||
+#include "wine/wgl.h"
|
||||
|
||||
#define MAX_FORMATS 256
|
||||
typedef void* HPBUFFERARB;
|
||||
|
||||
/* WGL_ARB_create_context */
|
||||
static HGLRC (WINAPI *pwglCreateContextAttribsARB)(HDC hDC, HGLRC hShareContext, const int *attribList);
|
||||
-/* GetLastError */
|
||||
-#define ERROR_INVALID_VERSION_ARB 0x2095
|
||||
+
|
||||
#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091
|
||||
#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092
|
||||
#define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093
|
||||
#define WGL_CONTEXT_FLAGS_ARB 0x2094
|
||||
+
|
||||
/* Flags for WGL_CONTEXT_FLAGS_ARB */
|
||||
#define WGL_CONTEXT_DEBUG_BIT_ARB 0x0001
|
||||
#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002
|
||||
--
|
||||
2.7.1
|
||||
|
@ -0,0 +1,226 @@
|
||||
From 8e64df5a5161db39c7e1828b138e72f4bbcc7693 Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Fri, 12 Feb 2016 02:39:07 +0100
|
||||
Subject: opengl32: Add wrappers for glDebugMessageCallback to handle calling
|
||||
convention differences.
|
||||
|
||||
---
|
||||
dlls/opengl32/make_opengl | 5 ++++
|
||||
dlls/opengl32/opengl_ext.c | 18 --------------
|
||||
dlls/opengl32/opengl_ext.h | 4 ++++
|
||||
dlls/opengl32/tests/opengl.c | 44 ++++++++++++++++++++++++++++++++++
|
||||
dlls/opengl32/wgl.c | 57 ++++++++++++++++++++++++++++++++++++++++++++
|
||||
5 files changed, 110 insertions(+), 18 deletions(-)
|
||||
|
||||
diff --git a/dlls/opengl32/make_opengl b/dlls/opengl32/make_opengl
|
||||
index 2b15f58..9a95fa77 100755
|
||||
--- a/dlls/opengl32/make_opengl
|
||||
+++ b/dlls/opengl32/make_opengl
|
||||
@@ -238,6 +238,11 @@ sub GenerateThunk($$$$)
|
||||
return "" if $name eq "glDebugEntry";
|
||||
return "" if $name eq "glGetIntegerv";
|
||||
return "" if $name eq "glGetString";
|
||||
+
|
||||
+ return "" if $name eq "glDebugMessageCallback";
|
||||
+ return "" if $name eq "glDebugMessageCallbackAMD";
|
||||
+ return "" if $name eq "glDebugMessageCallbackARB";
|
||||
+
|
||||
return "" if $func_ref->[2] && $func_ref->[2]->[0] =~ /WGL_/;
|
||||
|
||||
# If for opengl_norm.c, generate a nice heading otherwise Patrik won't be happy :-)
|
||||
diff --git a/dlls/opengl32/opengl_ext.c b/dlls/opengl32/opengl_ext.c
|
||||
index e1aeec5..d707f9a 100644
|
||||
--- a/dlls/opengl32/opengl_ext.c
|
||||
+++ b/dlls/opengl32/opengl_ext.c
|
||||
@@ -1942,24 +1942,6 @@ static void WINAPI glCurrentPaletteMatrixARB( GLint index ) {
|
||||
funcs->ext.p_glCurrentPaletteMatrixARB( index );
|
||||
}
|
||||
|
||||
-static void WINAPI glDebugMessageCallback( void * callback, const void* userParam ) {
|
||||
- const struct opengl_funcs *funcs = NtCurrentTeb()->glTable;
|
||||
- TRACE("(%p, %p)\n", callback, userParam );
|
||||
- funcs->ext.p_glDebugMessageCallback( callback, userParam );
|
||||
-}
|
||||
-
|
||||
-static void WINAPI glDebugMessageCallbackAMD( void * callback, void* userParam ) {
|
||||
- const struct opengl_funcs *funcs = NtCurrentTeb()->glTable;
|
||||
- TRACE("(%p, %p)\n", callback, userParam );
|
||||
- funcs->ext.p_glDebugMessageCallbackAMD( callback, userParam );
|
||||
-}
|
||||
-
|
||||
-static void WINAPI glDebugMessageCallbackARB( void * callback, const void* userParam ) {
|
||||
- const struct opengl_funcs *funcs = NtCurrentTeb()->glTable;
|
||||
- TRACE("(%p, %p)\n", callback, userParam );
|
||||
- funcs->ext.p_glDebugMessageCallbackARB( callback, userParam );
|
||||
-}
|
||||
-
|
||||
static void WINAPI glDebugMessageControl( GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint* ids, GLboolean enabled ) {
|
||||
const struct opengl_funcs *funcs = NtCurrentTeb()->glTable;
|
||||
TRACE("(%d, %d, %d, %d, %p, %d)\n", source, type, severity, count, ids, enabled );
|
||||
diff --git a/dlls/opengl32/opengl_ext.h b/dlls/opengl32/opengl_ext.h
|
||||
index 2e49d4a..a538434 100644
|
||||
--- a/dlls/opengl32/opengl_ext.h
|
||||
+++ b/dlls/opengl32/opengl_ext.h
|
||||
@@ -33,4 +33,8 @@ extern const int extension_registry_size DECLSPEC_HIDDEN;
|
||||
|
||||
extern BOOL WINAPI wglSetPixelFormatWINE( HDC hdc, int format ) DECLSPEC_HIDDEN;
|
||||
|
||||
+extern void WINAPI glDebugMessageCallback( void *callback, const void *userParam ) DECLSPEC_HIDDEN;
|
||||
+extern void WINAPI glDebugMessageCallbackAMD( void *callback, void *userParam ) DECLSPEC_HIDDEN;
|
||||
+extern void WINAPI glDebugMessageCallbackARB( void *callback, const void *userParam ) DECLSPEC_HIDDEN;
|
||||
+
|
||||
#endif /* __DLLS_OPENGL32_OPENGL_EXT_H */
|
||||
diff --git a/dlls/opengl32/tests/opengl.c b/dlls/opengl32/tests/opengl.c
|
||||
index 3f203ab..59b92ea 100644
|
||||
--- a/dlls/opengl32/tests/opengl.c
|
||||
+++ b/dlls/opengl32/tests/opengl.c
|
||||
@@ -71,6 +71,11 @@ static HDC (WINAPI *pwglGetPbufferDCARB)(HPBUFFERARB);
|
||||
static BOOL (WINAPI *pwglSwapIntervalEXT)(int interval);
|
||||
static int (WINAPI *pwglGetSwapIntervalEXT)(void);
|
||||
|
||||
+/* GL_ARB_debug_output */
|
||||
+static void (WINAPI *pglDebugMessageCallbackARB)(void *, void *);
|
||||
+static void (WINAPI *pglDebugMessageControlARB)(GLenum, GLenum, GLenum, GLsizei, const GLuint *, GLboolean);
|
||||
+static void (WINAPI *pglDebugMessageInsertARB)(GLenum, GLenum, GLuint, GLenum, GLsizei, const char *);
|
||||
+
|
||||
static const char* wgl_extensions = NULL;
|
||||
|
||||
static void init_functions(void)
|
||||
@@ -103,6 +108,11 @@ static void init_functions(void)
|
||||
GET_PROC(wglSwapIntervalEXT)
|
||||
GET_PROC(wglGetSwapIntervalEXT)
|
||||
|
||||
+ /* GL_ARB_debug_output */
|
||||
+ GET_PROC(glDebugMessageCallbackARB)
|
||||
+ GET_PROC(glDebugMessageControlARB)
|
||||
+ GET_PROC(glDebugMessageInsertARB)
|
||||
+
|
||||
#undef GET_PROC
|
||||
}
|
||||
|
||||
@@ -232,6 +242,39 @@ static void test_pbuffers(HDC hdc)
|
||||
else skip("Pbuffer test for offscreen pixelformat skipped as no offscreen-only format with pbuffer capabilities has been found\n");
|
||||
}
|
||||
|
||||
+static void WINAPI gl_debug_message_callback(GLenum source, GLenum type, GLuint id, GLenum severity,
|
||||
+ GLsizei length, const GLchar *message, const void *userParam)
|
||||
+{
|
||||
+ DWORD *count = (DWORD *)userParam;
|
||||
+ (*count)++;
|
||||
+}
|
||||
+
|
||||
+static void test_debug_message_callback(void)
|
||||
+{
|
||||
+ static const char testmsg[] = "Hello World";
|
||||
+ DWORD count;
|
||||
+
|
||||
+ if (!pglDebugMessageCallbackARB)
|
||||
+ {
|
||||
+ skip("glDebugMessageCallbackARB not supported\n");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ glEnable(GL_DEBUG_OUTPUT);
|
||||
+ glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
|
||||
+
|
||||
+ pglDebugMessageCallbackARB(gl_debug_message_callback, &count);
|
||||
+ pglDebugMessageControlARB(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, NULL, GL_TRUE);
|
||||
+
|
||||
+ count = 0;
|
||||
+ pglDebugMessageInsertARB(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_OTHER, 0x42424242,
|
||||
+ GL_DEBUG_SEVERITY_LOW, sizeof(testmsg), testmsg);
|
||||
+ ok(count == 1, "expected count == 1, got %u\n", count);
|
||||
+
|
||||
+ glDisable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
|
||||
+ glDisable(GL_DEBUG_OUTPUT);
|
||||
+}
|
||||
+
|
||||
static void test_setpixelformat(HDC winhdc)
|
||||
{
|
||||
int res = 0;
|
||||
@@ -1684,6 +1727,7 @@ START_TEST(opengl)
|
||||
return;
|
||||
}
|
||||
|
||||
+ test_debug_message_callback();
|
||||
test_setpixelformat(hdc);
|
||||
test_destroy(hdc);
|
||||
test_sharelists(hdc);
|
||||
diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c
|
||||
index f3f78ef..e5f9a6f 100644
|
||||
--- a/dlls/opengl32/wgl.c
|
||||
+++ b/dlls/opengl32/wgl.c
|
||||
@@ -62,6 +62,9 @@ struct opengl_context
|
||||
DWORD tid; /* thread that the context is current in */
|
||||
HDC draw_dc; /* current drawing DC */
|
||||
HDC read_dc; /* current reading DC */
|
||||
+ void (CALLBACK *debug_callback)(GLenum, GLenum, GLuint, GLenum,
|
||||
+ GLsizei, const GLchar *, const void *); /* debug callback */
|
||||
+ const void *debug_user; /* debug user parameter */
|
||||
GLubyte *extensions; /* extension string */
|
||||
GLuint *disabled_exts; /* indices of disabled extensions */
|
||||
struct wgl_context *drv_ctx; /* driver context */
|
||||
@@ -1919,6 +1922,60 @@ const GLubyte * WINAPI glGetString( GLenum name )
|
||||
return ret;
|
||||
}
|
||||
|
||||
+/* wrapper for glDebugMessageCallback* functions */
|
||||
+static void gl_debug_message_callback( GLenum source, GLenum type, GLuint id, GLenum severity,
|
||||
+ GLsizei length, const GLchar *message,const void *userParam )
|
||||
+{
|
||||
+ struct wgl_handle *ptr = (struct wgl_handle *)userParam;
|
||||
+ if (!ptr->u.context->debug_callback) return;
|
||||
+ ptr->u.context->debug_callback( source, type, id, severity, length, message, ptr->u.context->debug_user );
|
||||
+}
|
||||
+
|
||||
+/***********************************************************************
|
||||
+ * glDebugMessageCallback
|
||||
+ */
|
||||
+void WINAPI glDebugMessageCallback( void *callback, const void *userParam )
|
||||
+{
|
||||
+ struct wgl_handle *ptr = get_current_context_ptr();
|
||||
+ const struct opengl_funcs *funcs = NtCurrentTeb()->glTable;
|
||||
+
|
||||
+ TRACE("(%p, %p)\n", callback, userParam );
|
||||
+
|
||||
+ ptr->u.context->debug_callback = callback;
|
||||
+ ptr->u.context->debug_user = userParam;
|
||||
+ funcs->ext.p_glDebugMessageCallback( gl_debug_message_callback, ptr );
|
||||
+}
|
||||
+
|
||||
+/***********************************************************************
|
||||
+ * glDebugMessageCallbackAMD
|
||||
+ */
|
||||
+void WINAPI glDebugMessageCallbackAMD( void *callback, void *userParam )
|
||||
+{
|
||||
+ struct wgl_handle *ptr = get_current_context_ptr();
|
||||
+ const struct opengl_funcs *funcs = NtCurrentTeb()->glTable;
|
||||
+
|
||||
+ TRACE("(%p, %p)\n", callback, userParam );
|
||||
+
|
||||
+ ptr->u.context->debug_callback = callback;
|
||||
+ ptr->u.context->debug_user = userParam;
|
||||
+ funcs->ext.p_glDebugMessageCallbackAMD( gl_debug_message_callback, ptr );
|
||||
+}
|
||||
+
|
||||
+/***********************************************************************
|
||||
+ * glDebugMessageCallbackARB
|
||||
+ */
|
||||
+void WINAPI glDebugMessageCallbackARB( void *callback, const void *userParam )
|
||||
+{
|
||||
+ struct wgl_handle *ptr = get_current_context_ptr();
|
||||
+ const struct opengl_funcs *funcs = NtCurrentTeb()->glTable;
|
||||
+
|
||||
+ TRACE("(%p, %p)\n", callback, userParam );
|
||||
+
|
||||
+ ptr->u.context->debug_callback = callback;
|
||||
+ ptr->u.context->debug_user = userParam;
|
||||
+ funcs->ext.p_glDebugMessageCallbackARB( gl_debug_message_callback, ptr );
|
||||
+}
|
||||
+
|
||||
/***********************************************************************
|
||||
* OpenGL initialisation routine
|
||||
*/
|
||||
--
|
||||
2.7.1
|
||||
|
1
patches/opengl32-glDebugMessageCallback/definition
Normal file
1
patches/opengl32-glDebugMessageCallback/definition
Normal file
@ -0,0 +1 @@
|
||||
Fixes: [38402] Fix calling convention of glDebugMessageCallback callback function
|
@ -248,6 +248,7 @@ patch_enable_all ()
|
||||
enable_oleaut32_x86_64_Marshaller="$1"
|
||||
enable_openal32_EFX_Extension="$1"
|
||||
enable_opengl32_Revert_Disable_Ext="$1"
|
||||
enable_opengl32_glDebugMessageCallback="$1"
|
||||
enable_quartz_AsyncReader="$1"
|
||||
enable_quartz_MediaSeeking_Positions="$1"
|
||||
enable_rasapi32_RasEnumDevicesA="$1"
|
||||
@ -891,6 +892,9 @@ patch_enable ()
|
||||
opengl32-Revert_Disable_Ext)
|
||||
enable_opengl32_Revert_Disable_Ext="$2"
|
||||
;;
|
||||
opengl32-glDebugMessageCallback)
|
||||
enable_opengl32_glDebugMessageCallback="$2"
|
||||
;;
|
||||
quartz-AsyncReader)
|
||||
enable_quartz_AsyncReader="$2"
|
||||
;;
|
||||
@ -5380,6 +5384,24 @@ if test "$enable_opengl32_Revert_Disable_Ext" -eq 1; then
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset opengl32-glDebugMessageCallback
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
# | * [#38402] Fix calling convention of glDebugMessageCallback callback function
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/opengl32/make_opengl, dlls/opengl32/opengl_ext.c, dlls/opengl32/opengl_ext.h, dlls/opengl32/tests/opengl.c,
|
||||
# | dlls/opengl32/wgl.c
|
||||
# |
|
||||
if test "$enable_opengl32_glDebugMessageCallback" -eq 1; then
|
||||
patch_apply opengl32-glDebugMessageCallback/0001-opengl32-tests-Include-wgl.h-and-remove-duplicate-de.patch
|
||||
patch_apply opengl32-glDebugMessageCallback/0002-opengl32-Add-wrappers-for-glDebugMessageCallback-to-.patch
|
||||
(
|
||||
echo '+ { "Sebastian Lackner", "opengl32/tests: Include wgl.h and remove duplicate declarations.", 1 },';
|
||||
echo '+ { "Sebastian Lackner", "opengl32: Add wrappers for glDebugMessageCallback to handle calling convention differences.", 1 },';
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset quartz-AsyncReader
|
||||
# |
|
||||
# | Modified files:
|
||||
|
Loading…
Reference in New Issue
Block a user