From 59772a53ed86a56b271f3f697723eeadfd00d923 Mon Sep 17 00:00:00 2001 From: Daniel Lehman Date: Wed, 21 Jun 2017 16:00:22 -0700 Subject: [PATCH 2/2] opengl32: Don't fail if both PFD_DOUBLEBUFFER_DONTCARE and PFD_STEREO_DONTCARE are specified. if both PFD is lenient and DONTCARE is used for both DOUBLEBUFFER and STEREO, then ChoosePixelFormat can end up with no format if DONTCARE for either DOUBLEBUFFER or STEREO is specified and no best one has been found yet, take the first available Signed-off-by: Daniel Lehman --- dlls/opengl32/tests/opengl.c | 2 +- dlls/opengl32/wgl.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/dlls/opengl32/tests/opengl.c b/dlls/opengl32/tests/opengl.c index 3366cb2..5d3a245 100644 --- a/dlls/opengl32/tests/opengl.c +++ b/dlls/opengl32/tests/opengl.c @@ -277,7 +277,7 @@ static void test_choosepixelformat(void) pfd.dwFlags |= PFD_DOUBLEBUFFER_DONTCARE; ok( test_pfd(&pfd), "PFD_DOUBLEBUFFER_DONTCARE failed\n" ); pfd.dwFlags |= PFD_STEREO_DONTCARE; - todo_wine ok( test_pfd(&pfd), "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), "PFD_STEREO_DONTCARE failed\n" ); pfd.dwFlags &= ~PFD_STEREO_DONTCARE; diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c index 73be013..dafafb6 100644 --- a/dlls/opengl32/wgl.c +++ b/dlls/opengl32/wgl.c @@ -517,6 +517,8 @@ INT WINAPI wglChoosePixelFormat(HDC hdc, const PIXELFORMATDESCRIPTOR* ppfd) if (bestDBuffer != -1 && (format.dwFlags & PFD_DOUBLEBUFFER) != bestDBuffer) continue; } + else if (!best_format) + goto found; /* Stereo, see the comments above. */ if (!(ppfd->dwFlags & PFD_STEREO_DONTCARE)) @@ -527,6 +529,8 @@ INT WINAPI wglChoosePixelFormat(HDC hdc, const PIXELFORMATDESCRIPTOR* ppfd) if (bestStereo != -1 && (format.dwFlags & PFD_STEREO) != bestStereo) continue; } + else if (!best_format) + goto found; /* Below we will do a number of checks to select the 'best' pixelformat. * We assume the precedence cColorBits > cAlphaBits > cDepthBits > cStencilBits -> cAuxBuffers. -- 1.9.5