Merge remote-tracking branch 'jeremyhu/master'
This commit is contained in:
commit
2a0b544f5c
|
@ -58,40 +58,38 @@
|
||||||
#include "darwinfb.h"
|
#include "darwinfb.h"
|
||||||
|
|
||||||
/* Based originally on code from indirect.c which was based on code from i830_dri.c. */
|
/* Based originally on code from indirect.c which was based on code from i830_dri.c. */
|
||||||
__GLXconfig *
|
__GLXconfig *__glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber) {
|
||||||
__glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber)
|
|
||||||
{
|
|
||||||
int numConfigs = 0;
|
int numConfigs = 0;
|
||||||
__GLXconfig *visualConfigs, *c;
|
__GLXconfig *visualConfigs, *c;
|
||||||
struct glCapabilities caps;
|
struct glCapabilities caps;
|
||||||
struct glCapabilitiesConfig *conf;
|
struct glCapabilitiesConfig *conf;
|
||||||
int stereo, depth, aux, buffers, stencil, accum, color, msample;
|
int stereo, depth, aux, buffers, stencil, accum, color, msample;
|
||||||
|
|
||||||
if (getGlCapabilities(&caps)) {
|
if(getGlCapabilities(&caps)) {
|
||||||
ErrorF("error from getGlCapabilities()!\n");
|
ErrorF("error from getGlCapabilities()!\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
conf->stereo is 0 or 1, but we need at least 1 iteration of the loop,
|
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.
|
so we treat a true conf->stereo as 2.
|
||||||
|
|
||||||
The depth size is 0 or 24. Thus we do 2 iterations for that.
|
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->aux_buffers (when available/non-zero) result in 2 iterations instead of 1.
|
||||||
|
|
||||||
conf->buffers indicates whether we have single or double buffering.
|
conf->buffers indicates whether we have single or double buffering.
|
||||||
|
|
||||||
conf->total_stencil_bit_depths
|
conf->total_stencil_bit_depths
|
||||||
|
|
||||||
conf->total_color_buffers indicates the RGB/RGBA color 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_accum_buffers iterations for accum (with at least 1 if equal to 0)
|
||||||
|
|
||||||
conf->total_depth_buffer_depths
|
conf->total_depth_buffer_depths
|
||||||
|
|
||||||
conf->multisample_buffers iterations (with at least 1 if equal to 0). We add 1
|
conf->multisample_buffers iterations (with at least 1 if equal to 0). We add 1
|
||||||
for the 0 multisampling config.
|
for the 0 multisampling config.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -99,57 +97,43 @@ __glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber)
|
||||||
|
|
||||||
numConfigs = 0;
|
numConfigs = 0;
|
||||||
|
|
||||||
for (conf = caps.configurations; conf; conf = conf->next) {
|
for(conf = caps.configurations; conf; conf = conf->next) {
|
||||||
if (conf->total_color_buffers <= 0)
|
if(conf->total_color_buffers <= 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
numConfigs += (conf->stereo ? 2 : 1)
|
numConfigs += (conf->stereo ? 2 : 1)
|
||||||
* (conf->aux_buffers ? 2 : 1)
|
* (conf->aux_buffers ? 2 : 1)
|
||||||
* conf->buffers
|
* conf->buffers
|
||||||
* ((conf->total_stencil_bit_depths >
|
* ((conf->total_stencil_bit_depths > 0) ? conf->total_stencil_bit_depths : 1)
|
||||||
0) ? conf->total_stencil_bit_depths : 1)
|
* conf->total_color_buffers
|
||||||
* conf->total_color_buffers
|
* ((conf->total_accum_buffers > 0) ? conf->total_accum_buffers : 1)
|
||||||
* ((conf->total_accum_buffers >
|
* conf->total_depth_buffer_depths
|
||||||
0) ? conf->total_accum_buffers : 1)
|
* (conf->multisample_buffers + 1);
|
||||||
* conf->total_depth_buffer_depths
|
|
||||||
* (conf->multisample_buffers + 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (numConfigsPtr)
|
if(numConfigsPtr)
|
||||||
*numConfigsPtr = numConfigs;
|
*numConfigsPtr = numConfigs;
|
||||||
|
|
||||||
visualConfigs = calloc(sizeof(*visualConfigs), numConfigs);
|
visualConfigs = calloc(sizeof(*visualConfigs), numConfigs);
|
||||||
|
|
||||||
if (NULL == visualConfigs) {
|
if(NULL == visualConfigs) {
|
||||||
ErrorF("xcalloc failure when allocating visualConfigs\n");
|
ErrorF("xcalloc failure when allocating visualConfigs\n");
|
||||||
freeGlCapabilities(&caps);
|
freeGlCapabilities(&caps);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
c = visualConfigs; /* current buffer */
|
c = visualConfigs; /* current buffer */
|
||||||
for (conf = caps.configurations; conf; conf = conf->next) {
|
for(conf = caps.configurations; conf; conf = conf->next) {
|
||||||
for (stereo = 0; stereo < (conf->stereo ? 2 : 1); ++stereo) {
|
for(stereo = 0; stereo < (conf->stereo ? 2 : 1); ++stereo) {
|
||||||
for (aux = 0; aux < (conf->aux_buffers ? 2 : 1); ++aux) {
|
for(aux = 0; aux < (conf->aux_buffers ? 2 : 1); ++aux) {
|
||||||
for (buffers = 0; buffers < conf->buffers; ++buffers) {
|
for(buffers = 0; buffers < conf->buffers; ++buffers) {
|
||||||
for (stencil = 0;
|
for(stencil = 0; stencil < ((conf->total_stencil_bit_depths > 0) ?
|
||||||
stencil < ((conf->total_stencil_bit_depths > 0) ?
|
conf->total_stencil_bit_depths : 1); ++stencil) {
|
||||||
conf->
|
for(color = 0; color < conf->total_color_buffers; ++color) {
|
||||||
total_stencil_bit_depths : 1);
|
for(accum = 0; accum < ((conf->total_accum_buffers > 0) ?
|
||||||
++stencil) {
|
conf->total_accum_buffers : 1); ++accum) {
|
||||||
for (color = 0; color < conf->total_color_buffers;
|
for(depth = 0; depth < conf->total_depth_buffer_depths; ++depth) {
|
||||||
++color) {
|
for(msample = 0; msample < (conf->multisample_buffers + 1); ++msample) {
|
||||||
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
|
// Global
|
||||||
c->visualID = -1;
|
c->visualID = -1;
|
||||||
|
@ -162,12 +146,10 @@ __glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber)
|
||||||
c->indexBits = 0;
|
c->indexBits = 0;
|
||||||
c->pixmapMode = 0; // TODO: What should this be?
|
c->pixmapMode = 0; // TODO: What should this be?
|
||||||
|
|
||||||
if (conf->accelerated) {
|
if(conf->accelerated) {
|
||||||
c->visualRating = GLX_NONE;
|
c->visualRating = GLX_NONE;
|
||||||
}
|
} else {
|
||||||
else {
|
c->visualRating = GLX_SLOW_VISUAL_EXT;
|
||||||
c->visualRating =
|
|
||||||
GLX_SLOW_VISUAL_EXT;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
c->transparentPixel = GLX_NONE;
|
c->transparentPixel = GLX_NONE;
|
||||||
|
@ -179,91 +161,52 @@ __glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber)
|
||||||
|
|
||||||
c->visualSelectGroup = 0;
|
c->visualSelectGroup = 0;
|
||||||
|
|
||||||
c->swapMethod =
|
c->swapMethod = GLX_SWAP_UNDEFINED_OML;
|
||||||
GLX_SWAP_UNDEFINED_OML;
|
|
||||||
|
|
||||||
// Stereo
|
// Stereo
|
||||||
c->stereoMode = stereo ? TRUE : FALSE;
|
c->stereoMode = stereo ? TRUE : FALSE;
|
||||||
|
|
||||||
// Aux buffers
|
// Aux buffers
|
||||||
c->numAuxBuffers =
|
c->numAuxBuffers = aux ? conf->aux_buffers : 0;
|
||||||
aux ? conf->aux_buffers : 0;
|
|
||||||
|
|
||||||
// Double Buffered
|
// Double Buffered
|
||||||
c->doubleBufferMode =
|
c->doubleBufferMode = buffers ? TRUE : FALSE;
|
||||||
buffers ? TRUE : FALSE;
|
|
||||||
|
|
||||||
// Stencil Buffer
|
// Stencil Buffer
|
||||||
if (conf->total_stencil_bit_depths >
|
if(conf->total_stencil_bit_depths > 0) {
|
||||||
0) {
|
c->stencilBits = conf->stencil_bit_depths[stencil];
|
||||||
c->stencilBits =
|
} else {
|
||||||
conf->stencil_bit_depths[
|
|
||||||
stencil];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
c->stencilBits = 0;
|
c->stencilBits = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Color
|
// Color
|
||||||
if (GLCAPS_COLOR_BUF_INVALID_VALUE !=
|
if(GLCAPS_COLOR_BUF_INVALID_VALUE != conf->color_buffers[color].a) {
|
||||||
conf->color_buffers[color].a) {
|
c->alphaBits = conf->color_buffers[color].a;
|
||||||
c->alphaBits =
|
} else {
|
||||||
conf->color_buffers[color].a;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
c->alphaBits = 0;
|
c->alphaBits = 0;
|
||||||
}
|
}
|
||||||
c->redBits =
|
c->redBits = conf->color_buffers[color].r;
|
||||||
conf->color_buffers[color].r;
|
c->greenBits = conf->color_buffers[color].g;
|
||||||
c->greenBits =
|
c->blueBits = conf->color_buffers[color].b;
|
||||||
conf->color_buffers[color].g;
|
|
||||||
c->blueBits =
|
|
||||||
conf->color_buffers[color].b;
|
|
||||||
|
|
||||||
c->rgbBits = c->alphaBits +
|
c->rgbBits = c->alphaBits + c->redBits + c->greenBits + c->blueBits;
|
||||||
c->redBits +
|
|
||||||
c->greenBits +
|
|
||||||
c->blueBits;
|
|
||||||
|
|
||||||
c->alphaMask =
|
c->alphaMask = AM_ARGB(c->alphaBits, c->redBits, c->greenBits, c->blueBits);
|
||||||
AM_ARGB(c->alphaBits, c->redBits,
|
c->redMask = RM_ARGB(c->alphaBits, c->redBits, c->greenBits, c->blueBits);
|
||||||
c->greenBits,
|
c->greenMask = GM_ARGB(c->alphaBits, c->redBits, c->greenBits, c->blueBits);
|
||||||
c->blueBits);
|
c->blueMask = BM_ARGB(c->alphaBits, c->redBits, c->greenBits, c->blueBits);
|
||||||
c->redMask =
|
|
||||||
RM_ARGB(c->alphaBits, c->redBits,
|
|
||||||
c->greenBits,
|
|
||||||
c->blueBits);
|
|
||||||
c->greenMask =
|
|
||||||
GM_ARGB(c->alphaBits, c->redBits,
|
|
||||||
c->greenBits,
|
|
||||||
c->blueBits);
|
|
||||||
c->blueMask =
|
|
||||||
BM_ARGB(c->alphaBits, c->redBits,
|
|
||||||
c->greenBits,
|
|
||||||
c->blueBits);
|
|
||||||
|
|
||||||
// Accumulation Buffers
|
// Accumulation Buffers
|
||||||
if (conf->total_accum_buffers > 0) {
|
if(conf->total_accum_buffers > 0) {
|
||||||
c->accumRedBits =
|
c->accumRedBits = conf->accum_buffers[accum].r;
|
||||||
conf->accum_buffers[accum].r;
|
c->accumGreenBits = conf->accum_buffers[accum].g;
|
||||||
c->accumGreenBits =
|
c->accumBlueBits = conf->accum_buffers[accum].b;
|
||||||
conf->accum_buffers[accum].g;
|
if(GLCAPS_COLOR_BUF_INVALID_VALUE != conf->accum_buffers[accum].a) {
|
||||||
c->accumBlueBits =
|
c->accumAlphaBits = conf->accum_buffers[accum].a;
|
||||||
conf->accum_buffers[accum].b;
|
} else {
|
||||||
if (
|
|
||||||
GLCAPS_COLOR_BUF_INVALID_VALUE
|
|
||||||
!=
|
|
||||||
conf->accum_buffers[accum].a)
|
|
||||||
{
|
|
||||||
c->accumAlphaBits =
|
|
||||||
conf->accum_buffers[accum
|
|
||||||
].a;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
c->accumAlphaBits = 0;
|
c->accumAlphaBits = 0;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
c->accumRedBits = 0;
|
c->accumRedBits = 0;
|
||||||
c->accumGreenBits = 0;
|
c->accumGreenBits = 0;
|
||||||
c->accumBlueBits = 0;
|
c->accumBlueBits = 0;
|
||||||
|
@ -271,17 +214,13 @@ __glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Depth
|
// Depth
|
||||||
c->depthBits =
|
c->depthBits = conf->depth_buffers[depth];
|
||||||
conf->depth_buffers[depth];
|
|
||||||
|
|
||||||
// MultiSample
|
// MultiSample
|
||||||
if (msample > 0) {
|
if(msample > 0) {
|
||||||
c->samples =
|
c->samples = conf->multisample_samples;
|
||||||
conf->multisample_samples;
|
c->sampleBuffers = conf->multisample_buffers;
|
||||||
c->sampleBuffers =
|
} else {
|
||||||
conf->multisample_buffers;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
c->samples = 0;
|
c->samples = 0;
|
||||||
c->sampleBuffers = 0;
|
c->sampleBuffers = 0;
|
||||||
}
|
}
|
||||||
|
@ -291,9 +230,7 @@ __glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber)
|
||||||
* GLXPbuffers in direct mode.
|
* GLXPbuffers in direct mode.
|
||||||
*/
|
*/
|
||||||
/* SGIX_fbconfig / GLX 1.3 */
|
/* SGIX_fbconfig / GLX 1.3 */
|
||||||
c->drawableType = GLX_WINDOW_BIT |
|
c->drawableType = GLX_WINDOW_BIT | GLX_PIXMAP_BIT | GLX_PBUFFER_BIT;
|
||||||
GLX_PIXMAP_BIT |
|
|
||||||
GLX_PBUFFER_BIT;
|
|
||||||
c->renderType = GLX_RGBA_BIT;
|
c->renderType = GLX_RGBA_BIT;
|
||||||
c->xRenderable = GL_TRUE;
|
c->xRenderable = GL_TRUE;
|
||||||
c->fbconfigID = -1;
|
c->fbconfigID = -1;
|
||||||
|
@ -310,8 +247,7 @@ __glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber)
|
||||||
*/
|
*/
|
||||||
c->maxPbufferWidth = 8192;
|
c->maxPbufferWidth = 8192;
|
||||||
c->maxPbufferHeight = 8192;
|
c->maxPbufferHeight = 8192;
|
||||||
c->maxPbufferPixels =
|
c->maxPbufferPixels = /*Do we need this?*/ 0;
|
||||||
/*Do we need this?*/ 0;
|
|
||||||
/*
|
/*
|
||||||
* There is no introspection for this sort of thing
|
* There is no introspection for this sort of thing
|
||||||
* with CGL. What should we do realistically?
|
* with CGL. What should we do realistically?
|
||||||
|
@ -337,12 +273,10 @@ __glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
(c - 1)->next = NULL;
|
(c-1)->next = NULL;
|
||||||
|
|
||||||
if (c - visualConfigs != numConfigs) {
|
if (c - visualConfigs != numConfigs) {
|
||||||
FatalError(
|
FatalError("numConfigs calculation error in setVisualConfigs! numConfigs is %d i is %d\n", numConfigs, (int)(c - visualConfigs));
|
||||||
"numConfigs calculation error in setVisualConfigs! numConfigs is %d i is %d\n",
|
|
||||||
numConfigs, (int)(c - visualConfigs));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
freeGlCapabilities(&caps);
|
freeGlCapabilities(&caps);
|
||||||
|
|
|
@ -230,13 +230,15 @@ DarwinScreenInit(ScreenPtr pScreen, int argc, char **argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Make PseudoColor visuals not suck in TrueColor mode
|
// TODO: Make PseudoColor visuals not suck in TrueColor mode
|
||||||
// if(dfb->depth > 8)
|
// if(dfb->depth > 8)
|
||||||
// miSetVisualTypesAndMasks(8, PseudoColorMask, 8, PseudoColor, 0, 0, 0);
|
// miSetVisualTypesAndMasks(8, PseudoColorMask, 8, PseudoColor, 0, 0, 0);
|
||||||
if (dfb->depth > 15)
|
//
|
||||||
miSetVisualTypesAndMasks(15, TrueColorMask, 5, TrueColor,
|
// TODO: Re-add support for 15bit
|
||||||
RM_ARGB(0, 5, 5, 5), GM_ARGB(0, 5, 5,
|
// if (dfb->depth > 15)
|
||||||
5),
|
// miSetVisualTypesAndMasks(15, TrueColorMask, 5, TrueColor,
|
||||||
BM_ARGB(0, 5, 5, 5));
|
// RM_ARGB(0, 5, 5, 5), GM_ARGB(0, 5, 5,
|
||||||
|
// 5),
|
||||||
|
// BM_ARGB(0, 5, 5, 5));
|
||||||
if (dfb->depth > 24)
|
if (dfb->depth > 24)
|
||||||
miSetVisualTypesAndMasks(24, TrueColorMask, 8, TrueColor,
|
miSetVisualTypesAndMasks(24, TrueColorMask, 8, TrueColor,
|
||||||
RM_ARGB(0, 8, 8, 8), GM_ARGB(0, 8, 8,
|
RM_ARGB(0, 8, 8, 8), GM_ARGB(0, 8, 8,
|
||||||
|
|
|
@ -359,6 +359,10 @@ have_depth:
|
||||||
dfb->blueMask = 0;
|
dfb->blueMask = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
// Removed because Mountain Lion removed support for
|
||||||
|
// 15bit backing stores. We can possibly re-add
|
||||||
|
// this once libXplugin is updated to work around it.
|
||||||
case 15:
|
case 15:
|
||||||
dfb->visuals = TrueColorMask; //LARGE_VISUALS;
|
dfb->visuals = TrueColorMask; //LARGE_VISUALS;
|
||||||
dfb->preferredCVC = TrueColor;
|
dfb->preferredCVC = TrueColor;
|
||||||
|
@ -369,6 +373,7 @@ have_depth:
|
||||||
dfb->greenMask = GM_ARGB(0, 5, 5, 5);
|
dfb->greenMask = GM_ARGB(0, 5, 5, 5);
|
||||||
dfb->blueMask = BM_ARGB(0, 5, 5, 5);
|
dfb->blueMask = BM_ARGB(0, 5, 5, 5);
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
// case 24:
|
// case 24:
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user