summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/x11/fakeglx.c36
1 files changed, 30 insertions, 6 deletions
diff --git a/src/mesa/drivers/x11/fakeglx.c b/src/mesa/drivers/x11/fakeglx.c
index fca66189154..a382163c3ab 100644
--- a/src/mesa/drivers/x11/fakeglx.c
+++ b/src/mesa/drivers/x11/fakeglx.c
@@ -1,4 +1,4 @@
-/* $Id: fakeglx.c,v 1.34.4.3 2000/10/05 17:38:03 brianp Exp $ */
+/* $Id: fakeglx.c,v 1.34.4.4 2000/11/03 02:35:54 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -858,7 +858,7 @@ Fake_glXChooseVisual( Display *dpy, int screen, int *list )
int *parselist;
XVisualInfo *vis;
int min_ci = 0;
- int min_red=0, min_green=0, min_blue=0;
+ int min_red=0, min_green=0, min_blue=0, min_alpha=0;
GLboolean rgb_flag = GL_FALSE;
GLboolean alpha_flag = GL_FALSE;
GLboolean double_flag = GL_FALSE;
@@ -922,10 +922,8 @@ Fake_glXChooseVisual( Display *dpy, int screen, int *list )
break;
case GLX_ALPHA_SIZE:
parselist++;
- {
- GLint size = *parselist++;
- alpha_flag = size>0 ? 1 : 0;
- }
+ min_alpha = *parselist++;
+ alpha_flag = (min_alpha > 0);
break;
case GLX_DEPTH_SIZE:
parselist++;
@@ -1004,6 +1002,16 @@ Fake_glXChooseVisual( Display *dpy, int screen, int *list )
}
}
+ /* DEBUG
+ printf("glXChooseVisual:\n");
+ printf(" GLX_RED_SIZE = %d\n", min_red);
+ printf(" GLX_GREEN_SIZE = %d\n", min_green);
+ printf(" GLX_BLUE_SIZE = %d\n", min_blue);
+ printf(" GLX_ALPHA_SIZE = %d\n", min_alpha);
+ printf(" GLX_DEPTH_SIZE = %d\n", depth_size);
+ printf(" GLX_STENCIL_SIZE = %d\n", stencil_size);
+ */
+
/*
* Since we're only simulating the GLX extension this function will never
* find any real GL visuals. Instead, all we can do is try to find an RGB
@@ -1060,6 +1068,22 @@ Fake_glXChooseVisual( Display *dpy, int screen, int *list )
else if (depth_size > 0)
depth_size = DEFAULT_SOFTWARE_DEPTH_BITS; /*16*/
+ /* If using Glide, make sure we don't try to setup an impossible
+ * visual. This fixes the Q3 bug in which 24-bit Z was being reported.
+ */
+ {
+ const char *fx = getenv("MESA_GLX_FX");
+ if (fx && fx[0] != 'd')
+ if (depth_size > 16 ||
+ stencil_size > 0 ||
+ (min_red > 1 && min_red > 5) ||
+ (min_green > 1 && min_green > 6) ||
+ (min_blue > 1 && min_blue > 5) ||
+ alpha_flag)
+ return NULL;
+ }
+
+
/* we only support one size of stencil and accum buffers. */
if (stencil_size > 0)
stencil_size = STENCIL_BITS;