st/mesa: Check the format before adding depth/stencil buffers.

The format might have depth bits, stencil bits, or both.  Add the
renderbuffers as needed.
This commit is contained in:
Chia-I Wu
2010-03-12 11:27:50 +08:00
parent 3475e88442
commit 543a29f1a1
+9 -3
View File
@@ -270,9 +270,15 @@ st_framebuffer_add_renderbuffer(struct st_framebuffer *stfb,
if (!rb)
return FALSE;
_mesa_add_renderbuffer(&stfb->Base, idx, rb);
if (idx == BUFFER_DEPTH)
_mesa_add_renderbuffer(&stfb->Base, BUFFER_STENCIL, rb);
if (idx != BUFFER_DEPTH) {
_mesa_add_renderbuffer(&stfb->Base, idx, rb);
}
else {
if (util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_ZS, 0))
_mesa_add_renderbuffer(&stfb->Base, BUFFER_DEPTH, rb);
if (util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_ZS, 1))
_mesa_add_renderbuffer(&stfb->Base, BUFFER_STENCIL, rb);
}
return TRUE;
}