XQuartz: GL: Work around problems with really deep visuals.

GL/capabilities.c: #if 0 (for now) any capabilities above 8 bits per channel,
because they introduce drawing problems.

GL/indirect.c: Comment out some visual setup code that shouldn't be running, and
actually seemed to cause some problems.  The current visualConfigs.c code seems
to do a reasonable job of setting up visuals for XQuartz.

GL/visualConfigs.c: Make use of the proper visual .class.   Eliminate depth 0.
It seems we really just want 24 for now, and 0 I think was a flaw in the original
code.
(cherry picked from commit 1e5f63f15e)
This commit is contained in:
George Peter Staplin 2008-11-03 19:52:48 -07:00 committed by Jeremy Huddleston
parent 39e82a9b12
commit 34bb06b292
3 changed files with 95 additions and 72 deletions

View File

@ -204,6 +204,15 @@ static int handleColorAndAccumulation(struct glColorBufCapabilities *c,
++offset;
}
#if 0
/*
* Disable this path, because some part of libGL, X, or Xplugin
* doesn't work with sizes greater than 8.
* When this is enabled and visuals are chosen using depths
* such as 16, the result is that the windows don't redraw
* and are often white, until a resize.
*/
/*12*/
if(kCGLRGB101010Bit & cmodes) {
c[offset].r = 10;
@ -265,6 +274,7 @@ static int handleColorAndAccumulation(struct glColorBufCapabilities *c,
c[offset].a = 16;
++offset;
}
#endif
/* FIXME should we handle the floating point color modes, and if so, how? */

View File

@ -1155,8 +1155,15 @@ static __GLXscreen * __glXAquaScreenProbe(ScreenPtr pScreen) {
screen->base.createDrawable = __glXAquaScreenCreateDrawable;
screen->base.pScreen = pScreen;
init_screen_visuals(screen);
/*
* These are both commented out, because they cause problems with
* the other visual config code, and visuals.
* This probe function is called normally on startup in direct
* mode too.
* They don't seem to be needed now that we have better visual
* setup.
*/
//init_screen_visuals(screen);
//glAquaInitVisualConfigs();
return &screen->base;

View File

@ -86,6 +86,7 @@ void setVisualConfigs(void) {
conf->total_color_buffers indicates the RGB/RGBA color depths.
conf->total_accum_buffers iterations for accum (with at least 1 if equal to 0)
*/
assert(NULL != caps.configurations);
@ -98,7 +99,6 @@ void setVisualConfigs(void) {
continue;
numConfigs += (conf->stereo ? 2 : 1)
* 2 /*depth*/
* (conf->aux_buffers ? 2 : 1)
* conf->buffers
* ((conf->total_stencil_bit_depths > 0) ? conf->total_stencil_bit_depths : 1)
@ -126,80 +126,86 @@ void setVisualConfigs(void) {
i = 0; /* current buffer */
for(conf = caps.configurations; conf; conf = conf->next) {
for(stereo = 0; stereo < (conf->stereo ? 2 : 1); ++stereo) {
for(depth = 0; depth < 2; ++depth) {
for(aux = 0; aux < (conf->aux_buffers ? 2 : 1); ++aux) {
for(buffers = 0; buffers < conf->buffers; ++buffers) {
for(stencil = 0; stencil < ((conf->total_stencil_bit_depths > 0) ?
conf->total_stencil_bit_depths : 1); ++stencil) {
for(color = 0; color < conf->total_color_buffers; ++color) {
for(accum = 0; accum < ((conf->total_accum_buffers > 0) ?
conf->total_accum_buffers : 1); ++accum) {
visualConfigs[i].vid = -1;
visualConfigs[i].class = -1;
visualConfigs[i].rgba = true;
visualConfigs[i].redSize = conf->color_buffers[color].r;
visualConfigs[i].greenSize = conf->color_buffers[color].g;
visualConfigs[i].blueSize = conf->color_buffers[color].b;
visualConfigs[i].alphaSize = conf->color_buffers[color].a;
for(aux = 0; aux < (conf->aux_buffers ? 2 : 1); ++aux) {
for(buffers = 0; buffers < conf->buffers; ++buffers) {
for(stencil = 0; stencil < ((conf->total_stencil_bit_depths > 0) ?
conf->total_stencil_bit_depths : 1); ++stencil) {
for(color = 0; color < conf->total_color_buffers; ++color) {
for(accum = 0; accum < ((conf->total_accum_buffers > 0) ?
conf->total_accum_buffers : 1); ++accum) {
visualConfigs[i].vid = (VisualID)(-1);
visualConfigs[i].class = TrueColor;
visualConfigs[i].redMask = -1;
visualConfigs[i].greenMask = -1;
visualConfigs[i].blueMask = -1;
visualConfigs[i].alphaMask = -1;
if(conf->total_accum_buffers > 0) {
visualConfigs[i].accumRedSize = conf->accum_buffers[accum].r;
visualConfigs[i].accumGreenSize = conf->accum_buffers[accum].g;
visualConfigs[i].accumBlueSize = conf->accum_buffers[accum].b;
if(GLCAPS_COLOR_BUF_INVALID_VALUE != conf->accum_buffers[accum].a) {
visualConfigs[i].accumAlphaSize = conf->accum_buffers[accum].a;
} else {
visualConfigs[i].accumAlphaSize = 0;
}
visualConfigs[i].rgba = true;
visualConfigs[i].redSize = conf->color_buffers[color].r;
visualConfigs[i].greenSize = conf->color_buffers[color].g;
visualConfigs[i].blueSize = conf->color_buffers[color].b;
visualConfigs[i].alphaSize = conf->color_buffers[color].a;
visualConfigs[i].bufferSize = conf->color_buffers[color].r +
conf->color_buffers[color].g + conf->color_buffers[color].b +
conf->color_buffers[color].a;
/*
* I'm uncertain about these masks.
* I don't think we actually care what the values are in our
* libGL, so it doesn't seem to make a difference.
*/
visualConfigs[i].redMask = -1;
visualConfigs[i].greenMask = -1;
visualConfigs[i].blueMask = -1;
visualConfigs[i].alphaMask = -1;
if(conf->total_accum_buffers > 0) {
visualConfigs[i].accumRedSize = conf->accum_buffers[accum].r;
visualConfigs[i].accumGreenSize = conf->accum_buffers[accum].g;
visualConfigs[i].accumBlueSize = conf->accum_buffers[accum].b;
if(GLCAPS_COLOR_BUF_INVALID_VALUE != conf->accum_buffers[accum].a) {
visualConfigs[i].accumAlphaSize = conf->accum_buffers[accum].a;
} else {
visualConfigs[i].accumRedSize = 0;
visualConfigs[i].accumGreenSize = 0;
visualConfigs[i].accumBlueSize = 0;
visualConfigs[i].accumAlphaSize = 0;
}
visualConfigs[i].doubleBuffer = buffers ? TRUE : FALSE;
visualConfigs[i].stereo = stereo ? TRUE : FALSE;
visualConfigs[i].bufferSize = -1;
visualConfigs[i].depthSize = depth ? 24 : 0;
if(conf->total_stencil_bit_depths > 0) {
visualConfigs[i].stencilSize = conf->stencil_bit_depths[stencil];
} else {
visualConfigs[i].stencilSize = 0;
}
visualConfigs[i].auxBuffers = aux ? conf->aux_buffers : 0;
visualConfigs[i].level = 0;
if(conf->accelerated) {
visualConfigs[i].visualRating = GLX_NONE;
} else {
visualConfigs[i].visualRating = GLX_SLOW_VISUAL_EXT;
}
visualConfigs[i].transparentPixel = GLX_NONE;
visualConfigs[i].transparentRed = GLX_NONE;
visualConfigs[i].transparentGreen = GLX_NONE;
visualConfigs[i].transparentBlue = GLX_NONE;
visualConfigs[i].transparentAlpha = GLX_NONE;
visualConfigs[i].transparentIndex = GLX_NONE;
/*
TODO possibly handle:
multiSampleSize;
nMultiSampleBuffers;
visualSelectGroup;
*/
++i;
} else {
visualConfigs[i].accumRedSize = 0;
visualConfigs[i].accumGreenSize = 0;
visualConfigs[i].accumBlueSize = 0;
visualConfigs[i].accumAlphaSize = 0;
}
visualConfigs[i].doubleBuffer = buffers ? TRUE : FALSE;
visualConfigs[i].stereo = stereo ? TRUE : FALSE;
visualConfigs[i].depthSize = 24;
if(conf->total_stencil_bit_depths > 0) {
visualConfigs[i].stencilSize = conf->stencil_bit_depths[stencil];
} else {
visualConfigs[i].stencilSize = 0;
}
visualConfigs[i].auxBuffers = aux ? conf->aux_buffers : 0;
visualConfigs[i].level = 0;
if(conf->accelerated) {
visualConfigs[i].visualRating = GLX_NONE;
} else {
visualConfigs[i].visualRating = GLX_SLOW_VISUAL_EXT;
}
visualConfigs[i].transparentPixel = GLX_NONE;
visualConfigs[i].transparentRed = GLX_NONE;
visualConfigs[i].transparentGreen = GLX_NONE;
visualConfigs[i].transparentBlue = GLX_NONE;
visualConfigs[i].transparentAlpha = GLX_NONE;
visualConfigs[i].transparentIndex = GLX_NONE;
/*
TODO possibly handle:
multiSampleSize;
nMultiSampleBuffers;
visualSelectGroup;
*/
++i;
}
}
}