From 1f98ee90228aa56df207cdbd223bb4b8c0bb15d9 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 6 Jan 2005 21:56:16 +0000 Subject: 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. --- src/mesa/drivers/x11/fakeglx.c | 50 ++++++++++++++++++++++++++++++++---------- 1 file changed, 38 insertions(+), 12 deletions(-) (limited to 'src/mesa/drivers/x11') diff --git a/src/mesa/drivers/x11/fakeglx.c b/src/mesa/drivers/x11/fakeglx.c index 1ad62d9e0d9..82830b47172 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; } -- cgit v1.2.3