Search
lxdream.org :: lxdream :: r676:705a5707da13
lxdream 0.9.1
released Jun 29
Download Now
changeset676:705a5707da13
parent675:b97020f9af1c
child677:3ee62740ff8f
authornkeynes
dateTue May 27 23:59:54 2008 +0000 (11 years ago)
Add a fallback to 16-bit depth buffers (with appropriate warnings). Could probably be cleaner
src/drivers/video_glx.c
1.1 --- a/src/drivers/video_glx.c Mon May 26 11:01:42 2008 +0000
1.2 +++ b/src/drivers/video_glx.c Tue May 27 23:59:54 2008 +0000
1.3 @@ -20,6 +20,7 @@
1.4 #include "display.h"
1.5 #include <X11/Xlib.h>
1.6 #include <GL/glx.h>
1.7 +#include <string.h>
1.8 #include "pvr2/pvr2.h"
1.9 #include "pvr2/glutil.h"
1.10 #include "drivers/video_glx.h"
1.11 @@ -112,7 +113,16 @@
1.12 fb_attribs, &nelem );
1.13
1.14 if( configs == NULL || nelem == 0 ) {
1.15 - /* Didn't work. Fallback to 1.2 methods */
1.16 + /* Try a 16-bit depth buffer and see if it helps */
1.17 + fb_attribs[5] = 16;
1.18 + configs = glXChooseFBConfig( display, screen, fb_attribs, &nelem );
1.19 + if( nelem > 0 ) {
1.20 + WARN( "Using a 16-bit depth buffer - expect video glitches" );
1.21 + }
1.22 +
1.23 + }
1.24 + if( configs == NULL || nelem == 0 ) {
1.25 + /* Still didn't work. Fallback to 1.2 methods */
1.26 glx_fbconfig_supported = FALSE;
1.27 glx_pbuffer_supported = FALSE;
1.28 } else {
1.29 @@ -125,6 +135,14 @@
1.30 if( !glx_fbconfig_supported ) {
1.31 int attribs[] = { GLX_RGBA, GLX_DEPTH_SIZE, 24, 0 };
1.32 glx_visual = glXChooseVisual( display, screen, attribs );
1.33 + if( glx_visual == NULL ) {
1.34 + /* Try the 16-bit fallback here too */
1.35 + attribs[2] = 16;
1.36 + glx_visual = glXChooseVisual( display, screen, attribs );
1.37 + if( glx_visual != NULL ) {
1.38 + WARN( "Using a 16-bit depth buffer - expect video glitches" );
1.39 + }
1.40 + }
1.41 }
1.42
1.43 if( glx_visual == NULL ) {
.