summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2005-01-06 21:56:16 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2005-01-06 21:56:16 +0000
commit1f98ee90228aa56df207cdbd223bb4b8c0bb15d9 (patch)
tree2fe5121971e4b13cb2268239499beeecb1701f0e
parent8bb717d2d54c6e74db3008d30ea90200e578e42c (diff)
In choose_visual() we need to know if we're being called from
glXChooseVisual() or glXChooseFBConfig() so that we handle the GLX_DOUBLEBUFFER and GLX_STEREO tokens correctly. Added some new error checking in those functions too.
-rw-r--r--src/mesa/drivers/x11/fakeglx.c50
1 files changed, 38 insertions, 12 deletions
diff --git a/src/mesa/drivers/x11/fakeglx.c b/src/mesa/drivers/x11/fakeglx.c
index 1ad62d9e0d..82830b4717 100644
--- a/src/mesa/drivers/x11/fakeglx.c
+++ b/src/mesa/drivers/x11/fakeglx.c
@@ -2,7 +2,7 @@
* Mesa 3-D graphics library
* Version: 6.3
*
- * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -903,9 +903,9 @@ choose_x_overlay_visual( Display *dpy, int scr, GLboolean rgbFlag,
static XMesaVisual
-choose_visual( Display *dpy, int screen, const int *list,
- GLboolean rgbModeDefault )
+choose_visual( Display *dpy, int screen, const int *list, GLboolean fbConfig )
{
+ const GLboolean rgbModeDefault = fbConfig;
const int *parselist;
XVisualInfo *vis;
int min_ci = 0;
@@ -935,8 +935,14 @@ choose_visual( Display *dpy, int screen, const int *list,
switch (*parselist) {
case GLX_USE_GL:
- /* ignore */
- parselist++;
+ if (fbConfig) {
+ /* invalid token */
+ return NULL;
+ }
+ else {
+ /* skip */
+ parselist++;
+ }
break;
case GLX_BUFFER_SIZE:
parselist++;
@@ -947,18 +953,34 @@ choose_visual( Display *dpy, int screen, const int *list,
level = *parselist++;
break;
case GLX_RGBA:
- rgb_flag = GL_TRUE;
- parselist++;
+ if (fbConfig) {
+ /* invalid token */
+ return NULL;
+ }
+ else {
+ rgb_flag = GL_TRUE;
+ parselist++;
+ }
break;
case GLX_DOUBLEBUFFER:
- double_flag = GL_TRUE;
- parselist++;
+ parselist++;
+ if (fbConfig) {
+ double_flag = *parselist++;
+ }
+ else {
+ double_flag = GL_TRUE;
+ }
break;
case GLX_STEREO:
- stereo_flag = GL_TRUE;
- return NULL;
+ parselist++;
+ if (fbConfig) {
+ stereo_flag = *parselist++;
+ }
+ else {
+ stereo_flag = GL_TRUE;
+ }
+ return NULL; /* stereo not supported */
case GLX_AUX_BUFFERS:
- /* ignore */
parselist++;
numAux = *parselist++;
if (numAux > MAX_AUX_BUFFERS)
@@ -1542,6 +1564,8 @@ get_config( XMesaVisual xmvis, int attrib, int *value, GLboolean fbconfig )
ASSERT(xmvis);
switch(attrib) {
case GLX_USE_GL:
+ if (fbconfig)
+ return GLX_BAD_ATTRIBUTE;
*value = (int) True;
return 0;
case GLX_BUFFER_SIZE:
@@ -1551,6 +1575,8 @@ get_config( XMesaVisual xmvis, int attrib, int *value, GLboolean fbconfig )
*value = xmvis->mesa_visual.level;
return 0;
case GLX_RGBA:
+ if (fbconfig)
+ return GLX_BAD_ATTRIBUTE;
if (xmvis->mesa_visual.rgbMode) {
*value = True;
}