summaryrefslogtreecommitdiff
path: root/src/mesa/state_tracker/st_cb_fbo.c
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2008-05-02 17:56:01 +0100
committerKeith Whitwell <keith@tungstengraphics.com>2008-05-02 17:56:01 +0100
commitb2021e7c06a9ec13b82eeeb352ad2408fe060518 (patch)
tree67bf6e3c5075eefb813ac55e44f601b057707959 /src/mesa/state_tracker/st_cb_fbo.c
parent7849ccb2a7dba3b9d751acaac9dd9aec3abe3b59 (diff)
gallium: identify depth-stencil textures
And don't use the display-target path to allocate them.
Diffstat (limited to 'src/mesa/state_tracker/st_cb_fbo.c')
-rw-r--r--src/mesa/state_tracker/st_cb_fbo.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c
index 21d61e2163..cb5736f7c3 100644
--- a/src/mesa/state_tracker/st_cb_fbo.c
+++ b/src/mesa/state_tracker/st_cb_fbo.c
@@ -77,6 +77,11 @@ init_renderbuffer_bits(struct st_renderbuffer *strb,
return info.size;
}
+static INLINE GLboolean pf_is_depth_stencil( enum pipe_format format )
+{
+ return (pf_get_component_bits( format, PIPE_FORMAT_COMP_Z ) +
+ pf_get_component_bits( format, PIPE_FORMAT_COMP_S )) != 0;
+}
/**
* gl_renderbuffer::AllocStorage()
@@ -117,8 +122,15 @@ st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
template.height[0] = height;
template.depth[0] = 1;
template.last_level = 0;
- template.tex_usage = (PIPE_TEXTURE_USAGE_DISPLAY_TARGET |
- PIPE_TEXTURE_USAGE_RENDER_TARGET);
+
+ if (pf_is_depth_stencil(template.format)) {
+ template.tex_usage = PIPE_TEXTURE_USAGE_DEPTH_STENCIL;
+ }
+ else {
+ template.tex_usage = (PIPE_TEXTURE_USAGE_DISPLAY_TARGET |
+ PIPE_TEXTURE_USAGE_RENDER_TARGET);
+ }
+
/* Probably need dedicated flags for surface usage too:
*/