mirror of
https://github.com/reactos/reactos.git
synced 2025-04-21 12:40:33 +00:00
[OPENGL32_WINETEST] Sync with Wine 3.0. CORE-14225
This commit is contained in:
parent
173200c3cb
commit
d1c4fe8cfb
1 changed files with 24 additions and 108 deletions
|
@ -24,20 +24,10 @@
|
|||
#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);
|
||||
|
||||
#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
|
||||
|
||||
/* WGL_ARB_extensions_string */
|
||||
static const char* (WINAPI *pwglGetExtensionsStringARB)(HDC);
|
||||
static int (WINAPI *pwglReleasePbufferDCARB)(HPBUFFERARB, HDC);
|
||||
|
@ -47,35 +37,17 @@ static BOOL (WINAPI *pwglMakeContextCurrentARB)(HDC hdraw, HDC hread, HGLRC hglr
|
|||
static HDC (WINAPI *pwglGetCurrentReadDCARB)(void);
|
||||
|
||||
/* WGL_ARB_pixel_format */
|
||||
#define WGL_ACCELERATION_ARB 0x2003
|
||||
#define WGL_COLOR_BITS_ARB 0x2014
|
||||
#define WGL_RED_BITS_ARB 0x2015
|
||||
#define WGL_GREEN_BITS_ARB 0x2017
|
||||
#define WGL_BLUE_BITS_ARB 0x2019
|
||||
#define WGL_ALPHA_BITS_ARB 0x201B
|
||||
#define WGL_SUPPORT_GDI_ARB 0x200F
|
||||
#define WGL_DOUBLE_BUFFER_ARB 0x2011
|
||||
#define WGL_NO_ACCELERATION_ARB 0x2025
|
||||
#define WGL_GENERIC_ACCELERATION_ARB 0x2026
|
||||
#define WGL_FULL_ACCELERATION_ARB 0x2027
|
||||
|
||||
static BOOL (WINAPI *pwglChoosePixelFormatARB)(HDC, const int *, const FLOAT *, UINT, int *, UINT *);
|
||||
static BOOL (WINAPI *pwglGetPixelFormatAttribivARB)(HDC, int, int, UINT, const int *, int *);
|
||||
|
||||
/* WGL_ARB_pbuffer */
|
||||
#define WGL_DRAW_TO_PBUFFER_ARB 0x202D
|
||||
static HPBUFFERARB* (WINAPI *pwglCreatePbufferARB)(HDC, int, int, int, const int *);
|
||||
static HPBUFFERARB (WINAPI *pwglCreatePbufferARB)(HDC, int, int, int, const int *);
|
||||
static HDC (WINAPI *pwglGetPbufferDCARB)(HPBUFFERARB);
|
||||
|
||||
/* WGL_EXT_swap_control */
|
||||
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)
|
||||
|
@ -108,11 +80,6 @@ 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
|
||||
}
|
||||
|
||||
|
@ -242,7 +209,7 @@ 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 int test_pfd(const PIXELFORMATDESCRIPTOR *pfd, PIXELFORMATDESCRIPTOR *fmt)
|
||||
static int test_pfd(const PIXELFORMATDESCRIPTOR *pfd)
|
||||
{
|
||||
int pf;
|
||||
HDC hdc;
|
||||
|
@ -255,12 +222,6 @@ static int test_pfd(const PIXELFORMATDESCRIPTOR *pfd, PIXELFORMATDESCRIPTOR *fmt
|
|||
|
||||
hdc = GetDC( hwnd );
|
||||
pf = ChoosePixelFormat( hdc, pfd );
|
||||
if (pf && fmt)
|
||||
{
|
||||
memset(fmt, 0, sizeof(*fmt));
|
||||
ok(DescribePixelFormat( hdc, pf, sizeof(*fmt), fmt ),
|
||||
"DescribePixelFormat failed with error: %u\n", GetLastError());
|
||||
}
|
||||
ReleaseDC( hwnd, hdc );
|
||||
DestroyWindow( hwnd );
|
||||
|
||||
|
@ -288,105 +249,61 @@ static void test_choosepixelformat(void)
|
|||
0, /* reserved */
|
||||
0, 0, 0 /* layer masks */
|
||||
};
|
||||
PIXELFORMATDESCRIPTOR ret_fmt;
|
||||
|
||||
ok( test_pfd(&pfd, NULL), "Simple pfd failed\n" );
|
||||
ok( test_pfd(&pfd), "Simple pfd failed\n" );
|
||||
pfd.dwFlags |= PFD_DOUBLEBUFFER_DONTCARE;
|
||||
ok( test_pfd(&pfd, NULL), "PFD_DOUBLEBUFFER_DONTCARE failed\n" );
|
||||
ok( test_pfd(&pfd), "PFD_DOUBLEBUFFER_DONTCARE failed\n" );
|
||||
pfd.dwFlags |= PFD_STEREO_DONTCARE;
|
||||
ok( test_pfd(&pfd, NULL), "PFD_DOUBLEBUFFER_DONTCARE|PFD_STEREO_DONTCARE failed\n" );
|
||||
ok( test_pfd(&pfd), "PFD_DOUBLEBUFFER_DONTCARE|PFD_STEREO_DONTCARE failed\n" );
|
||||
pfd.dwFlags &= ~PFD_DOUBLEBUFFER_DONTCARE;
|
||||
ok( test_pfd(&pfd, NULL), "PFD_STEREO_DONTCARE failed\n" );
|
||||
ok( test_pfd(&pfd), "PFD_STEREO_DONTCARE failed\n" );
|
||||
pfd.dwFlags &= ~PFD_STEREO_DONTCARE;
|
||||
pfd.iPixelType = 32;
|
||||
ok( test_pfd(&pfd, &ret_fmt), "Invalid pixel format 32 failed\n" );
|
||||
ok( ret_fmt.iPixelType == PFD_TYPE_RGBA, "Expected pixel type PFD_TYPE_RGBA, got %d\n", ret_fmt.iPixelType );
|
||||
pfd.iPixelType = 33;
|
||||
ok( test_pfd(&pfd, &ret_fmt), "Invalid pixel format 33 failed\n" );
|
||||
ok( ret_fmt.iPixelType == PFD_TYPE_RGBA, "Expected pixel type PFD_TYPE_RGBA, got %d\n", ret_fmt.iPixelType );
|
||||
pfd.iPixelType = 15;
|
||||
ok( test_pfd(&pfd, &ret_fmt), "Invalid pixel format 15 failed\n" );
|
||||
ok( ret_fmt.iPixelType == PFD_TYPE_RGBA, "Expected pixel type PFD_TYPE_RGBA, got %d\n", ret_fmt.iPixelType );
|
||||
pfd.iPixelType = PFD_TYPE_RGBA;
|
||||
|
||||
pfd.cColorBits = 32;
|
||||
ok( test_pfd(&pfd, NULL), "Simple pfd failed\n" );
|
||||
ok( test_pfd(&pfd), "Simple pfd failed\n" );
|
||||
pfd.dwFlags |= PFD_DOUBLEBUFFER_DONTCARE;
|
||||
ok( test_pfd(&pfd, NULL), "PFD_DOUBLEBUFFER_DONTCARE failed\n" );
|
||||
ok( test_pfd(&pfd), "PFD_DOUBLEBUFFER_DONTCARE failed\n" );
|
||||
pfd.dwFlags |= PFD_STEREO_DONTCARE;
|
||||
ok( test_pfd(&pfd, NULL), "PFD_DOUBLEBUFFER_DONTCARE|PFD_STEREO_DONTCARE failed\n" );
|
||||
ok( test_pfd(&pfd), "PFD_DOUBLEBUFFER_DONTCARE|PFD_STEREO_DONTCARE failed\n" );
|
||||
pfd.dwFlags &= ~PFD_DOUBLEBUFFER_DONTCARE;
|
||||
ok( test_pfd(&pfd, NULL), "PFD_STEREO_DONTCARE failed\n" );
|
||||
ok( test_pfd(&pfd), "PFD_STEREO_DONTCARE failed\n" );
|
||||
pfd.dwFlags &= ~PFD_STEREO_DONTCARE;
|
||||
pfd.cColorBits = 0;
|
||||
|
||||
pfd.cAlphaBits = 8;
|
||||
ok( test_pfd(&pfd, NULL), "Simple pfd failed\n" );
|
||||
ok( test_pfd(&pfd), "Simple pfd failed\n" );
|
||||
pfd.dwFlags |= PFD_DOUBLEBUFFER_DONTCARE;
|
||||
ok( test_pfd(&pfd, NULL), "PFD_DOUBLEBUFFER_DONTCARE failed\n" );
|
||||
ok( test_pfd(&pfd), "PFD_DOUBLEBUFFER_DONTCARE failed\n" );
|
||||
pfd.dwFlags |= PFD_STEREO_DONTCARE;
|
||||
ok( test_pfd(&pfd, NULL), "PFD_DOUBLEBUFFER_DONTCARE|PFD_STEREO_DONTCARE failed\n" );
|
||||
ok( test_pfd(&pfd), "PFD_DOUBLEBUFFER_DONTCARE|PFD_STEREO_DONTCARE failed\n" );
|
||||
pfd.dwFlags &= ~PFD_DOUBLEBUFFER_DONTCARE;
|
||||
ok( test_pfd(&pfd, NULL), "PFD_STEREO_DONTCARE failed\n" );
|
||||
ok( test_pfd(&pfd), "PFD_STEREO_DONTCARE failed\n" );
|
||||
pfd.dwFlags &= ~PFD_STEREO_DONTCARE;
|
||||
pfd.cAlphaBits = 0;
|
||||
|
||||
pfd.cStencilBits = 8;
|
||||
ok( test_pfd(&pfd, NULL), "Simple pfd failed\n" );
|
||||
ok( test_pfd(&pfd), "Simple pfd failed\n" );
|
||||
pfd.dwFlags |= PFD_DOUBLEBUFFER_DONTCARE;
|
||||
ok( test_pfd(&pfd, NULL), "PFD_DOUBLEBUFFER_DONTCARE failed\n" );
|
||||
ok( test_pfd(&pfd), "PFD_DOUBLEBUFFER_DONTCARE failed\n" );
|
||||
pfd.dwFlags |= PFD_STEREO_DONTCARE;
|
||||
ok( test_pfd(&pfd, NULL), "PFD_DOUBLEBUFFER_DONTCARE|PFD_STEREO_DONTCARE failed\n" );
|
||||
ok( test_pfd(&pfd), "PFD_DOUBLEBUFFER_DONTCARE|PFD_STEREO_DONTCARE failed\n" );
|
||||
pfd.dwFlags &= ~PFD_DOUBLEBUFFER_DONTCARE;
|
||||
ok( test_pfd(&pfd, NULL), "PFD_STEREO_DONTCARE failed\n" );
|
||||
ok( test_pfd(&pfd), "PFD_STEREO_DONTCARE failed\n" );
|
||||
pfd.dwFlags &= ~PFD_STEREO_DONTCARE;
|
||||
pfd.cStencilBits = 0;
|
||||
|
||||
pfd.cAuxBuffers = 1;
|
||||
ok( test_pfd(&pfd, NULL), "Simple pfd failed\n" );
|
||||
ok( test_pfd(&pfd), "Simple pfd failed\n" );
|
||||
pfd.dwFlags |= PFD_DOUBLEBUFFER_DONTCARE;
|
||||
ok( test_pfd(&pfd, NULL), "PFD_DOUBLEBUFFER_DONTCARE failed\n" );
|
||||
ok( test_pfd(&pfd), "PFD_DOUBLEBUFFER_DONTCARE failed\n" );
|
||||
pfd.dwFlags |= PFD_STEREO_DONTCARE;
|
||||
ok( test_pfd(&pfd, NULL), "PFD_DOUBLEBUFFER_DONTCARE|PFD_STEREO_DONTCARE failed\n" );
|
||||
ok( test_pfd(&pfd), "PFD_DOUBLEBUFFER_DONTCARE|PFD_STEREO_DONTCARE failed\n" );
|
||||
pfd.dwFlags &= ~PFD_DOUBLEBUFFER_DONTCARE;
|
||||
ok( test_pfd(&pfd, NULL), "PFD_STEREO_DONTCARE failed\n" );
|
||||
ok( test_pfd(&pfd), "PFD_STEREO_DONTCARE failed\n" );
|
||||
pfd.dwFlags &= ~PFD_STEREO_DONTCARE;
|
||||
pfd.cAuxBuffers = 0;
|
||||
}
|
||||
|
||||
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;
|
||||
|
@ -464,7 +381,7 @@ static void test_setpixelformat(HDC winhdc)
|
|||
ok( GetLastError() == ERROR_INVALID_PIXEL_FORMAT, "wrong error %u\n", GetLastError() );
|
||||
SetLastError( 0xdeadbeef );
|
||||
res = SetPixelFormat( hdc, pf, &pfd );
|
||||
ok( i == 0, "SetPixelFormat succeeded\n" );
|
||||
ok( !res, "SetPixelFormat succeeded\n" );
|
||||
ok( GetLastError() == ERROR_INVALID_HANDLE, "wrong error %u\n", GetLastError() );
|
||||
SetLastError( 0xdeadbeef );
|
||||
res = DescribePixelFormat( hdc, 0, 0, NULL );
|
||||
|
@ -525,7 +442,7 @@ static void test_sharelists(HDC winhdc)
|
|||
res = wglMakeCurrent(winhdc, hglrc2);
|
||||
ok(res, "Make current failed\n");
|
||||
res = wglShareLists(hglrc1, hglrc2);
|
||||
ok(res, "Sharing display lists with a destination context which has been made current failed\n");
|
||||
todo_wine ok(res, "Sharing display lists with a destination context which has been made current failed\n");
|
||||
wglMakeCurrent(0, 0);
|
||||
wglDeleteContext(hglrc2);
|
||||
}
|
||||
|
@ -1870,7 +1787,6 @@ START_TEST(opengl)
|
|||
}
|
||||
|
||||
test_choosepixelformat();
|
||||
test_debug_message_callback();
|
||||
test_setpixelformat(hdc);
|
||||
test_destroy(hdc);
|
||||
test_sharelists(hdc);
|
||||
|
|
Loading…
Reference in a new issue