Fixes a segfault when clearing a non-existent stencil buffer.
---
 src/mesa/state_tracker/st_manager.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/mesa/state_tracker/st_manager.c 
b/src/mesa/state_tracker/st_manager.c
index ca3a29c..cac62e4 100644
--- a/src/mesa/state_tracker/st_manager.c
+++ b/src/mesa/state_tracker/st_manager.c
@@ -333,15 +333,15 @@ st_visual_to_context_mode(const struct st_visual *visual,
    }
 
    if (visual->depth_stencil_format != PIPE_FORMAT_NONE) {
-      mode->haveDepthBuffer = GL_TRUE;
-      mode->haveStencilBuffer = GL_TRUE;
-
       mode->depthBits =
          util_format_get_component_bits(visual->depth_stencil_format,
                UTIL_FORMAT_COLORSPACE_ZS, 0);
       mode->stencilBits =
          util_format_get_component_bits(visual->depth_stencil_format,
                UTIL_FORMAT_COLORSPACE_ZS, 1);
+
+      mode->haveDepthBuffer = mode->depthBits > 0;
+      mode->haveStencilBuffer = mode->stencilBits > 0;
    }
 
    if (visual->accum_format != PIPE_FORMAT_NONE) {
-- 
1.7.0.1.147.g6d84b


------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Mesa3d-dev mailing list
Mesa3d-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to