Paul Gofman : opengl32: Support PFD_DEPTH_DONTCARE flag in wglChoosePixelFormat().
Alexandre Julliard
julliard at winehq.org
Fri Feb 12 14:37:37 CST 2021
Module: wine
Branch: master
Commit: 45f8b6924a45188a2fc20504545ef40f62b028da
URL: https://source.winehq.org/git/wine.git/?a=commit;h=45f8b6924a45188a2fc20504545ef40f62b028da
Author: Paul Gofman <pgofman at codeweavers.com>
Date: Thu Feb 11 13:04:51 2021 +0300
opengl32: Support PFD_DEPTH_DONTCARE flag in wglChoosePixelFormat().
With this flag set native implementation ignores cDepthBits but
cares to find a zero depth format if possible.
Signed-off-by: Paul Gofman <pgofman at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/opengl32/tests/opengl.c | 12 ++++++++++++
dlls/opengl32/wgl.c | 5 ++++-
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/dlls/opengl32/tests/opengl.c b/dlls/opengl32/tests/opengl.c
index 90f06492e81..e93636ed75e 100644
--- a/dlls/opengl32/tests/opengl.c
+++ b/dlls/opengl32/tests/opengl.c
@@ -330,6 +330,18 @@ static void test_choosepixelformat(void)
ok( test_pfd(&pfd, NULL), "PFD_STEREO_DONTCARE failed\n" );
pfd.dwFlags &= ~PFD_STEREO_DONTCARE;
pfd.cAuxBuffers = 0;
+
+ pfd.dwFlags |= PFD_DEPTH_DONTCARE;
+ pfd.cDepthBits = 24;
+ ok( test_pfd(&pfd, &ret_fmt), "PFD_DEPTH_DONTCARE failed.\n" );
+ ok( !ret_fmt.cDepthBits, "Got unexpected cDepthBits %u.\n", ret_fmt.cDepthBits );
+ pfd.cStencilBits = 8;
+ ok( test_pfd(&pfd, &ret_fmt), "PFD_DEPTH_DONTCARE, depth 24, stencil 8 failed.\n" );
+ ok( !ret_fmt.cDepthBits || ret_fmt.cDepthBits == 24, "Got unexpected cDepthBits %u.\n", ret_fmt.cDepthBits );
+ ok( ret_fmt.cStencilBits == 8, "Got unexpected cStencilBits %u.\n", ret_fmt.cStencilBits );
+ pfd.cDepthBits = 0;
+ pfd.cStencilBits = 0;
+ pfd.dwFlags &= ~PFD_DEPTH_DONTCARE;
}
static void WINAPI gl_debug_message_callback(GLenum source, GLenum type, GLuint id, GLenum severity,
diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c
index a1422fbfcd4..cf46c6dfa8a 100644
--- a/dlls/opengl32/wgl.c
+++ b/dlls/opengl32/wgl.c
@@ -563,7 +563,7 @@ INT WINAPI wglChoosePixelFormat(HDC hdc, const PIXELFORMATDESCRIPTOR* ppfd)
continue;
}
}
- if (ppfd->cDepthBits)
+ if (ppfd->cDepthBits && !(ppfd->dwFlags & PFD_DEPTH_DONTCARE))
{
if (((ppfd->cDepthBits > best.cDepthBits) && (format.cDepthBits > best.cDepthBits)) ||
((format.cDepthBits >= ppfd->cDepthBits) && (format.cDepthBits < best.cDepthBits)))
@@ -599,6 +599,9 @@ INT WINAPI wglChoosePixelFormat(HDC hdc, const PIXELFORMATDESCRIPTOR* ppfd)
continue;
}
}
+ if (ppfd->dwFlags & PFD_DEPTH_DONTCARE && format.cDepthBits < best.cDepthBits)
+ goto found;
+
continue;
found:
More information about the wine-cvs
mailing list