Module: wine
Branch: master
Commit: 01c59b3f18dca1f4db42425eda2f95296da61a63
URL:
https://gitlab.winehq.org/wine/wine/-/commit/01c59b3f18dca1f4db42425eda2f95…
Author: Paul Gofman <pgofman(a)codeweavers.com>
Date: Mon Apr 10 16:20:38 2023 -0600
winex11.drv: Fix bit shifts in pixel format description for RGBA formats.
---
dlls/opengl32/tests/opengl.c | 15 ++++++++++++++-
dlls/winex11.drv/opengl.c | 13 ++++++++-----
2 files changed, 22 insertions(+), 6 deletions(-)
diff --git a/dlls/opengl32/tests/opengl.c b/dlls/opengl32/tests/opengl.c
index fca0aea73e7..ca66818c408 100644
--- a/dlls/opengl32/tests/opengl.c
+++ b/dlls/opengl32/tests/opengl.c
@@ -288,7 +288,20 @@ static void test_choosepixelformat(void)
pfd.iPixelType = PFD_TYPE_RGBA;
pfd.cColorBits = 32;
- ok( test_pfd(&pfd, NULL), "Simple pfd failed\n" );
+ ok( test_pfd(&pfd, &ret_fmt), "Simple pfd failed\n" );
+ ok( ret_fmt.cColorBits == 32, "Got %u.\n", ret_fmt.cColorBits );
+ ok( !ret_fmt.cBlueShift, "Got %u.\n", ret_fmt.cBlueShift );
+ ok( ret_fmt.cBlueBits == 8, "Got %u.\n", ret_fmt.cBlueBits );
+ ok( ret_fmt.cRedBits == 8, "Got %u.\n", ret_fmt.cRedBits );
+ ok( ret_fmt.cGreenBits == 8, "Got %u.\n", ret_fmt.cGreenBits );
+ ok( ret_fmt.cGreenShift == 8, "Got %u.\n", ret_fmt.cGreenShift );
+ ok( ret_fmt.cRedShift == 16, "Got %u.\n", ret_fmt.cRedShift );
+ ok( !ret_fmt.cAlphaBits || ret_fmt.cAlphaBits == 8, "Got %u.\n",
ret_fmt.cAlphaBits );
+ if (ret_fmt.cAlphaBits)
+ ok( ret_fmt.cAlphaShift == 24, "Got %u.\n", ret_fmt.cAlphaShift );
+ else
+ ok( !ret_fmt.cAlphaShift, "Got %u.\n", ret_fmt.cAlphaShift );
+
pfd.dwFlags |= PFD_DOUBLEBUFFER_DONTCARE;
ok( test_pfd(&pfd, NULL), "PFD_DOUBLEBUFFER_DONTCARE failed\n" );
pfd.dwFlags |= PFD_STEREO_DONTCARE;
diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c
index 8c1ab90595a..aadc0b99cd1 100644
--- a/dlls/winex11.drv/opengl.c
+++ b/dlls/winex11.drv/opengl.c
@@ -1601,14 +1601,17 @@ static int describe_pixel_format( int iPixelFormat,
PIXELFORMATDESCRIPTOR *ppfd,
pglXGetFBConfigAttrib(gdi_display, fmt->fbconfig, GLX_BLUE_SIZE, &bb);
pglXGetFBConfigAttrib(gdi_display, fmt->fbconfig, GLX_ALPHA_SIZE, &ab);
- ppfd->cRedBits = rb;
- ppfd->cRedShift = gb + bb + ab;
ppfd->cBlueBits = bb;
- ppfd->cBlueShift = ab;
+ ppfd->cBlueShift = 0;
ppfd->cGreenBits = gb;
- ppfd->cGreenShift = bb + ab;
+ ppfd->cGreenShift = bb;
+ ppfd->cRedBits = rb;
+ ppfd->cRedShift = gb + bb;
ppfd->cAlphaBits = ab;
- ppfd->cAlphaShift = 0;
+ if (ab)
+ ppfd->cAlphaShift = rb + gb + bb;
+ else
+ ppfd->cAlphaShift = 0;
} else {
ppfd->cRedBits = 0;
ppfd->cRedShift = 0;