XQuartz: Overhaul setting up visuals
The main change is cleanup of the visualConfigs and setting up alpha correctly there to match the visuals being added earlier (so the default visual has a corresponding GLX visual)
(cherry picked from commit 7351db5c87
)
This commit is contained in:
parent
7f28c555b8
commit
c81595e23b
|
@ -61,7 +61,8 @@
|
|||
#include "x-hash.h"
|
||||
#include "x-list.h"
|
||||
|
||||
#include "capabilities.h"
|
||||
//#include "capabilities.h"
|
||||
#include "visualConfigs.h"
|
||||
|
||||
typedef unsigned long long GLuint64EXT;
|
||||
typedef long long GLint64EXT;
|
||||
|
@ -101,13 +102,6 @@ __GLXprovider __glXDRISWRastProvider = {
|
|||
NULL
|
||||
};
|
||||
|
||||
__GLXprovider *
|
||||
GlxGetDRISWRastProvider (void)
|
||||
{
|
||||
GLAQUA_DEBUG_MSG("GlxGetDRISWRastProvider\n");
|
||||
return &__glXDRISWRastProvider;
|
||||
}
|
||||
|
||||
typedef struct __GLXAquaScreen __GLXAquaScreen;
|
||||
typedef struct __GLXAquaContext __GLXAquaContext;
|
||||
typedef struct __GLXAquaDrawable __GLXAquaDrawable;
|
||||
|
@ -493,206 +487,6 @@ static void __glXAquaScreenDestroy(__GLXscreen *screen) {
|
|||
xfree(screen);
|
||||
}
|
||||
|
||||
static __GLXconfig *CreateConfigs(int *numConfigsPtr, int screenNumber) {
|
||||
__GLXconfig *c, *result;
|
||||
struct glCapabilities cap;
|
||||
struct glCapabilitiesConfig *conf = NULL;
|
||||
int numConfigs = 0;
|
||||
int i;
|
||||
|
||||
if(getGlCapabilities(&cap))
|
||||
FatalError("error from getGlCapabilities() in %s\n", __func__);
|
||||
|
||||
assert(NULL != cap.configurations);
|
||||
|
||||
for(conf = cap.configurations; conf; conf = conf->next) {
|
||||
if(conf->total_color_buffers <= 0)
|
||||
continue;
|
||||
|
||||
numConfigs += (conf->stereo ? 2 : 1)
|
||||
* (conf->aux_buffers ? 2 : 1)
|
||||
* conf->buffers
|
||||
* ((conf->total_stencil_bit_depths > 0) ?
|
||||
conf->total_stencil_bit_depths : 1)
|
||||
* conf->total_color_buffers
|
||||
* ((conf->total_accum_buffers > 0) ? conf->total_accum_buffers : 1)
|
||||
* conf->total_depth_buffer_depths
|
||||
* (conf->multisample_buffers + 1);
|
||||
}
|
||||
|
||||
*numConfigsPtr = numConfigs;
|
||||
|
||||
c = xalloc(sizeof(*c) * numConfigs);
|
||||
|
||||
if(NULL == c)
|
||||
return NULL;
|
||||
|
||||
|
||||
|
||||
result = c;
|
||||
|
||||
memset(result, 0, sizeof(*c) * numConfigs);
|
||||
|
||||
i = 0;
|
||||
|
||||
for(conf = cap.configurations; conf; conf = conf->next) {
|
||||
int stereo, aux, buffers, stencil, color, accum, depth, msample;
|
||||
|
||||
for(stereo = 0; stereo < (conf->stereo ? 2 : 1); ++stereo) {
|
||||
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) {
|
||||
for(depth = 0; depth < conf->total_depth_buffer_depths; ++depth) {
|
||||
for(msample = 0; msample < (conf->multisample_buffers + 1); ++msample) {
|
||||
if((i + 1) < numConfigs) {
|
||||
c->next = c + 1;
|
||||
} else {
|
||||
c->next = NULL;
|
||||
}
|
||||
|
||||
c->doubleBufferMode = buffers ? GL_TRUE : GL_FALSE;
|
||||
c->stereoMode = stereo ? GL_TRUE : GL_FALSE;
|
||||
|
||||
c->redBits = conf->color_buffers[color].r;
|
||||
c->greenBits = conf->color_buffers[color].g;
|
||||
c->blueBits = conf->color_buffers[color].b;
|
||||
c->alphaBits = 0;
|
||||
|
||||
if(GLCAPS_COLOR_BUF_INVALID_VALUE != conf->color_buffers[color].a) {
|
||||
c->alphaBits = conf->color_buffers[color].a;
|
||||
}
|
||||
|
||||
c->redMask = -1;
|
||||
c->greenMask = -1;
|
||||
c->blueMask = -1;
|
||||
c->alphaMask = -1;
|
||||
|
||||
c->rgbBits = c->redBits + c->greenBits + c->blueBits + c->alphaBits;
|
||||
c->indexBits = 0;
|
||||
|
||||
c->accumRedBits = 0;
|
||||
c->accumGreenBits = 0;
|
||||
c->accumBlueBits = 0;
|
||||
c->accumAlphaBits = 0;
|
||||
|
||||
if(conf->total_accum_buffers > 0) {
|
||||
c->accumRedBits = conf->accum_buffers[accum].r;
|
||||
c->accumGreenBits = conf->accum_buffers[accum].g;
|
||||
c->accumBlueBits = conf->accum_buffers[accum].b;
|
||||
if(GLCAPS_COLOR_BUF_INVALID_VALUE != conf->accum_buffers[accum].a) {
|
||||
c->accumAlphaBits = conf->accum_buffers[accum].a;
|
||||
}
|
||||
}
|
||||
|
||||
c->depthBits = conf->depth_buffers[depth];
|
||||
|
||||
c->stencilBits = 0;
|
||||
|
||||
if(conf->total_stencil_bit_depths > 0) {
|
||||
c->stencilBits = conf->stencil_bit_depths[stencil];
|
||||
}
|
||||
|
||||
|
||||
c->numAuxBuffers = aux ? conf->aux_buffers : 0;
|
||||
|
||||
c->level = 0;
|
||||
/*TODO what should this be? */
|
||||
c->pixmapMode = 0;
|
||||
|
||||
c->visualID = -1;
|
||||
c->visualType = GLX_TRUE_COLOR;
|
||||
|
||||
if(conf->accelerated) {
|
||||
c->visualRating = GLX_NONE;
|
||||
} else {
|
||||
c->visualRating = GLX_SLOW_VISUAL_EXT;
|
||||
}
|
||||
|
||||
c->transparentPixel = GLX_NONE;
|
||||
c->transparentRed = GLX_NONE;
|
||||
c->transparentGreen = GLX_NONE;
|
||||
c->transparentAlpha = GLX_NONE;
|
||||
c->transparentIndex = GLX_NONE;
|
||||
|
||||
c->sampleBuffers = 0;
|
||||
c->samples = 0;
|
||||
|
||||
if(msample > 0) {
|
||||
c->sampleBuffers = conf->multisample_buffers;
|
||||
c->samples = conf->multisample_samples;
|
||||
}
|
||||
|
||||
/*
|
||||
* The Apple libGL supports GLXPixmaps and
|
||||
* GLXPbuffers in direct mode.
|
||||
*/
|
||||
/* SGIX_fbconfig / GLX 1.3 */
|
||||
c->drawableType = GLX_WINDOW_BIT | GLX_PIXMAP_BIT
|
||||
| GLX_PBUFFER_BIT;
|
||||
c->renderType = GLX_RGBA_BIT;
|
||||
c->xRenderable = GL_TRUE;
|
||||
c->fbconfigID = -1;
|
||||
|
||||
/* SGIX_pbuffer / GLX 1.3 */
|
||||
|
||||
/*
|
||||
* The CGL layer provides a way of retrieving
|
||||
* the maximum pbuffer width/height, but only
|
||||
* if we create a context and call glGetIntegerv.
|
||||
*
|
||||
* The following values are from a test program
|
||||
* that does so.
|
||||
*/
|
||||
c->maxPbufferWidth = 8192;
|
||||
c->maxPbufferHeight = 8192;
|
||||
c->maxPbufferPixels = /*Do we need this?*/ 0;
|
||||
/*
|
||||
* There is no introspection for this sort of thing
|
||||
* with CGL. What should we do realistically?
|
||||
*/
|
||||
c->optimalPbufferWidth = 0;
|
||||
c->optimalPbufferHeight = 0;
|
||||
|
||||
c->visualSelectGroup = 0;
|
||||
|
||||
c->swapMethod = GLX_SWAP_UNDEFINED_OML;
|
||||
|
||||
c->screen = screenNumber;
|
||||
|
||||
/* EXT_texture_from_pixmap */
|
||||
c->bindToTextureRgb = 0;
|
||||
c->bindToTextureRgba = 0;
|
||||
c->bindToMipmapTexture = 0;
|
||||
c->bindToTextureTargets = 0;
|
||||
c->yInverted = 0;
|
||||
|
||||
if(c->next)
|
||||
c = c->next;
|
||||
|
||||
++i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(i != numConfigs)
|
||||
FatalError("The number of __GLXconfig generated does not match the initial calculation!\n");
|
||||
|
||||
|
||||
freeGlCapabilities(&cap);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/* This is called by __glXInitScreens(). */
|
||||
static __GLXscreen * __glXAquaScreenProbe(ScreenPtr pScreen) {
|
||||
__GLXAquaScreen *screen;
|
||||
|
@ -715,13 +509,7 @@ static __GLXscreen * __glXAquaScreenProbe(ScreenPtr pScreen) {
|
|||
screen->base.swapBarrierFuncs = NULL;
|
||||
screen->base.pScreen = pScreen;
|
||||
|
||||
screen->base.fbconfigs = CreateConfigs(&screen->base.numFBConfigs,
|
||||
pScreen->myNum);
|
||||
|
||||
/* This is set by __glXScreenInit: */
|
||||
screen->base.visuals = NULL;
|
||||
/* This is to be initialized prior to the call to __glXScreenInit: */
|
||||
screen->base.numVisuals = 0;
|
||||
screen->base.fbconfigs = __glXAquaCreateVisualConfigs(&screen->base.numFBConfigs, pScreen->myNum);
|
||||
|
||||
__glXScreenInit(&screen->base, pScreen);
|
||||
|
||||
|
@ -737,11 +525,12 @@ static __GLXscreen * __glXAquaScreenProbe(ScreenPtr pScreen) {
|
|||
return &screen->base;
|
||||
}
|
||||
|
||||
#if 0 // unused
|
||||
static void __glXAquaDrawableCopySubBuffer (__GLXdrawable *drawable,
|
||||
int x, int y, int w, int h) {
|
||||
/*TODO finish me*/
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static void __glXAquaDrawableDestroy(__GLXdrawable *base) {
|
||||
/* gstaplin: base is the head of the structure, so it's at the same
|
||||
|
@ -1178,9 +967,9 @@ static void setup_dispatch_table(void) {
|
|||
* <rdar://problem/6953344> gl.h contains incorrect prototypes for glTexImage[123]D
|
||||
*/
|
||||
|
||||
SET_TexImage1D(disp, glTexImage1D);
|
||||
SET_TexImage2D(disp, glTexImage2D);
|
||||
SET_TexImage3D(disp, glTexImage3D);
|
||||
SET_TexImage1D(disp, (void *)glTexImage1D);
|
||||
SET_TexImage2D(disp, (void *)glTexImage2D);
|
||||
SET_TexImage3D(disp, (void *)glTexImage3D);
|
||||
SET_TexParameterf(disp, glTexParameterf);
|
||||
SET_TexParameterfv(disp, glTexParameterfv);
|
||||
SET_TexParameteri(disp, glTexParameteri);
|
||||
|
@ -1565,7 +1354,7 @@ static void setup_dispatch_table(void) {
|
|||
*
|
||||
* void ( * MultiDrawArraysEXT)(GLenum mode, GLint * first, GLsizei * count, GLsizei primcount);
|
||||
*/
|
||||
SET_MultiDrawArraysEXT(disp, glMultiDrawArraysEXT);
|
||||
SET_MultiDrawArraysEXT(disp, (void *)glMultiDrawArraysEXT);
|
||||
SET_MultiDrawElementsEXT(disp, glMultiDrawElementsEXT);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -57,53 +57,51 @@
|
|||
#include "visualConfigs.h"
|
||||
|
||||
/* Based originally on code from indirect.c which was based on code from i830_dri.c. */
|
||||
void setVisualConfigs(void) {
|
||||
__GLXconfig *__glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber) {
|
||||
int numConfigs = 0;
|
||||
__GLXvisualConfig *visualConfigs = NULL;
|
||||
void **visualPrivates = NULL;
|
||||
__GLXconfig *visualConfigs, *c;
|
||||
struct glCapabilities caps;
|
||||
struct glCapabilitiesConfig *conf = NULL;
|
||||
int stereo, depth, aux, buffers, stencil, accum, color, msample;
|
||||
int i = 0;
|
||||
|
||||
if(getGlCapabilities(&caps)) {
|
||||
ErrorF("error from getGlCapabilities()!\n");
|
||||
return;
|
||||
ErrorF("error from getGlCapabilities()!\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
conf->stereo is 0 or 1, but we need at least 1 iteration of the loop,
|
||||
so we treat a true conf->stereo as 2.
|
||||
|
||||
The depth size is 0 or 24. Thus we do 2 iterations for that.
|
||||
|
||||
conf->aux_buffers (when available/non-zero) result in 2 iterations instead of 1.
|
||||
|
||||
conf->buffers indicates whether we have single or double buffering.
|
||||
conf->stereo is 0 or 1, but we need at least 1 iteration of the loop,
|
||||
so we treat a true conf->stereo as 2.
|
||||
|
||||
The depth size is 0 or 24. Thus we do 2 iterations for that.
|
||||
|
||||
conf->aux_buffers (when available/non-zero) result in 2 iterations instead of 1.
|
||||
|
||||
conf->buffers indicates whether we have single or double buffering.
|
||||
|
||||
conf->total_stencil_bit_depths
|
||||
|
||||
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)
|
||||
|
||||
conf->total_depth_buffer_depths
|
||||
|
||||
conf->multisample_buffers iterations (with at least 1 if equal to 0). We add 1
|
||||
for the 0 multisampling config.
|
||||
|
||||
conf->total_stencil_bit_depths
|
||||
|
||||
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)
|
||||
|
||||
conf->total_depth_buffer_depths
|
||||
|
||||
conf->multisample_buffers iterations (with at least 1 if equal to 0). We add 1
|
||||
for the 0 multisampling config.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
assert(NULL != caps.configurations);
|
||||
conf = caps.configurations;
|
||||
|
||||
|
||||
numConfigs = 0;
|
||||
|
||||
|
||||
for(conf = caps.configurations; conf; conf = conf->next) {
|
||||
if(conf->total_color_buffers <= 0)
|
||||
continue;
|
||||
|
||||
numConfigs += (conf->stereo ? 2 : 1)
|
||||
if(conf->total_color_buffers <= 0)
|
||||
continue;
|
||||
|
||||
numConfigs += (conf->stereo ? 2 : 1)
|
||||
* (conf->aux_buffers ? 2 : 1)
|
||||
* conf->buffers
|
||||
* ((conf->total_stencil_bit_depths > 0) ? conf->total_stencil_bit_depths : 1)
|
||||
|
@ -112,144 +110,186 @@ void setVisualConfigs(void) {
|
|||
* conf->total_depth_buffer_depths
|
||||
* (conf->multisample_buffers + 1);
|
||||
}
|
||||
|
||||
|
||||
if(numConfigsPtr)
|
||||
*numConfigsPtr = numConfigs;
|
||||
|
||||
visualConfigs = xcalloc(sizeof(*visualConfigs), numConfigs);
|
||||
|
||||
|
||||
if(NULL == visualConfigs) {
|
||||
ErrorF("xcalloc failure when allocating visualConfigs\n");
|
||||
freeGlCapabilities(&caps);
|
||||
return;
|
||||
ErrorF("xcalloc failure when allocating visualConfigs\n");
|
||||
freeGlCapabilities(&caps);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
visualPrivates = xcalloc(sizeof(void *), numConfigs);
|
||||
|
||||
if(NULL == visualPrivates) {
|
||||
ErrorF("xcalloc failure when allocating visualPrivates");
|
||||
freeGlCapabilities(&caps);
|
||||
xfree(visualConfigs);
|
||||
return;
|
||||
}
|
||||
|
||||
i = 0; /* current buffer */
|
||||
c = visualConfigs; /* current buffer */
|
||||
for(conf = caps.configurations; conf; conf = conf->next) {
|
||||
for(stereo = 0; stereo < (conf->stereo ? 2 : 1); ++stereo) {
|
||||
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) {
|
||||
for(depth = 0; depth < conf->total_depth_buffer_depths; ++depth) {
|
||||
for(msample = 0; msample < (conf->multisample_buffers + 1); ++msample) {
|
||||
visualConfigs[i].vid = (VisualID)(-1);
|
||||
visualConfigs[i].class = TrueColor;
|
||||
|
||||
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;
|
||||
for(stereo = 0; stereo < (conf->stereo ? 2 : 1); ++stereo) {
|
||||
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) {
|
||||
for(depth = 0; depth < conf->total_depth_buffer_depths; ++depth) {
|
||||
for(msample = 0; msample < (conf->multisample_buffers + 1); ++msample) {
|
||||
|
||||
// Global
|
||||
c->visualID = -1;
|
||||
c->visualType = GLX_TRUE_COLOR;
|
||||
c->next = c + 1;
|
||||
|
||||
if(GLCAPS_COLOR_BUF_INVALID_VALUE == conf->color_buffers[color].a) {
|
||||
/* This visual has no alpha. */
|
||||
visualConfigs[i].alphaSize = 0;
|
||||
} else {
|
||||
visualConfigs[i].alphaSize = conf->color_buffers[color].a;
|
||||
}
|
||||
|
||||
/*
|
||||
* If the .a/alpha value is unset, then don't add it to the
|
||||
* bufferSize specification. The INVALID_VALUE indicates that it
|
||||
* was unset.
|
||||
*
|
||||
* This prevents odd bufferSizes, such as 14.
|
||||
*/
|
||||
if(GLCAPS_COLOR_BUF_INVALID_VALUE == conf->color_buffers[color].a) {
|
||||
visualConfigs[i].bufferSize = conf->color_buffers[color].r +
|
||||
conf->color_buffers[color].g + conf->color_buffers[color].b;
|
||||
} else {
|
||||
visualConfigs[i].bufferSize = conf->color_buffers[color].r +
|
||||
conf->color_buffers[color].g + conf->color_buffers[color].b +
|
||||
conf->color_buffers[color].a;
|
||||
}
|
||||
c->screen = screenNumber;
|
||||
|
||||
/*
|
||||
* 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].accumAlphaSize = 0;
|
||||
}
|
||||
} 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;
|
||||
c->level = 0;
|
||||
c->indexBits = 0;
|
||||
c->pixmapMode = 0; // TODO: What should this be?
|
||||
|
||||
if(conf->accelerated) {
|
||||
c->visualRating = GLX_NONE;
|
||||
} else {
|
||||
c->visualRating = GLX_SLOW_VISUAL_EXT;
|
||||
}
|
||||
|
||||
c->transparentPixel = GLX_NONE;
|
||||
c->transparentRed = GLX_NONE;
|
||||
c->transparentGreen = GLX_NONE;
|
||||
c->transparentBlue = GLX_NONE;
|
||||
c->transparentAlpha = GLX_NONE;
|
||||
c->transparentIndex = GLX_NONE;
|
||||
|
||||
c->visualSelectGroup = 0;
|
||||
|
||||
c->swapMethod = GLX_SWAP_UNDEFINED_OML;
|
||||
|
||||
// Stereo
|
||||
c->stereoMode = stereo ? TRUE : FALSE;
|
||||
|
||||
visualConfigs[i].depthSize = conf->depth_buffers[depth];
|
||||
|
||||
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;
|
||||
|
||||
if(msample > 0) {
|
||||
visualConfigs[i].multiSampleSize = conf->multisample_samples;
|
||||
visualConfigs[i].nMultiSampleBuffers = conf->multisample_buffers;
|
||||
} else {
|
||||
visualConfigs[i].multiSampleSize = 0;
|
||||
visualConfigs[i].nMultiSampleBuffers = 0;
|
||||
}
|
||||
// Aux buffers
|
||||
c->numAuxBuffers = aux ? conf->aux_buffers : 0;
|
||||
|
||||
// Double Buffered
|
||||
c->doubleBufferMode = buffers ? TRUE : FALSE;
|
||||
|
||||
// Stencil Buffer
|
||||
if(conf->total_stencil_bit_depths > 0) {
|
||||
c->stencilBits = conf->stencil_bit_depths[stencil];
|
||||
} else {
|
||||
c->stencilBits = 0;
|
||||
}
|
||||
|
||||
// Color
|
||||
c->redBits = conf->color_buffers[color].r;
|
||||
c->greenBits = conf->color_buffers[color].g;
|
||||
c->blueBits = conf->color_buffers[color].b;
|
||||
|
||||
if(GLCAPS_COLOR_BUF_INVALID_VALUE != conf->color_buffers[color].a) {
|
||||
c->alphaBits = conf->color_buffers[color].a;
|
||||
} else {
|
||||
c->alphaBits = 0;
|
||||
}
|
||||
|
||||
c->rgbBits = c->redBits + c->blueBits +
|
||||
c->blueBits + c->alphaBits;
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* These need to match dfb in xprScreen.c or we'll have a default
|
||||
* visual without a corresponding GLX visual. This causes
|
||||
* http://xquartz.macosforge.org/trac/ticket/287
|
||||
*/
|
||||
c->redMask = 0xff0000;
|
||||
c->greenMask = 0x00ff00;
|
||||
c->blueMask = 0x0000ff;
|
||||
c->alphaMask = 0;
|
||||
|
||||
// Accumulation Buffers
|
||||
if(conf->total_accum_buffers > 0) {
|
||||
c->accumRedBits = conf->accum_buffers[accum].r;
|
||||
c->accumGreenBits = conf->accum_buffers[accum].g;
|
||||
c->accumBlueBits = conf->accum_buffers[accum].b;
|
||||
if(GLCAPS_COLOR_BUF_INVALID_VALUE != conf->accum_buffers[accum].a) {
|
||||
c->accumAlphaBits = conf->accum_buffers[accum].a;
|
||||
} else {
|
||||
c->accumAlphaBits = 0;
|
||||
}
|
||||
} else {
|
||||
c->accumRedBits = 0;
|
||||
c->accumGreenBits = 0;
|
||||
c->accumBlueBits = 0;
|
||||
c->accumAlphaBits = 0;
|
||||
}
|
||||
|
||||
// Depth
|
||||
c->depthBits = conf->depth_buffers[depth];
|
||||
|
||||
// MultiSample
|
||||
if(msample > 0) {
|
||||
c->samples = conf->multisample_samples;
|
||||
c->sampleBuffers = conf->multisample_buffers;
|
||||
} else {
|
||||
c->samples = 0;
|
||||
c->sampleBuffers = 0;
|
||||
}
|
||||
|
||||
++i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* The Apple libGL supports GLXPixmaps and
|
||||
* GLXPbuffers in direct mode.
|
||||
*/
|
||||
/* SGIX_fbconfig / GLX 1.3 */
|
||||
c->drawableType = GLX_WINDOW_BIT | GLX_PIXMAP_BIT | GLX_PBUFFER_BIT;
|
||||
c->renderType = GLX_RGBA_BIT;
|
||||
c->xRenderable = GL_TRUE;
|
||||
c->fbconfigID = -1;
|
||||
|
||||
/* SGIX_pbuffer / GLX 1.3 */
|
||||
|
||||
/*
|
||||
* The CGL layer provides a way of retrieving
|
||||
* the maximum pbuffer width/height, but only
|
||||
* if we create a context and call glGetIntegerv.
|
||||
*
|
||||
* The following values are from a test program
|
||||
* that does so.
|
||||
*/
|
||||
c->maxPbufferWidth = 8192;
|
||||
c->maxPbufferHeight = 8192;
|
||||
c->maxPbufferPixels = /*Do we need this?*/ 0;
|
||||
/*
|
||||
* There is no introspection for this sort of thing
|
||||
* with CGL. What should we do realistically?
|
||||
*/
|
||||
c->optimalPbufferWidth = 0;
|
||||
c->optimalPbufferHeight = 0;
|
||||
|
||||
/* EXT_texture_from_pixmap */
|
||||
c->bindToTextureRgb = 0;
|
||||
c->bindToTextureRgba = 0;
|
||||
c->bindToMipmapTexture = 0;
|
||||
c->bindToTextureTargets = 0;
|
||||
c->yInverted = 0;
|
||||
|
||||
c = c->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (i != numConfigs) {
|
||||
ErrorF("numConfigs calculation error in setVisualConfigs! numConfigs is %d i is %d\n", numConfigs, i);
|
||||
abort();
|
||||
}
|
||||
(c-1)->next = NULL;
|
||||
|
||||
if (c - visualConfigs != numConfigs) {
|
||||
FatalError("numConfigs calculation error in setVisualConfigs! numConfigs is %d i is %d\n", numConfigs, c - visualConfigs);
|
||||
}
|
||||
|
||||
freeGlCapabilities(&caps);
|
||||
|
||||
GlxSetVisualConfigs(numConfigs, visualConfigs, visualPrivates);
|
||||
return visualConfigs;
|
||||
}
|
||||
|
|
|
@ -23,6 +23,6 @@
|
|||
#ifndef VISUAL_CONFIGS_H
|
||||
#define VISUAL_CONFIGS_H
|
||||
|
||||
void setVisualConfigs(void);
|
||||
__GLXconfig *__glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -77,9 +77,6 @@
|
|||
#include "quartz.h"
|
||||
//#include "darwinClut8.h"
|
||||
|
||||
#include "GL/visualConfigs.h"
|
||||
|
||||
|
||||
#ifdef ENABLE_DEBUG_LOG
|
||||
FILE *debug_log_fp = NULL;
|
||||
#endif
|
||||
|
@ -185,18 +182,23 @@ static Bool DarwinSaveScreen(ScreenPtr pScreen, int on)
|
|||
}
|
||||
|
||||
/*
|
||||
* DarwinAddScreen
|
||||
* DarwinScreenInit
|
||||
* This is a callback from dix during AddScreen() from InitOutput().
|
||||
* Initialize the screen and communicate information about it back to dix.
|
||||
*/
|
||||
static Bool DarwinAddScreen(int index, ScreenPtr pScreen, int argc, char **argv) {
|
||||
static Bool DarwinScreenInit(int index, ScreenPtr pScreen, int argc, char **argv) {
|
||||
int dpi;
|
||||
static int foundIndex = 0;
|
||||
Bool ret;
|
||||
DarwinFramebufferPtr dfb;
|
||||
|
||||
// reset index of found screens for each server generation
|
||||
if (index == 0) foundIndex = 0;
|
||||
if (index == 0) {
|
||||
foundIndex = 0;
|
||||
|
||||
// reset the visual list
|
||||
miClearVisualTypes();
|
||||
}
|
||||
|
||||
// allocate space for private per screen storage
|
||||
dfb = xalloc(sizeof(DarwinFramebufferRec));
|
||||
|
@ -210,9 +212,6 @@ static Bool DarwinAddScreen(int index, ScreenPtr pScreen, int argc, char **argv)
|
|||
if (! ret)
|
||||
return FALSE;
|
||||
|
||||
// reset the visual list
|
||||
miClearVisualTypes();
|
||||
|
||||
// setup a single visual appropriate for our pixel type
|
||||
if(!miSetVisualTypesAndMasks(dfb->depth, dfb->visuals, dfb->bitsPerRGB,
|
||||
dfb->preferredCVC, dfb->redMask,
|
||||
|
@ -614,7 +613,7 @@ DarwinAdjustScreenOrigins(ScreenInfo *pScreenInfo)
|
|||
* The display mode dependent code gets called three times. The mode
|
||||
* specific InitOutput routines are expected to discover the number
|
||||
* of potentially useful screens and cache routes to them internally.
|
||||
* Inside DarwinAddScreen are two other mode specific calls.
|
||||
* Inside DarwinScreenInit are two other mode specific calls.
|
||||
* A mode specific AddScreen routine is called for each screen to
|
||||
* actually initialize the screen with the ScreenPtr structure.
|
||||
* After other screen setup has been done, a mode specific
|
||||
|
@ -634,16 +633,12 @@ void InitOutput( ScreenInfo *pScreenInfo, int argc, char **argv )
|
|||
for (i = 0; i < NUMFORMATS; i++)
|
||||
pScreenInfo->formats[i] = formats[i];
|
||||
|
||||
#ifdef GLXEXT
|
||||
setVisualConfigs();
|
||||
#endif
|
||||
|
||||
// Discover screens and do mode specific initialization
|
||||
QuartzInitOutput(argc, argv);
|
||||
|
||||
// Add screens
|
||||
for (i = 0; i < darwinScreensFound; i++) {
|
||||
AddScreen( DarwinAddScreen, argc, argv );
|
||||
AddScreen(DarwinScreenInit, argc, argv);
|
||||
}
|
||||
|
||||
DarwinAdjustScreenOrigins(pScreenInfo);
|
||||
|
|
Loading…
Reference in New Issue
Block a user