wgl: Take pixelformat color channels into account for choosing a PFD
Otherwise there's no way to target PIPE_FORMAT_B4G4R4A4_UNORM instead of the B5G6R5 or B5G5R5A1 if those are supported. This gets the behavior closer to the Windows PFD selection. Reviewed-by: Jose Fonseca <jfonseca@vmware.com> Reviewed-by: Neha Bhende <bhenden@vmware.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25979>
This commit is contained in:
@@ -531,7 +531,6 @@ stw_pixelformat_choose(HDC hdc, CONST PIXELFORMATDESCRIPTOR *ppfd)
|
||||
* - Giving no more bits than requested is given lowest priority.
|
||||
*/
|
||||
|
||||
/* FIXME: Take in account individual channel bits */
|
||||
if (ppfd->cColorBits && !pfi->pfd.cColorBits)
|
||||
delta += 10000;
|
||||
else if (ppfd->cColorBits > pfi->pfd.cColorBits)
|
||||
@@ -560,6 +559,27 @@ stw_pixelformat_choose(HDC hdc, CONST PIXELFORMATDESCRIPTOR *ppfd)
|
||||
else if (ppfd->cAlphaBits < pfi->pfd.cAlphaBits)
|
||||
delta++;
|
||||
|
||||
if (ppfd->cRedBits && !pfi->pfd.cRedBits)
|
||||
delta += 10000;
|
||||
else if (ppfd->cRedBits > pfi->pfd.cRedBits)
|
||||
delta += 100;
|
||||
else if (ppfd->cRedBits < pfi->pfd.cRedBits)
|
||||
delta++;
|
||||
|
||||
if (ppfd->cGreenBits && !pfi->pfd.cGreenBits)
|
||||
delta += 10000;
|
||||
else if (ppfd->cGreenBits > pfi->pfd.cGreenBits)
|
||||
delta += 100;
|
||||
else if (ppfd->cGreenBits < pfi->pfd.cGreenBits)
|
||||
delta++;
|
||||
|
||||
if (ppfd->cBlueBits && !pfi->pfd.cBlueBits)
|
||||
delta += 10000;
|
||||
else if (ppfd->cBlueBits > pfi->pfd.cBlueBits)
|
||||
delta += 100;
|
||||
else if (ppfd->cBlueBits < pfi->pfd.cBlueBits)
|
||||
delta++;
|
||||
|
||||
if (delta < bestdelta) {
|
||||
bestindex = index;
|
||||
bestdelta = delta;
|
||||
|
Reference in New Issue
Block a user