#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
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)
GET_PROC(wglSwapIntervalEXT)
GET_PROC(wglGetSwapIntervalEXT)
+ /* GL_ARB_debug_output */
+ GET_PROC(glDebugMessageCallbackARB)
+ GET_PROC(glDebugMessageControlARB)
+ GET_PROC(glDebugMessageInsertARB)
+
#undef GET_PROC
}
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;
res = wglMakeCurrent(winhdc, hglrc2);
ok(res, "Make current failed\n");
res = wglShareLists(hglrc1, hglrc2);
- todo_wine ok(res, "Sharing display lists with a destination context which has been made current failed\n");
+ ok(res, "Sharing display lists with a destination context which has been made current failed\n");
wglMakeCurrent(0, 0);
wglDeleteContext(hglrc2);
}
glGetIntegerv( GL_VIEWPORT, viewport );
ok( viewport[0] == 0 && viewport[1] == 0 && viewport[2] == 12 && viewport[3] == 12,
"wrong viewport %d,%d,%d,%d\n", viewport[0], viewport[1], viewport[2], viewport[3] );
+
+ wglDeleteContext(hglrc2);
+ wglDeleteContext(hglrc);
}
}
{
HGLRC gl3Ctx;
DWORD error;
+ SetLastError(0xdeadbeef);
gl3Ctx = pwglCreateContextAttribsARB((HDC)0xdeadbeef, 0, 0);
ok(gl3Ctx == 0, "pwglCreateContextAttribsARB using an invalid HDC passed\n");
error = GetLastError();
- todo_wine ok(error == ERROR_DC_NOT_FOUND ||
- broken(error == NVIDIA_HRESULT_FROM_WIN32(ERROR_INVALID_DATA)), /* Nvidia Vista + Win7 */
- "Expected ERROR_DC_NOT_FOUND, got error=%x\n", error);
+ ok(error == ERROR_DC_NOT_FOUND ||
+ broken(error == NVIDIA_HRESULT_FROM_WIN32(ERROR_INVALID_DATA)), /* Nvidia Vista + Win7 */
+ "Expected ERROR_DC_NOT_FOUND, got error=%x\n", error);
wglDeleteContext(gl3Ctx);
}
{
HGLRC gl3Ctx;
DWORD error;
+ SetLastError(0xdeadbeef);
gl3Ctx = pwglCreateContextAttribsARB(hdc, (HGLRC)0xdeadbeef, 0);
ok(gl3Ctx == 0, "pwglCreateContextAttribsARB using an invalid shareList passed\n");
error = GetLastError();
/* The Nvidia implementation seems to return hresults instead of win32 error codes */
- todo_wine ok(error == ERROR_INVALID_OPERATION ||
- error == NVIDIA_HRESULT_FROM_WIN32(ERROR_INVALID_OPERATION), "Expected ERROR_INVALID_OPERATION, got error=%x\n", error);
+ ok(error == ERROR_INVALID_OPERATION ||
+ error == NVIDIA_HRESULT_FROM_WIN32(ERROR_INVALID_OPERATION), "Expected ERROR_INVALID_OPERATION, got error=%x\n", error);
wglDeleteContext(gl3Ctx);
}
return;
}
+ test_debug_message_callback();
test_setpixelformat(hdc);
test_destroy(hdc);
test_sharelists(hdc);