summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker/st_manager.c
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2010-03-12 11:27:50 +0800
committerChia-I Wu <[email protected]>2010-03-12 11:30:46 +0800
commit543a29f1a16cc46c6d019d2cf2bd13a96b5a3f2f (patch)
tree8b6273725d82ceac3165a6a1bec99f4ce4b3f67f /src/mesa/state_tracker/st_manager.c
parent3475e88442c16fb2b50b903fe246b3ebe49da226 (diff)
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.
Diffstat (limited to 'src/mesa/state_tracker/st_manager.c')
-rw-r--r--src/mesa/state_tracker/st_manager.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c
index 6c3cde09683..f0dda4be6e9 100644
--- a/src/mesa/state_tracker/st_manager.c
+++ b/src/mesa/state_tracker/st_manager.c
@@ -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;
}