diff options
author | keithw <keithw> | 2003-09-11 13:57:39 +0000 |
---|---|---|
committer | keithw <keithw> | 2003-09-11 13:57:39 +0000 |
commit | 4707066cecfe24a884a509b5335bb52885289b49 (patch) | |
tree | 720d76b0b42f0989b17c10ed8ac92a2d2208e0e6 | |
parent | ee5eca10fb8b128655ad832b53f068fdf780c75a (diff) |
adjust calculation of pVis->nplanes, fixes NWNtrunk-20030912
-rw-r--r-- | xc/programs/Xserver/GL/mesa/src/X/xf86glx.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/xc/programs/Xserver/GL/mesa/src/X/xf86glx.c b/xc/programs/Xserver/GL/mesa/src/X/xf86glx.c index 443ea03c4..55c001c45 100644 --- a/xc/programs/Xserver/GL/mesa/src/X/xf86glx.c +++ b/xc/programs/Xserver/GL/mesa/src/X/xf86glx.c @@ -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 && |