Commit 2bec5b14 authored by Roderick Colenbrander's avatar Roderick Colenbrander Committed by Alexandre Julliard

wgl: Add a test for WGL_ACCELERATION_ARB and the PFD_GENERIC_* flags.

parent d66ded93
......@@ -51,6 +51,7 @@ static BOOL (WINAPI *pwglMakeContextCurrentARB)(HDC hdraw, HDC hread, HGLRC hglr
static HDC (WINAPI *pwglGetCurrentReadDCARB)();
/* 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
......@@ -58,6 +59,9 @@ static HDC (WINAPI *pwglGetCurrentReadDCARB)();
#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 *);
......@@ -416,6 +420,49 @@ static void test_gdi_dbuf(HDC hdc)
}
}
static void test_acceleration(HDC hdc)
{
const int iAttribList[] = { WGL_ACCELERATION_ARB };
int iAttribRet[sizeof(iAttribList)/sizeof(iAttribList[0])];
unsigned int nFormats;
int iPixelFormat;
int res;
PIXELFORMATDESCRIPTOR pfd;
if (!pwglGetPixelFormatAttribivARB)
{
win_skip("wglGetPixelFormatAttribivARB is not available\n");
return;
}
nFormats = DescribePixelFormat(hdc, 0, 0, NULL);
for(iPixelFormat = 1; iPixelFormat <= nFormats; iPixelFormat++)
{
res = pwglGetPixelFormatAttribivARB(hdc, iPixelFormat, 0,
sizeof(iAttribList)/sizeof(iAttribList[0]), iAttribList,
iAttribRet);
ok(res!=FALSE, "wglGetPixelFormatAttribivARB failed for pixel format %d\n", iPixelFormat);
if(res == FALSE)
continue;
memset(&pfd, 0, sizeof(PIXELFORMATDESCRIPTOR));
DescribePixelFormat(hdc, iPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
switch(iAttribRet[0])
{
case WGL_NO_ACCELERATION_ARB:
ok( (pfd.dwFlags & (PFD_GENERIC_FORMAT | PFD_GENERIC_ACCELERATED)) == PFD_GENERIC_FORMAT , "Expected only PFD_GENERIC_FORMAT to be set for WGL_NO_ACCELERATION_ARB!: iPixelFormat=%d, dwFlags=%x!\n", iPixelFormat, pfd.dwFlags);
break;
case WGL_GENERIC_ACCELERATION_ARB:
ok( (pfd.dwFlags & (PFD_GENERIC_FORMAT | PFD_GENERIC_ACCELERATED)) == (PFD_GENERIC_FORMAT | PFD_GENERIC_ACCELERATED), "Expected both PFD_GENERIC_FORMAT and PFD_GENERIC_ACCELERATION to be set for WGL_GENERIC_ACCELERATION_ARB: iPixelFormat=%d, dwFlags=%x!\n", iPixelFormat, pfd.dwFlags);
break;
case WGL_FULL_ACCELERATION_ARB:
ok( (pfd.dwFlags & (PFD_GENERIC_FORMAT | PFD_GENERIC_ACCELERATED)) == 0, "Expected no PFD_GENERIC_FORMAT/_ACCELERATION to be set for WGL_FULL_ACCELERATION_ARB: iPixelFormat=%d, dwFlags=%x!\n", iPixelFormat, pfd.dwFlags);
break;
}
}
}
static void test_make_current_read(HDC hdc)
{
int res;
......@@ -657,6 +704,7 @@ START_TEST(opengl)
test_sharelists(hdc);
test_colorbits(hdc);
test_gdi_dbuf(hdc);
test_acceleration(hdc);
wgl_extensions = pwglGetExtensionsStringARB(hdc);
if(wgl_extensions == NULL) skip("Skipping opengl32 tests because this OpenGL implementation doesn't support WGL extensions!\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment