From 4587363122092d83a46e24fe8f1f74c43f9ec8a2 Mon Sep 17 00:00:00 2001 From: Olivier Lauffenburger Date: Thu, 6 Jul 2017 10:06:20 +0100 Subject: [PATCH mesa] st/wgl: Signed-off-by: Olivier Lauffenburger --- src/gallium/state_trackers/wgl/stw_pixelformat.c | 40 +++++++++++++++++++----- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/src/gallium/state_trackers/wgl/stw_pixelformat.c b/src/gallium/state_trackers/wgl/stw_pixelformat.c index 7763f71cbc..f9a9743d7b 100644 --- a/src/gallium/state_trackers/wgl/stw_pixelformat.c +++ b/src/gallium/state_trackers/wgl/stw_pixelformat.c @@ -433,17 +433,41 @@ stw_pixelformat_choose(HDC hdc, CONST PIXELFORMATDESCRIPTOR *ppfd) continue; /* FIXME: Take in account individual channel bits */ - if (ppfd->cColorBits != pfi->pfd.cColorBits) - delta += 8; + if (ppfd->cColorBits != pfi->pfd.cColorBits) { + if (ppfd->cColorBits && !pfi->pfd.cColorBits) + delta += 10000; + else if (ppfd->cColorBits > pfi->pfd.cColorBits) + delta += 100; + else if (ppfd->cColorBits < pfi->pfd.cColorBits) + delta++; + } - if (ppfd->cDepthBits != pfi->pfd.cDepthBits) - delta += 4; + if (ppfd->cDepthBits != pfi->pfd.cDepthBits) { + if (ppfd->cDepthBits && !pfi->pfd.cDepthBits) + delta += 10000; + else if (ppfd->cDepthBits > pfi->pfd.cDepthBits) + delta += 200; + else if (ppfd->cDepthBits < pfi->pfd.cDepthBits) + delta += 2; + } - if (ppfd->cStencilBits != pfi->pfd.cStencilBits) - delta += 2; + if (ppfd->cStencilBits != pfi->pfd.cStencilBits) { + if (ppfd->cStencilBits && !pfi->pfd.cStencilBits) + delta += 10000; + else if (ppfd->cStencilBits > pfi->pfd.cStencilBits) + delta += 400; + else if (ppfd->cStencilBits < pfi->pfd.cStencilBits) + delta++; + } - if (ppfd->cAlphaBits != pfi->pfd.cAlphaBits) - delta++; + if (ppfd->cAlphaBits != pfi->pfd.cAlphaBits) { + if (ppfd->cAlphaBits && !pfi->pfd.cAlphaBits) + delta += 10000; + else if (ppfd->cAlphaBits > pfi->pfd.cAlphaBits) + delta += 100; + else if (ppfd->cAlphaBits < pfi->pfd.cAlphaBits) + delta++; + } if (delta < bestdelta) { bestindex = index; --