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.
This commit is contained in:
parent
fff86eb0aa
commit
9f0e302cc7
|
@ -333,15 +333,15 @@ st_visual_to_context_mode(const struct st_visual *visual,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (visual->depth_stencil_format != PIPE_FORMAT_NONE) {
|
if (visual->depth_stencil_format != PIPE_FORMAT_NONE) {
|
||||||
mode->haveDepthBuffer = GL_TRUE;
|
|
||||||
mode->haveStencilBuffer = GL_TRUE;
|
|
||||||
|
|
||||||
mode->depthBits =
|
mode->depthBits =
|
||||||
util_format_get_component_bits(visual->depth_stencil_format,
|
util_format_get_component_bits(visual->depth_stencil_format,
|
||||||
UTIL_FORMAT_COLORSPACE_ZS, 0);
|
UTIL_FORMAT_COLORSPACE_ZS, 0);
|
||||||
mode->stencilBits =
|
mode->stencilBits =
|
||||||
util_format_get_component_bits(visual->depth_stencil_format,
|
util_format_get_component_bits(visual->depth_stencil_format,
|
||||||
UTIL_FORMAT_COLORSPACE_ZS, 1);
|
UTIL_FORMAT_COLORSPACE_ZS, 1);
|
||||||
|
|
||||||
|
mode->haveDepthBuffer = mode->depthBits > 0;
|
||||||
|
mode->haveStencilBuffer = mode->stencilBits > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (visual->accum_format != PIPE_FORMAT_NONE) {
|
if (visual->accum_format != PIPE_FORMAT_NONE) {
|
||||||
|
|
Loading…
Reference in New Issue