diff options
author | Luca Barbieri <[email protected]> | 2010-03-23 17:40:42 +0100 |
---|---|---|
committer | Luca Barbieri <[email protected]> | 2010-03-23 18:02:51 +0100 |
commit | 9f0e302cc792f21c6523a85c353e053f942cd035 (patch) | |
tree | e27b1640bdb260b9943c60c94155ce42dcafea63 | |
parent | fff86eb0aab506fdfe3e956587d453c52ab07730 (diff) |
st/mesa: make st_manager.c set have[Stencil|Depth]Buffer only if bits > 0
Fixes a segfault when clearing a non-existent stencil buffer.
-rw-r--r-- | 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 ca3a29cb2b8..cac62e4a14c 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) { |