better depth buffer selection
authorBrian <brian.paul@tungstengraphics.com>
Wed, 7 Nov 2007 21:41:01 +0000 (14:41 -0700)
committerBrian <brian.paul@tungstengraphics.com>
Wed, 7 Nov 2007 21:41:01 +0000 (14:41 -0700)
src/mesa/pipe/xlib/xm_api.c

index ec889ca34fa675ebe7ec4d31fcbd65b7cdf72754..e456ea2fd4da61ccfa04df989f9e4c52936b90e7 100644 (file)
@@ -380,11 +380,21 @@ create_xmesa_buffer(XMesaDrawable d, BufferType type,
       _mesa_add_renderbuffer(fb, BUFFER_STENCIL, rb);
    }
    else {
-      if (vis->mesa_visual.depthBits > 0) {
+      if (vis->mesa_visual.depthBits > 24) {
          struct gl_renderbuffer *rb
          = st_new_renderbuffer_fb(GL_DEPTH_COMPONENT32);
          _mesa_add_renderbuffer(fb, BUFFER_DEPTH, rb);
       }
+      else if (vis->mesa_visual.depthBits > 16) {
+         struct gl_renderbuffer *rb
+         = st_new_renderbuffer_fb(GL_DEPTH24_STENCIL8_EXT);
+         _mesa_add_renderbuffer(fb, BUFFER_DEPTH, rb);
+      }
+      else if (vis->mesa_visual.depthBits > 1) {
+         struct gl_renderbuffer *rb
+         = st_new_renderbuffer_fb(GL_DEPTH_COMPONENT16);
+         _mesa_add_renderbuffer(fb, BUFFER_DEPTH, rb);
+      }
 
       if (vis->mesa_visual.stencilBits > 0) {
          struct gl_renderbuffer *rb