mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-01-28 22:04:43 -08:00
Added patch to treat invalid pixel types as PFD_TYPE_RGBA in wglChoosePixelFormat.
This commit is contained in:
parent
7710cdb8c0
commit
83f27c90a6
@ -0,0 +1,142 @@
|
||||
From dd07559a20c219c50b2225c84f0b96a05a85e043 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Sat, 2 Sep 2017 04:20:21 +0200
|
||||
Subject: opengl32: Treat invalid pixel types as PFD_TYPE_RGBA in
|
||||
wglChoosePixelFormat.
|
||||
|
||||
---
|
||||
dlls/opengl32/tests/opengl.c | 59 ++++++++++++++++++++++++++++----------------
|
||||
dlls/opengl32/wgl.c | 2 +-
|
||||
2 files changed, 39 insertions(+), 22 deletions(-)
|
||||
|
||||
diff --git a/dlls/opengl32/tests/opengl.c b/dlls/opengl32/tests/opengl.c
|
||||
index db5ad76e96b..346b89d45ae 100644
|
||||
--- a/dlls/opengl32/tests/opengl.c
|
||||
+++ b/dlls/opengl32/tests/opengl.c
|
||||
@@ -242,7 +242,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");
|
||||
}
|
||||
|
||||
-static int test_pfd(const PIXELFORMATDESCRIPTOR *pfd)
|
||||
+static int test_pfd(const PIXELFORMATDESCRIPTOR *pfd, PIXELFORMATDESCRIPTOR *fmt)
|
||||
{
|
||||
int pf;
|
||||
HDC hdc;
|
||||
@@ -255,6 +255,12 @@ static int test_pfd(const PIXELFORMATDESCRIPTOR *pfd)
|
||||
|
||||
hdc = GetDC( hwnd );
|
||||
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 );
|
||||
DestroyWindow( hwnd );
|
||||
|
||||
@@ -282,57 +288,68 @@ static void test_choosepixelformat(void)
|
||||
0, /* reserved */
|
||||
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;
|
||||
- ok( test_pfd(&pfd), "PFD_DOUBLEBUFFER_DONTCARE failed\n" );
|
||||
+ ok( test_pfd(&pfd, NULL), "PFD_DOUBLEBUFFER_DONTCARE failed\n" );
|
||||
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;
|
||||
- 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.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;
|
||||
- ok( test_pfd(&pfd), "Simple pfd failed\n" );
|
||||
+ ok( test_pfd(&pfd, NULL), "Simple pfd failed\n" );
|
||||
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;
|
||||
- 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;
|
||||
- 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.cColorBits = 0;
|
||||
|
||||
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;
|
||||
- ok( test_pfd(&pfd), "PFD_DOUBLEBUFFER_DONTCARE failed\n" );
|
||||
+ ok( test_pfd(&pfd, NULL), "PFD_DOUBLEBUFFER_DONTCARE failed\n" );
|
||||
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;
|
||||
- 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.cAlphaBits = 0;
|
||||
|
||||
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;
|
||||
- ok( test_pfd(&pfd), "PFD_DOUBLEBUFFER_DONTCARE failed\n" );
|
||||
+ ok( test_pfd(&pfd, NULL), "PFD_DOUBLEBUFFER_DONTCARE failed\n" );
|
||||
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;
|
||||
- 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.cStencilBits = 0;
|
||||
|
||||
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;
|
||||
- ok( test_pfd(&pfd), "PFD_DOUBLEBUFFER_DONTCARE failed\n" );
|
||||
+ ok( test_pfd(&pfd, NULL), "PFD_DOUBLEBUFFER_DONTCARE failed\n" );
|
||||
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;
|
||||
- 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.cAuxBuffers = 0;
|
||||
}
|
||||
diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c
|
||||
index ae230bfcb0f..25920b6b119 100644
|
||||
--- a/dlls/opengl32/wgl.c
|
||||
+++ b/dlls/opengl32/wgl.c
|
||||
@@ -480,7 +480,7 @@ INT WINAPI wglChoosePixelFormat(HDC hdc, const PIXELFORMATDESCRIPTOR* ppfd)
|
||||
{
|
||||
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 );
|
||||
continue;
|
||||
--
|
||||
2.14.1
|
||||
|
1
patches/opengl32-wglChoosePixelFormat/definition
Normal file
1
patches/opengl32-wglChoosePixelFormat/definition
Normal file
@ -0,0 +1 @@
|
||||
Fixes: [43638] Treat invalid pixel types as PFD_TYPE_RGBA in wglChoosePixelFormat
|
@ -321,6 +321,7 @@ patch_enable_all ()
|
||||
enable_oleaut32_x86_64_Marshaller="$1"
|
||||
enable_opengl32_Revert_Disable_Ext="$1"
|
||||
enable_opengl32_glDebugMessageCallback="$1"
|
||||
enable_opengl32_wglChoosePixelFormat="$1"
|
||||
enable_packager_DllMain="$1"
|
||||
enable_quartz_MediaSeeking_Positions="$1"
|
||||
enable_quartz_Silence_FIXMEs="$1"
|
||||
@ -1241,6 +1242,9 @@ patch_enable ()
|
||||
opengl32-glDebugMessageCallback)
|
||||
enable_opengl32_glDebugMessageCallback="$2"
|
||||
;;
|
||||
opengl32-wglChoosePixelFormat)
|
||||
enable_opengl32_wglChoosePixelFormat="$2"
|
||||
;;
|
||||
packager-DllMain)
|
||||
enable_packager_DllMain="$2"
|
||||
;;
|
||||
@ -7439,6 +7443,21 @@ if test "$enable_opengl32_glDebugMessageCallback" -eq 1; then
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset opengl32-wglChoosePixelFormat
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
# | * [#43638] Treat invalid pixel types as PFD_TYPE_RGBA in wglChoosePixelFormat
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/opengl32/tests/opengl.c, dlls/opengl32/wgl.c
|
||||
# |
|
||||
if test "$enable_opengl32_wglChoosePixelFormat" -eq 1; then
|
||||
patch_apply opengl32-wglChoosePixelFormat/0001-opengl32-Treat-invalid-pixel-types-as-PFD_TYPE_RGBA-.patch
|
||||
(
|
||||
printf '%s\n' '+ { "Michael Müller", "opengl32: Treat invalid pixel types as PFD_TYPE_RGBA in wglChoosePixelFormat.", 1 },';
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset packager-DllMain
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
|
Loading…
x
Reference in New Issue
Block a user