From 2bec5b14d2cc9f030d6ad2ab3bd92de8d91e2975 Mon Sep 17 00:00:00 2001 From: Roderick Colenbrander Date: Tue, 19 May 2009 21:16:58 +0200 Subject: [PATCH] wgl: Add a test for WGL_ACCELERATION_ARB and the PFD_GENERIC_* flags. --- dlls/opengl32/tests/opengl.c | 48 ++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/dlls/opengl32/tests/opengl.c b/dlls/opengl32/tests/opengl.c index 48a75f871b6..3078b794151 100644 --- a/dlls/opengl32/tests/opengl.c +++ b/dlls/opengl32/tests/opengl.c @@ -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");