mesa/xlib: Remove support for color-index rendering
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
This commit is contained in:
@@ -152,13 +152,8 @@ is_usable_visual( XVisualInfo *vinfo )
|
|||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
case StaticColor:
|
case StaticColor:
|
||||||
case PseudoColor:
|
case PseudoColor:
|
||||||
/* Any StaticColor/PseudoColor visual of at least 4 bits */
|
/* Color-index rendering is not supported. */
|
||||||
if (vinfo->depth>=4) {
|
|
||||||
return GL_TRUE;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
|
||||||
case TrueColor:
|
case TrueColor:
|
||||||
case DirectColor:
|
case DirectColor:
|
||||||
/* Any depth of TrueColor or DirectColor works in RGB mode */
|
/* Any depth of TrueColor or DirectColor works in RGB mode */
|
||||||
@@ -268,7 +263,7 @@ level_of_visual( Display *dpy, XVisualInfo *vinfo )
|
|||||||
*/
|
*/
|
||||||
static XMesaVisual
|
static XMesaVisual
|
||||||
save_glx_visual( Display *dpy, XVisualInfo *vinfo,
|
save_glx_visual( Display *dpy, XVisualInfo *vinfo,
|
||||||
GLboolean rgbFlag, GLboolean alphaFlag, GLboolean dbFlag,
|
GLboolean alphaFlag, GLboolean dbFlag,
|
||||||
GLboolean stereoFlag,
|
GLboolean stereoFlag,
|
||||||
GLint depth_size, GLint stencil_size,
|
GLint depth_size, GLint stencil_size,
|
||||||
GLint accumRedSize, GLint accumGreenSize,
|
GLint accumRedSize, GLint accumGreenSize,
|
||||||
@@ -309,7 +304,7 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo,
|
|||||||
comparePointers = GL_FALSE;
|
comparePointers = GL_FALSE;
|
||||||
|
|
||||||
/* Force the visual to have an alpha channel */
|
/* Force the visual to have an alpha channel */
|
||||||
if (rgbFlag && _mesa_getenv("MESA_GLX_FORCE_ALPHA"))
|
if (_mesa_getenv("MESA_GLX_FORCE_ALPHA"))
|
||||||
alphaFlag = GL_TRUE;
|
alphaFlag = GL_TRUE;
|
||||||
|
|
||||||
/* First check if a matching visual is already in the list */
|
/* First check if a matching visual is already in the list */
|
||||||
@@ -319,7 +314,6 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo,
|
|||||||
&& v->mesa_visual.level == level
|
&& v->mesa_visual.level == level
|
||||||
&& v->mesa_visual.numAuxBuffers == numAuxBuffers
|
&& v->mesa_visual.numAuxBuffers == numAuxBuffers
|
||||||
&& v->ximage_flag == ximageFlag
|
&& v->ximage_flag == ximageFlag
|
||||||
&& v->mesa_visual.rgbMode == rgbFlag
|
|
||||||
&& v->mesa_visual.doubleBufferMode == dbFlag
|
&& v->mesa_visual.doubleBufferMode == dbFlag
|
||||||
&& v->mesa_visual.stereoMode == stereoFlag
|
&& v->mesa_visual.stereoMode == stereoFlag
|
||||||
&& (v->mesa_visual.alphaBits > 0) == alphaFlag
|
&& (v->mesa_visual.alphaBits > 0) == alphaFlag
|
||||||
@@ -339,7 +333,7 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo,
|
|||||||
|
|
||||||
/* Create a new visual and add it to the list. */
|
/* Create a new visual and add it to the list. */
|
||||||
|
|
||||||
xmvis = XMesaCreateVisual( dpy, vinfo, rgbFlag, alphaFlag, dbFlag,
|
xmvis = XMesaCreateVisual( dpy, vinfo, GL_TRUE, alphaFlag, dbFlag,
|
||||||
stereoFlag, ximageFlag,
|
stereoFlag, ximageFlag,
|
||||||
depth_size, stencil_size,
|
depth_size, stencil_size,
|
||||||
accumRedSize, accumBlueSize,
|
accumRedSize, accumBlueSize,
|
||||||
@@ -422,40 +416,14 @@ create_glx_visual( Display *dpy, XVisualInfo *visinfo )
|
|||||||
|
|
||||||
vislevel = level_of_visual( dpy, visinfo );
|
vislevel = level_of_visual( dpy, visinfo );
|
||||||
if (vislevel) {
|
if (vislevel) {
|
||||||
/* Configure this visual as a CI, single-buffered overlay */
|
/* Color-index rendering to overlays is not supported. */
|
||||||
return save_glx_visual( dpy, visinfo,
|
return NULL;
|
||||||
GL_FALSE, /* rgb */
|
|
||||||
GL_FALSE, /* alpha */
|
|
||||||
GL_FALSE, /* double */
|
|
||||||
GL_FALSE, /* stereo */
|
|
||||||
0, /* depth bits */
|
|
||||||
0, /* stencil bits */
|
|
||||||
0,0,0,0, /* accum bits */
|
|
||||||
vislevel, /* level */
|
|
||||||
0 /* numAux */
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
else if (is_usable_visual( visinfo )) {
|
else if (is_usable_visual( visinfo )) {
|
||||||
if (_mesa_getenv("MESA_GLX_FORCE_CI")) {
|
|
||||||
/* Configure this visual as a COLOR INDEX visual. */
|
|
||||||
return save_glx_visual( dpy, visinfo,
|
|
||||||
GL_FALSE, /* rgb */
|
|
||||||
GL_FALSE, /* alpha */
|
|
||||||
GL_TRUE, /* double */
|
|
||||||
GL_FALSE, /* stereo */
|
|
||||||
zBits,
|
|
||||||
STENCIL_BITS,
|
|
||||||
0, 0, 0, 0, /* accum bits */
|
|
||||||
0, /* level */
|
|
||||||
0 /* numAux */
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
/* Configure this visual as RGB, double-buffered, depth-buffered. */
|
/* Configure this visual as RGB, double-buffered, depth-buffered. */
|
||||||
/* This is surely wrong for some people's needs but what else */
|
/* This is surely wrong for some people's needs but what else */
|
||||||
/* can be done? They should use glXChooseVisual(). */
|
/* can be done? They should use glXChooseVisual(). */
|
||||||
return save_glx_visual( dpy, visinfo,
|
return save_glx_visual( dpy, visinfo,
|
||||||
GL_TRUE, /* rgb */
|
|
||||||
alphaFlag, /* alpha */
|
alphaFlag, /* alpha */
|
||||||
GL_TRUE, /* double */
|
GL_TRUE, /* double */
|
||||||
GL_FALSE, /* stereo */
|
GL_FALSE, /* stereo */
|
||||||
@@ -469,7 +437,6 @@ create_glx_visual( Display *dpy, XVisualInfo *visinfo )
|
|||||||
0 /* numAux */
|
0 /* numAux */
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
_mesa_warning(NULL, "Mesa: error in glXCreateContext: bad visual\n");
|
_mesa_warning(NULL, "Mesa: error in glXCreateContext: bad visual\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -623,8 +590,6 @@ get_env_visual(Display *dpy, int scr, const char *varname)
|
|||||||
|
|
||||||
if (strcmp(type,"TrueColor")==0) xclass = TrueColor;
|
if (strcmp(type,"TrueColor")==0) xclass = TrueColor;
|
||||||
else if (strcmp(type,"DirectColor")==0) xclass = DirectColor;
|
else if (strcmp(type,"DirectColor")==0) xclass = DirectColor;
|
||||||
else if (strcmp(type,"PseudoColor")==0) xclass = PseudoColor;
|
|
||||||
else if (strcmp(type,"StaticColor")==0) xclass = StaticColor;
|
|
||||||
else if (strcmp(type,"GrayScale")==0) xclass = GrayScale;
|
else if (strcmp(type,"GrayScale")==0) xclass = GrayScale;
|
||||||
else if (strcmp(type,"StaticGray")==0) xclass = StaticGray;
|
else if (strcmp(type,"StaticGray")==0) xclass = StaticGray;
|
||||||
|
|
||||||
@@ -646,21 +611,17 @@ get_env_visual(Display *dpy, int scr, const char *varname)
|
|||||||
/*
|
/*
|
||||||
* Select an X visual which satisfies the RGBA/CI flag and minimum depth.
|
* Select an X visual which satisfies the RGBA/CI flag and minimum depth.
|
||||||
* Input: dpy, screen - X display and screen number
|
* Input: dpy, screen - X display and screen number
|
||||||
* rgba - GL_TRUE = RGBA mode, GL_FALSE = CI mode
|
|
||||||
* min_depth - minimum visual depth
|
* min_depth - minimum visual depth
|
||||||
* preferred_class - preferred GLX visual class or DONT_CARE
|
* preferred_class - preferred GLX visual class or DONT_CARE
|
||||||
* Return: pointer to an XVisualInfo or NULL.
|
* Return: pointer to an XVisualInfo or NULL.
|
||||||
*/
|
*/
|
||||||
static XVisualInfo *
|
static XVisualInfo *
|
||||||
choose_x_visual( Display *dpy, int screen, GLboolean rgba, int min_depth,
|
choose_x_visual(Display *dpy, int screen, int min_depth, int preferred_class)
|
||||||
int preferred_class )
|
|
||||||
{
|
{
|
||||||
XVisualInfo *vis;
|
XVisualInfo *vis;
|
||||||
int xclass, visclass = 0;
|
int xclass, visclass = 0;
|
||||||
int depth;
|
int depth;
|
||||||
|
|
||||||
if (rgba) {
|
|
||||||
Atom hp_cr_maps = XInternAtom(dpy, "_HP_RGB_SMOOTH_MAP_LIST", True);
|
|
||||||
/* First see if the MESA_RGB_VISUAL env var is defined */
|
/* First see if the MESA_RGB_VISUAL env var is defined */
|
||||||
vis = get_env_visual( dpy, screen, "MESA_RGB_VISUAL" );
|
vis = get_env_visual( dpy, screen, "MESA_RGB_VISUAL" );
|
||||||
if (vis) {
|
if (vis) {
|
||||||
@@ -668,106 +629,25 @@ choose_x_visual( Display *dpy, int screen, GLboolean rgba, int min_depth,
|
|||||||
}
|
}
|
||||||
/* Otherwise, search for a suitable visual */
|
/* Otherwise, search for a suitable visual */
|
||||||
if (preferred_class==DONT_CARE) {
|
if (preferred_class==DONT_CARE) {
|
||||||
for (xclass=0;xclass<6;xclass++) {
|
for (xclass=0;xclass<4;xclass++) {
|
||||||
switch (xclass) {
|
switch (xclass) {
|
||||||
case 0: visclass = TrueColor; break;
|
case 0: visclass = TrueColor; break;
|
||||||
case 1: visclass = DirectColor; break;
|
case 1: visclass = DirectColor; break;
|
||||||
case 2: visclass = PseudoColor; break;
|
|
||||||
case 3: visclass = StaticColor; break;
|
|
||||||
case 4: visclass = GrayScale; break;
|
|
||||||
case 5: visclass = StaticGray; break;
|
|
||||||
}
|
|
||||||
if (min_depth==0) {
|
|
||||||
/* start with shallowest */
|
|
||||||
for (depth=0;depth<=32;depth++) {
|
|
||||||
if (visclass==TrueColor && depth==8 && !hp_cr_maps) {
|
|
||||||
/* Special case: try to get 8-bit PseudoColor before */
|
|
||||||
/* 8-bit TrueColor */
|
|
||||||
vis = get_visual( dpy, screen, 8, PseudoColor );
|
|
||||||
if (vis) {
|
|
||||||
return vis;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
vis = get_visual( dpy, screen, depth, visclass );
|
|
||||||
if (vis) {
|
|
||||||
return vis;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
/* start with deepest */
|
|
||||||
for (depth=32;depth>=min_depth;depth--) {
|
|
||||||
if (visclass==TrueColor && depth==8 && !hp_cr_maps) {
|
|
||||||
/* Special case: try to get 8-bit PseudoColor before */
|
|
||||||
/* 8-bit TrueColor */
|
|
||||||
vis = get_visual( dpy, screen, 8, PseudoColor );
|
|
||||||
if (vis) {
|
|
||||||
return vis;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
vis = get_visual( dpy, screen, depth, visclass );
|
|
||||||
if (vis) {
|
|
||||||
return vis;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
/* search for a specific visual class */
|
|
||||||
switch (preferred_class) {
|
|
||||||
case GLX_TRUE_COLOR_EXT: visclass = TrueColor; break;
|
|
||||||
case GLX_DIRECT_COLOR_EXT: visclass = DirectColor; break;
|
|
||||||
case GLX_PSEUDO_COLOR_EXT: visclass = PseudoColor; break;
|
|
||||||
case GLX_STATIC_COLOR_EXT: visclass = StaticColor; break;
|
|
||||||
case GLX_GRAY_SCALE_EXT: visclass = GrayScale; break;
|
|
||||||
case GLX_STATIC_GRAY_EXT: visclass = StaticGray; break;
|
|
||||||
default: return NULL;
|
|
||||||
}
|
|
||||||
if (min_depth==0) {
|
|
||||||
/* start with shallowest */
|
|
||||||
for (depth=0;depth<=32;depth++) {
|
|
||||||
vis = get_visual( dpy, screen, depth, visclass );
|
|
||||||
if (vis) {
|
|
||||||
return vis;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
/* start with deepest */
|
|
||||||
for (depth=32;depth>=min_depth;depth--) {
|
|
||||||
vis = get_visual( dpy, screen, depth, visclass );
|
|
||||||
if (vis) {
|
|
||||||
return vis;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
/* First see if the MESA_CI_VISUAL env var is defined */
|
|
||||||
vis = get_env_visual( dpy, screen, "MESA_CI_VISUAL" );
|
|
||||||
if (vis) {
|
|
||||||
return vis;
|
|
||||||
}
|
|
||||||
/* Otherwise, search for a suitable visual, starting with shallowest */
|
|
||||||
if (preferred_class==DONT_CARE) {
|
|
||||||
for (xclass=0;xclass<4;xclass++) {
|
|
||||||
switch (xclass) {
|
|
||||||
case 0: visclass = PseudoColor; break;
|
|
||||||
case 1: visclass = StaticColor; break;
|
|
||||||
case 2: visclass = GrayScale; break;
|
case 2: visclass = GrayScale; break;
|
||||||
case 3: visclass = StaticGray; break;
|
case 3: visclass = StaticGray; break;
|
||||||
}
|
}
|
||||||
/* try 8-bit up through 16-bit */
|
if (min_depth==0) {
|
||||||
for (depth=8;depth<=16;depth++) {
|
/* start with shallowest */
|
||||||
|
for (depth=0;depth<=32;depth++) {
|
||||||
vis = get_visual( dpy, screen, depth, visclass );
|
vis = get_visual( dpy, screen, depth, visclass );
|
||||||
if (vis) {
|
if (vis) {
|
||||||
return vis;
|
return vis;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* try min_depth up to 8-bit */
|
}
|
||||||
for (depth=min_depth;depth<8;depth++) {
|
else {
|
||||||
|
/* start with deepest */
|
||||||
|
for (depth=32;depth>=min_depth;depth--) {
|
||||||
vis = get_visual( dpy, screen, depth, visclass );
|
vis = get_visual( dpy, screen, depth, visclass );
|
||||||
if (vis) {
|
if (vis) {
|
||||||
return vis;
|
return vis;
|
||||||
@@ -775,26 +655,30 @@ choose_x_visual( Display *dpy, int screen, GLboolean rgba, int min_depth,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
/* search for a specific visual class */
|
/* search for a specific visual class */
|
||||||
switch (preferred_class) {
|
switch (preferred_class) {
|
||||||
case GLX_TRUE_COLOR_EXT: visclass = TrueColor; break;
|
case GLX_TRUE_COLOR_EXT: visclass = TrueColor; break;
|
||||||
case GLX_DIRECT_COLOR_EXT: visclass = DirectColor; break;
|
case GLX_DIRECT_COLOR_EXT: visclass = DirectColor; break;
|
||||||
case GLX_PSEUDO_COLOR_EXT: visclass = PseudoColor; break;
|
|
||||||
case GLX_STATIC_COLOR_EXT: visclass = StaticColor; break;
|
|
||||||
case GLX_GRAY_SCALE_EXT: visclass = GrayScale; break;
|
case GLX_GRAY_SCALE_EXT: visclass = GrayScale; break;
|
||||||
case GLX_STATIC_GRAY_EXT: visclass = StaticGray; break;
|
case GLX_STATIC_GRAY_EXT: visclass = StaticGray; break;
|
||||||
|
case GLX_PSEUDO_COLOR_EXT:
|
||||||
|
case GLX_STATIC_COLOR_EXT:
|
||||||
default: return NULL;
|
default: return NULL;
|
||||||
}
|
}
|
||||||
/* try 8-bit up through 16-bit */
|
if (min_depth==0) {
|
||||||
for (depth=8;depth<=16;depth++) {
|
/* start with shallowest */
|
||||||
|
for (depth=0;depth<=32;depth++) {
|
||||||
vis = get_visual( dpy, screen, depth, visclass );
|
vis = get_visual( dpy, screen, depth, visclass );
|
||||||
if (vis) {
|
if (vis) {
|
||||||
return vis;
|
return vis;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* try min_depth up to 8-bit */
|
}
|
||||||
for (depth=min_depth;depth<8;depth++) {
|
else {
|
||||||
|
/* start with deepest */
|
||||||
|
for (depth=32;depth>=min_depth;depth--) {
|
||||||
vis = get_visual( dpy, screen, depth, visclass );
|
vis = get_visual( dpy, screen, depth, visclass );
|
||||||
if (vis) {
|
if (vis) {
|
||||||
return vis;
|
return vis;
|
||||||
@@ -822,7 +706,7 @@ choose_x_visual( Display *dpy, int screen, GLboolean rgba, int min_depth,
|
|||||||
* Return: pointer to an XVisualInfo or NULL.
|
* Return: pointer to an XVisualInfo or NULL.
|
||||||
*/
|
*/
|
||||||
static XVisualInfo *
|
static XVisualInfo *
|
||||||
choose_x_overlay_visual( Display *dpy, int scr, GLboolean rgbFlag,
|
choose_x_overlay_visual( Display *dpy, int scr,
|
||||||
int level, int trans_type, int trans_value,
|
int level, int trans_type, int trans_value,
|
||||||
int min_depth, int preferred_class )
|
int min_depth, int preferred_class )
|
||||||
{
|
{
|
||||||
@@ -889,14 +773,8 @@ choose_x_overlay_visual( Display *dpy, int scr, GLboolean rgbFlag,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if RGB was requested, make sure we have True/DirectColor */
|
/* Color-index rendering is not supported. Make sure we have True/DirectColor */
|
||||||
if (rgbFlag && vislist->CLASS != TrueColor
|
if (vislist->CLASS != TrueColor && vislist->CLASS != DirectColor)
|
||||||
&& vislist->CLASS != DirectColor)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* if CI was requested, make sure we have a color indexed visual */
|
|
||||||
if (!rgbFlag
|
|
||||||
&& (vislist->CLASS == TrueColor || vislist->CLASS == DirectColor))
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (deepvis==NULL || vislist->depth > deepest) {
|
if (deepvis==NULL || vislist->depth > deepest) {
|
||||||
@@ -1266,6 +1144,9 @@ choose_visual( Display *dpy, int screen, const int *list, GLboolean fbConfig )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!rgb_flag)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
(void) caveat;
|
(void) caveat;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1285,47 +1166,28 @@ choose_visual( Display *dpy, int screen, const int *list, GLboolean fbConfig )
|
|||||||
if (vis) {
|
if (vis) {
|
||||||
/* give the visual some useful GLX attributes */
|
/* give the visual some useful GLX attributes */
|
||||||
double_flag = GL_TRUE;
|
double_flag = GL_TRUE;
|
||||||
if (vis->depth > 8)
|
if (vis->depth <= 8)
|
||||||
rgb_flag = GL_TRUE;
|
return NULL;
|
||||||
depth_size = default_depth_bits();
|
depth_size = default_depth_bits();
|
||||||
stencil_size = STENCIL_BITS;
|
stencil_size = STENCIL_BITS;
|
||||||
/* XXX accum??? */
|
/* XXX accum??? */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (level==0) {
|
else {
|
||||||
/* normal color planes */
|
/* RGB visual */
|
||||||
if (rgb_flag) {
|
|
||||||
/* Get an RGB visual */
|
|
||||||
int min_rgb = min_red + min_green + min_blue;
|
int min_rgb = min_red + min_green + min_blue;
|
||||||
if (min_rgb>1 && min_rgb<8) {
|
if (min_rgb>1 && min_rgb<8) {
|
||||||
/* a special case to be sure we can get a monochrome visual */
|
/* a special case to be sure we can get a monochrome visual */
|
||||||
min_rgb = 1;
|
min_rgb = 1;
|
||||||
}
|
}
|
||||||
vis = choose_x_visual( dpy, screen, rgb_flag, min_rgb, visual_type );
|
|
||||||
|
if (level==0) {
|
||||||
|
vis = choose_x_visual(dpy, screen, min_rgb, visual_type);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* Get a color index visual */
|
vis = choose_x_overlay_visual(dpy, screen, level,
|
||||||
vis = choose_x_visual( dpy, screen, rgb_flag, min_ci, visual_type );
|
|
||||||
accumRedSize = accumGreenSize = accumBlueSize = accumAlphaSize = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
/* over/underlay planes */
|
|
||||||
if (rgb_flag) {
|
|
||||||
/* rgba overlay */
|
|
||||||
int min_rgb = min_red + min_green + min_blue;
|
|
||||||
if (min_rgb>1 && min_rgb<8) {
|
|
||||||
/* a special case to be sure we can get a monochrome visual */
|
|
||||||
min_rgb = 1;
|
|
||||||
}
|
|
||||||
vis = choose_x_overlay_visual( dpy, screen, rgb_flag, level,
|
|
||||||
trans_type, trans_value, min_rgb, visual_type);
|
trans_type, trans_value, min_rgb, visual_type);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
/* color index overlay */
|
|
||||||
vis = choose_x_overlay_visual( dpy, screen, rgb_flag, level,
|
|
||||||
trans_type, trans_value, min_ci, visual_type );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vis) {
|
if (vis) {
|
||||||
@@ -1357,7 +1219,7 @@ choose_visual( Display *dpy, int screen, const int *list, GLboolean fbConfig )
|
|||||||
accumAlphaSize = alpha_flag ? accumRedSize : 0;
|
accumAlphaSize = alpha_flag ? accumRedSize : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
xmvis = save_glx_visual( dpy, vis, rgb_flag, alpha_flag, double_flag,
|
xmvis = save_glx_visual( dpy, vis, alpha_flag, double_flag,
|
||||||
stereo_flag, depth_size, stencil_size,
|
stereo_flag, depth_size, stencil_size,
|
||||||
accumRedSize, accumGreenSize,
|
accumRedSize, accumGreenSize,
|
||||||
accumBlueSize, accumAlphaSize, level, numAux );
|
accumBlueSize, accumAlphaSize, level, numAux );
|
||||||
@@ -2493,10 +2355,7 @@ Fake_glXQueryContext( Display *dpy, GLXContext ctx, int attribute, int *value )
|
|||||||
*value = xmctx->xm_visual->visinfo->visualid;
|
*value = xmctx->xm_visual->visinfo->visualid;
|
||||||
break;
|
break;
|
||||||
case GLX_RENDER_TYPE:
|
case GLX_RENDER_TYPE:
|
||||||
if (xmctx->xm_visual->mesa_visual.rgbMode)
|
|
||||||
*value = GLX_RGBA_TYPE;
|
*value = GLX_RGBA_TYPE;
|
||||||
else
|
|
||||||
*value = GLX_COLOR_INDEX_TYPE;
|
|
||||||
break;
|
break;
|
||||||
case GLX_SCREEN:
|
case GLX_SCREEN:
|
||||||
*value = 0;
|
*value = 0;
|
||||||
|
@@ -684,9 +684,7 @@ setup_grayscale(int client, XMesaVisual v,
|
|||||||
}
|
}
|
||||||
|
|
||||||
prevBuffer = xmesa_find_buffer(v->display, cmap, buffer);
|
prevBuffer = xmesa_find_buffer(v->display, cmap, buffer);
|
||||||
if (prevBuffer &&
|
if (prevBuffer) {
|
||||||
(buffer->xm_visual->mesa_visual.rgbMode ==
|
|
||||||
prevBuffer->xm_visual->mesa_visual.rgbMode)) {
|
|
||||||
/* Copy colormap stuff from previous XMesaBuffer which uses same
|
/* Copy colormap stuff from previous XMesaBuffer which uses same
|
||||||
* X colormap. Do this to avoid time spent in noFaultXAllocColor.
|
* X colormap. Do this to avoid time spent in noFaultXAllocColor.
|
||||||
*/
|
*/
|
||||||
@@ -773,9 +771,7 @@ setup_dithered_color(int client, XMesaVisual v,
|
|||||||
}
|
}
|
||||||
|
|
||||||
prevBuffer = xmesa_find_buffer(v->display, cmap, buffer);
|
prevBuffer = xmesa_find_buffer(v->display, cmap, buffer);
|
||||||
if (prevBuffer &&
|
if (prevBuffer) {
|
||||||
(buffer->xm_visual->mesa_visual.rgbMode ==
|
|
||||||
prevBuffer->xm_visual->mesa_visual.rgbMode)) {
|
|
||||||
/* Copy colormap stuff from previous, matching XMesaBuffer.
|
/* Copy colormap stuff from previous, matching XMesaBuffer.
|
||||||
* Do this to avoid time spent in noFaultXAllocColor.
|
* Do this to avoid time spent in noFaultXAllocColor.
|
||||||
*/
|
*/
|
||||||
@@ -1047,10 +1043,11 @@ setup_monochrome( XMesaVisual v, XMesaBuffer b )
|
|||||||
*/
|
*/
|
||||||
static GLboolean
|
static GLboolean
|
||||||
initialize_visual_and_buffer(XMesaVisual v, XMesaBuffer b,
|
initialize_visual_and_buffer(XMesaVisual v, XMesaBuffer b,
|
||||||
GLboolean rgb_flag, XMesaDrawable window,
|
XMesaDrawable window,
|
||||||
XMesaColormap cmap)
|
XMesaColormap cmap)
|
||||||
{
|
{
|
||||||
int client = 0;
|
int client = 0;
|
||||||
|
const int xclass = v->mesa_visual.visualType;
|
||||||
|
|
||||||
#ifdef XFree86Server
|
#ifdef XFree86Server
|
||||||
client = (window) ? CLIENT_ID(window->id) : 0;
|
client = (window) ? CLIENT_ID(window->id) : 0;
|
||||||
@@ -1062,19 +1059,9 @@ initialize_visual_and_buffer(XMesaVisual v, XMesaBuffer b,
|
|||||||
v->BitsPerPixel = bits_per_pixel(v);
|
v->BitsPerPixel = bits_per_pixel(v);
|
||||||
assert(v->BitsPerPixel > 0);
|
assert(v->BitsPerPixel > 0);
|
||||||
|
|
||||||
if (rgb_flag == GL_FALSE) {
|
|
||||||
/* COLOR-INDEXED WINDOW:
|
|
||||||
* Even if the visual is TrueColor or DirectColor we treat it as
|
|
||||||
* being color indexed. This is weird but might be useful to someone.
|
|
||||||
*/
|
|
||||||
v->dithered_pf = v->undithered_pf = PF_Index;
|
|
||||||
v->mesa_visual.indexBits = GET_VISUAL_DEPTH(v);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
/* RGB WINDOW:
|
/* RGB WINDOW:
|
||||||
* We support RGB rendering into almost any kind of visual.
|
* We support RGB rendering into almost any kind of visual.
|
||||||
*/
|
*/
|
||||||
const int xclass = v->mesa_visual.visualType;
|
|
||||||
if (xclass == GLX_TRUE_COLOR || xclass == GLX_DIRECT_COLOR) {
|
if (xclass == GLX_TRUE_COLOR || xclass == GLX_DIRECT_COLOR) {
|
||||||
setup_truecolor( v, b, cmap );
|
setup_truecolor( v, b, cmap );
|
||||||
}
|
}
|
||||||
@@ -1101,7 +1088,6 @@ initialize_visual_and_buffer(XMesaVisual v, XMesaBuffer b,
|
|||||||
if (_mesa_getenv("MESA_NO_DITHER")) {
|
if (_mesa_getenv("MESA_NO_DITHER")) {
|
||||||
v->dithered_pf = v->undithered_pf;
|
v->dithered_pf = v->undithered_pf;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1359,6 +1345,10 @@ XMesaVisual XMesaCreateVisual( XMesaDisplay *display,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Color-index rendering not supported. */
|
||||||
|
if (!rgb_flag)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
v = (XMesaVisual) CALLOC_STRUCT(xmesa_visual);
|
v = (XMesaVisual) CALLOC_STRUCT(xmesa_visual);
|
||||||
if (!v) {
|
if (!v) {
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -1428,7 +1418,7 @@ XMesaVisual XMesaCreateVisual( XMesaDisplay *display,
|
|||||||
if (alpha_flag)
|
if (alpha_flag)
|
||||||
v->mesa_visual.alphaBits = 8;
|
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->mesa_visual.visualType;
|
const int xclass = v->mesa_visual.visualType;
|
||||||
@@ -1453,7 +1443,7 @@ XMesaVisual XMesaCreateVisual( XMesaDisplay *display,
|
|||||||
}
|
}
|
||||||
|
|
||||||
_mesa_initialize_visual( &v->mesa_visual,
|
_mesa_initialize_visual( &v->mesa_visual,
|
||||||
rgb_flag, db_flag, stereo_flag,
|
GL_TRUE, db_flag, stereo_flag,
|
||||||
red_bits, green_bits,
|
red_bits, green_bits,
|
||||||
blue_bits, alpha_bits,
|
blue_bits, alpha_bits,
|
||||||
v->mesa_visual.indexBits,
|
v->mesa_visual.indexBits,
|
||||||
@@ -1655,8 +1645,7 @@ XMesaCreateWindowBuffer(XMesaVisual v, XMesaWindow w)
|
|||||||
if (!b)
|
if (!b)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (!initialize_visual_and_buffer( v, b, v->mesa_visual.rgbMode,
|
if (!initialize_visual_and_buffer( v, b, (XMesaDrawable) w, cmap )) {
|
||||||
(XMesaDrawable) w, cmap )) {
|
|
||||||
xmesa_free_buffer(b);
|
xmesa_free_buffer(b);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -1686,8 +1675,7 @@ XMesaCreatePixmapBuffer(XMesaVisual v, XMesaPixmap p, XMesaColormap cmap)
|
|||||||
if (!b)
|
if (!b)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (!initialize_visual_and_buffer(v, b, v->mesa_visual.rgbMode,
|
if (!initialize_visual_and_buffer(v, b, (XMesaDrawable) p, cmap)) {
|
||||||
(XMesaDrawable) p, cmap)) {
|
|
||||||
xmesa_free_buffer(b);
|
xmesa_free_buffer(b);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -1747,8 +1735,7 @@ XMesaCreatePixmapTextureBuffer(XMesaVisual v, XMesaPixmap p,
|
|||||||
b->TextureFormat = format;
|
b->TextureFormat = format;
|
||||||
b->TextureMipmap = mipmap;
|
b->TextureMipmap = mipmap;
|
||||||
|
|
||||||
if (!initialize_visual_and_buffer(v, b, v->mesa_visual.rgbMode,
|
if (!initialize_visual_and_buffer(v, b, (XMesaDrawable) p, cmap)) {
|
||||||
(XMesaDrawable) p, cmap)) {
|
|
||||||
xmesa_free_buffer(b);
|
xmesa_free_buffer(b);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -1778,8 +1765,7 @@ XMesaCreatePBuffer(XMesaVisual v, XMesaColormap cmap,
|
|||||||
if (!b)
|
if (!b)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (!initialize_visual_and_buffer(v, b, v->mesa_visual.rgbMode,
|
if (!initialize_visual_and_buffer(v, b, drawable, cmap)) {
|
||||||
drawable, cmap)) {
|
|
||||||
xmesa_free_buffer(b);
|
xmesa_free_buffer(b);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -1874,7 +1860,6 @@ GLboolean XMesaMakeCurrent2( XMesaContext c, XMesaBuffer drawBuffer,
|
|||||||
&drawBuffer->mesa_buffer,
|
&drawBuffer->mesa_buffer,
|
||||||
&readBuffer->mesa_buffer);
|
&readBuffer->mesa_buffer);
|
||||||
|
|
||||||
if (c->xm_visual->mesa_visual.rgbMode) {
|
|
||||||
/*
|
/*
|
||||||
* Must recompute and set these pixel values because colormap
|
* Must recompute and set these pixel values because colormap
|
||||||
* can be different for different windows.
|
* can be different for different windows.
|
||||||
@@ -1886,7 +1871,6 @@ GLboolean XMesaMakeCurrent2( XMesaContext c, XMesaBuffer drawBuffer,
|
|||||||
c->clearcolor[3],
|
c->clearcolor[3],
|
||||||
c->xm_visual->undithered_pf);
|
c->xm_visual->undithered_pf);
|
||||||
XMesaSetForeground(c->display, drawBuffer->cleargc, c->clearpixel);
|
XMesaSetForeground(c->display, drawBuffer->cleargc, c->clearpixel);
|
||||||
}
|
|
||||||
|
|
||||||
/* Solution to Stephane Rehel's problem with glXReleaseBuffersMESA(): */
|
/* Solution to Stephane Rehel's problem with glXReleaseBuffersMESA(): */
|
||||||
drawBuffer->wasCurrent = GL_TRUE;
|
drawBuffer->wasCurrent = GL_TRUE;
|
||||||
|
@@ -337,18 +337,10 @@ xmesa_new_renderbuffer(GLcontext *ctx, GLuint name, const GLvisual *visual,
|
|||||||
else
|
else
|
||||||
xrb->Base.AllocStorage = xmesa_alloc_front_storage;
|
xrb->Base.AllocStorage = xmesa_alloc_front_storage;
|
||||||
|
|
||||||
if (visual->rgbMode) {
|
|
||||||
xrb->Base.InternalFormat = GL_RGBA;
|
xrb->Base.InternalFormat = GL_RGBA;
|
||||||
xrb->Base.Format = MESA_FORMAT_RGBA8888;
|
xrb->Base.Format = MESA_FORMAT_RGBA8888;
|
||||||
xrb->Base._BaseFormat = GL_RGBA;
|
xrb->Base._BaseFormat = GL_RGBA;
|
||||||
xrb->Base.DataType = GL_UNSIGNED_BYTE;
|
xrb->Base.DataType = GL_UNSIGNED_BYTE;
|
||||||
}
|
|
||||||
else {
|
|
||||||
xrb->Base.InternalFormat = GL_COLOR_INDEX;
|
|
||||||
xrb->Base.Format = MESA_FORMAT_CI8;
|
|
||||||
xrb->Base._BaseFormat = GL_COLOR_INDEX;
|
|
||||||
xrb->Base.DataType = GL_UNSIGNED_INT;
|
|
||||||
}
|
|
||||||
/* only need to set Red/Green/EtcBits fields for user-created RBs */
|
/* only need to set Red/Green/EtcBits fields for user-created RBs */
|
||||||
}
|
}
|
||||||
return xrb;
|
return xrb;
|
||||||
|
Reference in New Issue
Block a user