summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2005-11-04 16:41:06 +0000
committerBrian Paul <[email protected]>2005-11-04 16:41:06 +0000
commitc12ee99d119debe1a421a77c1cc6d99d958ae94b (patch)
treece4c48ba481ece5cddff23fbc754ab31f795584b /src
parentf805cdfedff6e502ab30285d6cd50a9db828376b (diff)
MESA_GLX_ALPHA_BITS env var to force visual with alpha channel
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/x11/fakeglx.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/mesa/drivers/x11/fakeglx.c b/src/mesa/drivers/x11/fakeglx.c
index cd26bade30b..1933fed0673 100644
--- a/src/mesa/drivers/x11/fakeglx.c
+++ b/src/mesa/drivers/x11/fakeglx.c
@@ -379,6 +379,18 @@ default_depth_bits(void)
}
static GLint
+default_alpha_bits(void)
+{
+ int aBits;
+ const char *aEnv = _mesa_getenv("MESA_GLX_ALPHA_BITS");
+ if (aEnv)
+ aBits = _mesa_atoi(aEnv);
+ else
+ aBits = 0;
+ return aBits;
+}
+
+static GLint
default_accum_bits(void)
{
return 16;
@@ -400,6 +412,7 @@ create_glx_visual( Display *dpy, XVisualInfo *visinfo )
int vislevel;
GLint zBits = default_depth_bits();
GLint accBits = default_accum_bits();
+ GLboolean alphaFlag = default_alpha_bits() > 0;
vislevel = level_of_visual( dpy, visinfo );
if (vislevel) {
@@ -437,7 +450,7 @@ create_glx_visual( Display *dpy, XVisualInfo *visinfo )
/* can be done? They should use glXChooseVisual(). */
return save_glx_visual( dpy, visinfo,
GL_TRUE, /* rgb */
- GL_FALSE, /* alpha */
+ alphaFlag, /* alpha */
GL_TRUE, /* double */
GL_FALSE, /* stereo */
zBits,
@@ -1013,7 +1026,7 @@ choose_visual( Display *dpy, int screen, const int *list, GLboolean fbConfig )
parselist++;
{
GLint size = *parselist++;
- alpha_flag = size>0 ? 1 : 0;
+ alpha_flag = size ? GL_TRUE : GL_FALSE;
}
break;
case GLX_DEPTH_SIZE:
@@ -1223,6 +1236,10 @@ choose_visual( Display *dpy, int screen, const int *list, GLboolean fbConfig )
depth_size = default_depth_bits();
}
+ if (!alpha_flag) {
+ alpha_flag = default_alpha_bits() > 0;
+ }
+
/* we only support one size of stencil and accum buffers. */
if (stencil_size > 0)
stencil_size = STENCIL_BITS;