use combined depth/stencil buffer when possible
authorBrian <brian.paul@tungstengraphics.com>
Sat, 20 Oct 2007 21:19:14 +0000 (15:19 -0600)
committerBrian <brian.paul@tungstengraphics.com>
Sat, 20 Oct 2007 21:19:14 +0000 (15:19 -0600)
src/mesa/drivers/x11/xm_api.c

index ff83dab075237e26344858b8359fda07f6408ebf..187663e66ca1af3c004036170465411faf459d05 100644 (file)
@@ -430,16 +430,26 @@ create_xmesa_buffer(XMesaDrawable d, BufferType type,
       b->swAlpha = GL_FALSE;
    }
 
-   if (vis->mesa_visual.depthBits > 0) {
+   if (vis->mesa_visual.depthBits > 0 &&
+       vis->mesa_visual.stencilBits > 0) {
+      /* combined depth/stencil */
       struct gl_renderbuffer *rb
-         = st_new_renderbuffer_fb(GL_DEPTH_COMPONENT32);
+         = st_new_renderbuffer_fb(GL_DEPTH24_STENCIL8_EXT);
       _mesa_add_renderbuffer(&b->mesa_buffer, BUFFER_DEPTH, rb);
+      _mesa_add_renderbuffer(&b->mesa_buffer, BUFFER_STENCIL, rb);
    }
+   else {
+      if (vis->mesa_visual.depthBits > 0) {
+         struct gl_renderbuffer *rb
+         = st_new_renderbuffer_fb(GL_DEPTH_COMPONENT32);
+         _mesa_add_renderbuffer(&b->mesa_buffer, BUFFER_DEPTH, rb);
+      }
 
-   if (vis->mesa_visual.stencilBits > 0) {
-      struct gl_renderbuffer *rb
-         = st_new_renderbuffer_fb(GL_STENCIL_INDEX8_EXT);
-      _mesa_add_renderbuffer(&b->mesa_buffer, BUFFER_STENCIL, rb);
+      if (vis->mesa_visual.stencilBits > 0) {
+         struct gl_renderbuffer *rb
+            = st_new_renderbuffer_fb(GL_STENCIL_INDEX8_EXT);
+         _mesa_add_renderbuffer(&b->mesa_buffer, BUFFER_STENCIL, rb);
+      }
    }
 
    if (vis->mesa_visual.accumRedBits > 0) {