From b2021e7c06a9ec13b82eeeb352ad2408fe060518 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 2 May 2008 17:56:01 +0100 Subject: gallium: identify depth-stencil textures And don't use the display-target path to allocate them. --- src/mesa/state_tracker/st_cb_fbo.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/mesa') 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: */ -- cgit v1.2.3