GLint i;
GLboolean comparePointers;
+ if (!rgbFlag)
+ return NULL;
+
if (dbFlag) {
/* Check if the MESA_BACK_BUFFER env var is set */
char *backbuffer = getenv("MESA_BACK_BUFFER");
&& v->mesa_visual.numAuxBuffers == numAuxBuffers
&& v->mesa_visual.samples == num_samples
&& v->ximage_flag == ximageFlag
- && v->mesa_visual.rgbMode == rgbFlag
&& v->mesa_visual.doubleBufferMode == dbFlag
&& v->mesa_visual.stereoMode == stereoFlag
&& (v->mesa_visual.alphaBits > 0) == alphaFlag
case GLX_RGBA:
if (fbconfig)
return GLX_BAD_ATTRIBUTE;
- if (xmvis->mesa_visual.rgbMode) {
- *value = True;
- }
- else {
- *value = False;
- }
+ *value = True;
return 0;
case GLX_DOUBLEBUFFER:
*value = (int) xmvis->mesa_visual.doubleBufferMode;
case GLX_RENDER_TYPE_SGIX:
if (!fbconfig)
return GLX_BAD_ATTRIBUTE;
- if (xmvis->mesa_visual.rgbMode)
- *value = GLX_RGBA_BIT;
- else
- *value = GLX_COLOR_INDEX_BIT;
+ *value = GLX_RGBA_BIT;
break;
case GLX_X_RENDERABLE_SGIX:
if (!fbconfig)
*value = xmctx->xm_visual->visinfo->visualid;
break;
case GLX_RENDER_TYPE:
- if (xmctx->xm_visual->mesa_visual.rgbMode)
- *value = GLX_RGBA_TYPE;
- else
- *value = GLX_COLOR_INDEX_TYPE;
+ *value = GLX_RGBA_TYPE;
break;
case GLX_SCREEN:
*value = 0;
* initializing the context's visual and buffer information.
* \param v the XMesaVisual to initialize
* \param b the XMesaBuffer to initialize (may be NULL)
- * \param rgb_flag TRUE = RGBA mode, FALSE = color index mode
* \param window the window/pixmap we're rendering into
* \param cmap the colormap associated with the window/pixmap
* \return GL_TRUE=success, GL_FALSE=failure
*/
static GLboolean
initialize_visual_and_buffer(XMesaVisual v, XMesaBuffer b,
- GLboolean rgb_flag, Drawable window,
- Colormap cmap)
+ Drawable window, Colormap cmap)
{
assert(!b || b->xm_visual == v);
v->BitsPerPixel = bits_per_pixel(v);
assert(v->BitsPerPixel > 0);
- if (rgb_flag == GL_FALSE) {
- /* COLOR-INDEXED WINDOW: not supported*/
+ /* RGB WINDOW:
+ * We support RGB rendering into almost any kind of visual.
+ */
+ const int xclass = v->visualType;
+ if (xclass != GLX_TRUE_COLOR && xclass != GLX_DIRECT_COLOR) {
+ _mesa_warning(NULL,
+ "XMesa: RGB mode rendering not supported in given visual.\n");
return GL_FALSE;
}
- else {
- /* RGB WINDOW:
- * We support RGB rendering into almost any kind of visual.
- */
- const int xclass = v->visualType;
- if (xclass != GLX_TRUE_COLOR && xclass != GLX_DIRECT_COLOR) {
- _mesa_warning(NULL,
- "XMesa: RGB mode rendering not supported in given visual.\n");
- return GL_FALSE;
- }
- if (v->BitsPerPixel == 32) {
- /* We use XImages for all front/back buffers. If an X Window or
- * X Pixmap is 32bpp, there's no guarantee that the alpha channel
- * will be preserved. For XImages we're in luck.
- */
- v->mesa_visual.alphaBits = 8;
- }
+ if (v->BitsPerPixel == 32) {
+ /* We use XImages for all front/back buffers. If an X Window or
+ * X Pixmap is 32bpp, there's no guarantee that the alpha channel
+ * will be preserved. For XImages we're in luck.
+ */
+ v->mesa_visual.alphaBits = 8;
}
/*
if (!xmdpy)
return NULL;
+ if (!rgb_flag)
+ return NULL;
+
/* For debugging only */
if (getenv("MESA_XSYNC")) {
/* This makes debugging X easier.
if (alpha_flag)
v->mesa_visual.alphaBits = 8;
- (void) initialize_visual_and_buffer( v, NULL, rgb_flag, 0, 0 );
+ (void) initialize_visual_and_buffer( v, NULL, 0, 0 );
{
const int xclass = v->visualType;
{
struct gl_config *vis = &v->mesa_visual;
- vis->rgbMode = GL_TRUE;
vis->doubleBufferMode = db_flag;
vis->stereoMode = stereo_flag;
if (!b)
return NULL;
- if (!initialize_visual_and_buffer( v, b, v->mesa_visual.rgbMode,
- (Drawable) w, cmap )) {
+ if (!initialize_visual_and_buffer( v, b, (Drawable) w, cmap )) {
xmesa_free_buffer(b);
return NULL;
}
if (!b)
return NULL;
- if (!initialize_visual_and_buffer(v, b, v->mesa_visual.rgbMode,
- (Drawable) p, cmap)) {
+ if (!initialize_visual_and_buffer(v, b, (Drawable) p, cmap)) {
xmesa_free_buffer(b);
return NULL;
}
b->TextureFormat = format;
b->TextureMipmap = mipmap;
- if (!initialize_visual_and_buffer(v, b, v->mesa_visual.rgbMode,
- (Drawable) p, cmap)) {
+ if (!initialize_visual_and_buffer(v, b, (Drawable) p, cmap)) {
xmesa_free_buffer(b);
return NULL;
}
if (!b)
return NULL;
- if (!initialize_visual_and_buffer(v, b, v->mesa_visual.rgbMode,
- drawable, cmap)) {
+ if (!initialize_visual_and_buffer(v, b, drawable, cmap)) {
xmesa_free_buffer(b);
return NULL;
}
case GLX_RGBA:
if (fbconfig)
return GLX_BAD_ATTRIBUTE;
- if (xmvis->mesa_visual.rgbMode) {
- *value = True;
- }
- else {
- *value = False;
- }
+ *value = True;
return 0;
case GLX_DOUBLEBUFFER:
*value = (int) xmvis->mesa_visual.doubleBufferMode;
}
else if (xmvis->mesa_visual.level>0) {
/* overlay */
- if (xmvis->mesa_visual.rgbMode) {
- *value = GLX_TRANSPARENT_RGB_EXT;
- }
- else {
- *value = GLX_TRANSPARENT_INDEX_EXT;
- }
+ *value = GLX_TRANSPARENT_RGB_EXT;
}
else if (xmvis->mesa_visual.level<0) {
/* underlay */
return GLX_BAD_ATTRIBUTE;
if (xmvis->mesa_visual.floatMode)
*value = GLX_RGBA_FLOAT_BIT_ARB;
- else if (xmvis->mesa_visual.rgbMode)
- *value = GLX_RGBA_BIT;
else
- *value = GLX_COLOR_INDEX_BIT;
+ *value = GLX_RGBA_BIT;
break;
case GLX_X_RENDERABLE_SGIX:
if (!fbconfig)