opengl32: Treat invalid pixel types as PFD_TYPE_RGBA in wglChoosePixelFormat.
Also fixes "Plebby Quest: The Crusades". Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=43638 Signed-off-by: Paul Gofman <pgofman@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
2d86752198
commit
ee12fb0e32
|
@ -220,7 +220,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");
|
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)
|
static int test_pfd(const PIXELFORMATDESCRIPTOR *pfd, PIXELFORMATDESCRIPTOR *fmt)
|
||||||
{
|
{
|
||||||
int pf;
|
int pf;
|
||||||
HDC hdc;
|
HDC hdc;
|
||||||
|
@ -233,6 +233,12 @@ static int test_pfd(const PIXELFORMATDESCRIPTOR *pfd)
|
||||||
|
|
||||||
hdc = GetDC( hwnd );
|
hdc = GetDC( hwnd );
|
||||||
pf = ChoosePixelFormat( hdc, pfd );
|
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 );
|
ReleaseDC( hwnd, hdc );
|
||||||
DestroyWindow( hwnd );
|
DestroyWindow( hwnd );
|
||||||
|
|
||||||
|
@ -259,57 +265,68 @@ static void test_choosepixelformat(void)
|
||||||
0, /* reserved */
|
0, /* reserved */
|
||||||
0, 0, 0 /* layer masks */
|
0, 0, 0 /* layer masks */
|
||||||
};
|
};
|
||||||
|
PIXELFORMATDESCRIPTOR ret_fmt;
|
||||||
|
|
||||||
ok( test_pfd(&pfd), "Simple pfd failed\n" );
|
ok( test_pfd(&pfd, NULL), "Simple pfd failed\n" );
|
||||||
pfd.dwFlags |= PFD_DOUBLEBUFFER_DONTCARE;
|
pfd.dwFlags |= PFD_DOUBLEBUFFER_DONTCARE;
|
||||||
ok( test_pfd(&pfd), "PFD_DOUBLEBUFFER_DONTCARE failed\n" );
|
ok( test_pfd(&pfd, NULL), "PFD_DOUBLEBUFFER_DONTCARE failed\n" );
|
||||||
pfd.dwFlags |= PFD_STEREO_DONTCARE;
|
pfd.dwFlags |= PFD_STEREO_DONTCARE;
|
||||||
ok( test_pfd(&pfd), "PFD_DOUBLEBUFFER_DONTCARE|PFD_STEREO_DONTCARE failed\n" );
|
ok( test_pfd(&pfd, NULL), "PFD_DOUBLEBUFFER_DONTCARE|PFD_STEREO_DONTCARE failed\n" );
|
||||||
pfd.dwFlags &= ~PFD_DOUBLEBUFFER_DONTCARE;
|
pfd.dwFlags &= ~PFD_DOUBLEBUFFER_DONTCARE;
|
||||||
ok( test_pfd(&pfd), "PFD_STEREO_DONTCARE failed\n" );
|
ok( test_pfd(&pfd, NULL), "PFD_STEREO_DONTCARE failed\n" );
|
||||||
pfd.dwFlags &= ~PFD_STEREO_DONTCARE;
|
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;
|
pfd.cColorBits = 32;
|
||||||
ok( test_pfd(&pfd), "Simple pfd failed\n" );
|
ok( test_pfd(&pfd, NULL), "Simple pfd failed\n" );
|
||||||
pfd.dwFlags |= PFD_DOUBLEBUFFER_DONTCARE;
|
pfd.dwFlags |= PFD_DOUBLEBUFFER_DONTCARE;
|
||||||
ok( test_pfd(&pfd), "PFD_DOUBLEBUFFER_DONTCARE failed\n" );
|
ok( test_pfd(&pfd, NULL), "PFD_DOUBLEBUFFER_DONTCARE failed\n" );
|
||||||
pfd.dwFlags |= PFD_STEREO_DONTCARE;
|
pfd.dwFlags |= PFD_STEREO_DONTCARE;
|
||||||
ok( test_pfd(&pfd), "PFD_DOUBLEBUFFER_DONTCARE|PFD_STEREO_DONTCARE failed\n" );
|
ok( test_pfd(&pfd, NULL), "PFD_DOUBLEBUFFER_DONTCARE|PFD_STEREO_DONTCARE failed\n" );
|
||||||
pfd.dwFlags &= ~PFD_DOUBLEBUFFER_DONTCARE;
|
pfd.dwFlags &= ~PFD_DOUBLEBUFFER_DONTCARE;
|
||||||
ok( test_pfd(&pfd), "PFD_STEREO_DONTCARE failed\n" );
|
ok( test_pfd(&pfd, NULL), "PFD_STEREO_DONTCARE failed\n" );
|
||||||
pfd.dwFlags &= ~PFD_STEREO_DONTCARE;
|
pfd.dwFlags &= ~PFD_STEREO_DONTCARE;
|
||||||
pfd.cColorBits = 0;
|
pfd.cColorBits = 0;
|
||||||
|
|
||||||
pfd.cAlphaBits = 8;
|
pfd.cAlphaBits = 8;
|
||||||
ok( test_pfd(&pfd), "Simple pfd failed\n" );
|
ok( test_pfd(&pfd, NULL), "Simple pfd failed\n" );
|
||||||
pfd.dwFlags |= PFD_DOUBLEBUFFER_DONTCARE;
|
pfd.dwFlags |= PFD_DOUBLEBUFFER_DONTCARE;
|
||||||
ok( test_pfd(&pfd), "PFD_DOUBLEBUFFER_DONTCARE failed\n" );
|
ok( test_pfd(&pfd, NULL), "PFD_DOUBLEBUFFER_DONTCARE failed\n" );
|
||||||
pfd.dwFlags |= PFD_STEREO_DONTCARE;
|
pfd.dwFlags |= PFD_STEREO_DONTCARE;
|
||||||
ok( test_pfd(&pfd), "PFD_DOUBLEBUFFER_DONTCARE|PFD_STEREO_DONTCARE failed\n" );
|
ok( test_pfd(&pfd, NULL), "PFD_DOUBLEBUFFER_DONTCARE|PFD_STEREO_DONTCARE failed\n" );
|
||||||
pfd.dwFlags &= ~PFD_DOUBLEBUFFER_DONTCARE;
|
pfd.dwFlags &= ~PFD_DOUBLEBUFFER_DONTCARE;
|
||||||
ok( test_pfd(&pfd), "PFD_STEREO_DONTCARE failed\n" );
|
ok( test_pfd(&pfd, NULL), "PFD_STEREO_DONTCARE failed\n" );
|
||||||
pfd.dwFlags &= ~PFD_STEREO_DONTCARE;
|
pfd.dwFlags &= ~PFD_STEREO_DONTCARE;
|
||||||
pfd.cAlphaBits = 0;
|
pfd.cAlphaBits = 0;
|
||||||
|
|
||||||
pfd.cStencilBits = 8;
|
pfd.cStencilBits = 8;
|
||||||
ok( test_pfd(&pfd), "Simple pfd failed\n" );
|
ok( test_pfd(&pfd, NULL), "Simple pfd failed\n" );
|
||||||
pfd.dwFlags |= PFD_DOUBLEBUFFER_DONTCARE;
|
pfd.dwFlags |= PFD_DOUBLEBUFFER_DONTCARE;
|
||||||
ok( test_pfd(&pfd), "PFD_DOUBLEBUFFER_DONTCARE failed\n" );
|
ok( test_pfd(&pfd, NULL), "PFD_DOUBLEBUFFER_DONTCARE failed\n" );
|
||||||
pfd.dwFlags |= PFD_STEREO_DONTCARE;
|
pfd.dwFlags |= PFD_STEREO_DONTCARE;
|
||||||
ok( test_pfd(&pfd), "PFD_DOUBLEBUFFER_DONTCARE|PFD_STEREO_DONTCARE failed\n" );
|
ok( test_pfd(&pfd, NULL), "PFD_DOUBLEBUFFER_DONTCARE|PFD_STEREO_DONTCARE failed\n" );
|
||||||
pfd.dwFlags &= ~PFD_DOUBLEBUFFER_DONTCARE;
|
pfd.dwFlags &= ~PFD_DOUBLEBUFFER_DONTCARE;
|
||||||
ok( test_pfd(&pfd), "PFD_STEREO_DONTCARE failed\n" );
|
ok( test_pfd(&pfd, NULL), "PFD_STEREO_DONTCARE failed\n" );
|
||||||
pfd.dwFlags &= ~PFD_STEREO_DONTCARE;
|
pfd.dwFlags &= ~PFD_STEREO_DONTCARE;
|
||||||
pfd.cStencilBits = 0;
|
pfd.cStencilBits = 0;
|
||||||
|
|
||||||
pfd.cAuxBuffers = 1;
|
pfd.cAuxBuffers = 1;
|
||||||
ok( test_pfd(&pfd), "Simple pfd failed\n" );
|
ok( test_pfd(&pfd, NULL), "Simple pfd failed\n" );
|
||||||
pfd.dwFlags |= PFD_DOUBLEBUFFER_DONTCARE;
|
pfd.dwFlags |= PFD_DOUBLEBUFFER_DONTCARE;
|
||||||
ok( test_pfd(&pfd), "PFD_DOUBLEBUFFER_DONTCARE failed\n" );
|
ok( test_pfd(&pfd, NULL), "PFD_DOUBLEBUFFER_DONTCARE failed\n" );
|
||||||
pfd.dwFlags |= PFD_STEREO_DONTCARE;
|
pfd.dwFlags |= PFD_STEREO_DONTCARE;
|
||||||
ok( test_pfd(&pfd), "PFD_DOUBLEBUFFER_DONTCARE|PFD_STEREO_DONTCARE failed\n" );
|
ok( test_pfd(&pfd, NULL), "PFD_DOUBLEBUFFER_DONTCARE|PFD_STEREO_DONTCARE failed\n" );
|
||||||
pfd.dwFlags &= ~PFD_DOUBLEBUFFER_DONTCARE;
|
pfd.dwFlags &= ~PFD_DOUBLEBUFFER_DONTCARE;
|
||||||
ok( test_pfd(&pfd), "PFD_STEREO_DONTCARE failed\n" );
|
ok( test_pfd(&pfd, NULL), "PFD_STEREO_DONTCARE failed\n" );
|
||||||
pfd.dwFlags &= ~PFD_STEREO_DONTCARE;
|
pfd.dwFlags &= ~PFD_STEREO_DONTCARE;
|
||||||
pfd.cAuxBuffers = 0;
|
pfd.cAuxBuffers = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -475,7 +475,7 @@ INT WINAPI wglChoosePixelFormat(HDC hdc, const PIXELFORMATDESCRIPTOR* ppfd)
|
||||||
{
|
{
|
||||||
if (!wglDescribePixelFormat( hdc, i, sizeof(format), &format )) continue;
|
if (!wglDescribePixelFormat( hdc, i, sizeof(format), &format )) continue;
|
||||||
|
|
||||||
if (ppfd->iPixelType != format.iPixelType)
|
if ((ppfd->iPixelType == PFD_TYPE_COLORINDEX) != (format.iPixelType == PFD_TYPE_COLORINDEX))
|
||||||
{
|
{
|
||||||
TRACE( "pixel type mismatch for iPixelFormat=%d\n", i );
|
TRACE( "pixel type mismatch for iPixelFormat=%d\n", i );
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in New Issue