Commit 4707066c authored by keithw's avatar keithw
Browse files

adjust calculation of pVis->nplanes, fixes NWN

parent ee5eca10
......@@ -135,10 +135,9 @@ static XMesaVisual find_mesa_visual(int screen, VisualID vid)
/*
* In the case the driver defines no GLX visuals we'll use these.
* One thing is funny here: the bufferSize field doesn't always include
* the alpha bits. That is, bufferSize may be 24 when we have 8 bits
* of red, green, blue and alpha. If set set bufferSize to 32 we may
* foul-up the visual matching code below (search for bufferSize).
* Note that for TrueColor and DirectColor visuals, bufferSize is the
* sum of redSize, greenSize, blueSize and alphaSize, which may be larger
* than the nplanes/rootDepth of the server's X11 visuals
*/
#define NUM_FALLBACK_CONFIGS 5
static __GLXvisualConfig FallbackConfigs[NUM_FALLBACK_CONFIGS] = {
......@@ -405,7 +404,14 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp,
glXVisualPtr[j].greenMask = pVisual[i].greenMask;
glXVisualPtr[j].blueMask = pVisual[i].blueMask;
glXVisualPtr[j].alphaMask = glXVisualPtr[j].alphaMask;
glXVisualPtr[j].bufferSize = rootDepth;
if (is_rgb) {
glXVisualPtr[j].bufferSize = glXVisualPtr[j].redSize +
glXVisualPtr[j].greenSize +
glXVisualPtr[j].blueSize +
glXVisualPtr[j].alphaSize;
} else {
glXVisualPtr[j].bufferSize = rootDepth;
}
}
/* Save the device-dependent private for this visual */
......@@ -505,7 +511,7 @@ static void fixup_visuals(int screen)
/* Find a visual that matches the GLX visual's class and size */
for (j = 0; j < pScreen->numVisuals; j++, pVis++) {
if (pVis->class == pGLXVis->class &&
pVis->nplanes == pGLXVis->bufferSize) {
pVis->nplanes == (pGLXVis->bufferSize - pGLXVis->alphaSize)) {
/* Fixup the masks */
pGLXVis->redMask = pVis->redMask;
......@@ -545,7 +551,7 @@ static void init_screen_visuals(int screen)
for (j = 0; j < pScreen->numVisuals; j++, pVis++) {
if (pVis->class == pGLXVis->class &&
pVis->nplanes == pGLXVis->bufferSize &&
pVis->nplanes == (pGLXVis->bufferSize - pGLXVis->alphaSize) &&
!used[j]) {
if (pVis->redMask == pGLXVis->redMask &&
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment