gallium: depth textures have usage depth_stencil instead of render_target

This commit is contained in:
Roland Scheidegger
2008-05-09 15:04:33 +02:00
parent 5ee2b5bdcc
commit a1f95a8bf6
3 changed files with 17 additions and 11 deletions
-6
View File
@@ -77,12 +77,6 @@ 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()
* This is called to allocate the original drawing surface, and
+12 -5
View File
@@ -272,6 +272,7 @@ guess_and_alloc_texture(struct st_context *st,
GLuint height = stImage->base.Height2;
GLuint depth = stImage->base.Depth2;
GLuint i, comp_byte = 0;
enum pipe_format fmt;
DBG("%s\n", __FUNCTION__);
@@ -331,15 +332,18 @@ guess_and_alloc_texture(struct st_context *st,
if (stImage->base.IsCompressed)
comp_byte = compressed_num_bytes(stImage->base.TexFormat->MesaFormat);
fmt = st_mesa_format_to_pipe_format(stImage->base.TexFormat->MesaFormat);
stObj->pt = st_texture_create(st,
gl_target_to_pipe(stObj->base.Target),
st_mesa_format_to_pipe_format(stImage->base.TexFormat->MesaFormat),
fmt,
lastLevel,
width,
height,
depth,
comp_byte,
( PIPE_TEXTURE_USAGE_RENDER_TARGET |
( (pf_is_depth_stencil(fmt) ?
PIPE_TEXTURE_USAGE_DEPTH_STENCIL :
PIPE_TEXTURE_USAGE_RENDER_TARGET) |
PIPE_TEXTURE_USAGE_SAMPLER ));
DBG("%s - success\n", __FUNCTION__);
@@ -1510,16 +1514,19 @@ st_finalize_texture(GLcontext *ctx,
/* May need to create a new gallium texture:
*/
if (!stObj->pt) {
const enum pipe_format fmt =
st_mesa_format_to_pipe_format(firstImage->base.TexFormat->MesaFormat);
stObj->pt = st_texture_create(ctx->st,
gl_target_to_pipe(stObj->base.Target),
st_mesa_format_to_pipe_format(firstImage->base.TexFormat->MesaFormat),
fmt,
stObj->lastLevel,
firstImage->base.Width2,
firstImage->base.Height2,
firstImage->base.Depth2,
comp_byte,
( PIPE_TEXTURE_USAGE_RENDER_TARGET |
( (pf_is_depth_stencil(fmt) ?
PIPE_TEXTURE_USAGE_DEPTH_STENCIL :
PIPE_TEXTURE_USAGE_RENDER_TARGET) |
PIPE_TEXTURE_USAGE_SAMPLER ));
if (!stObj->pt) {
+5
View File
@@ -93,6 +93,11 @@ st_get_stobj_texture(struct st_texture_object *stObj)
return stObj ? stObj->pt : NULL;
}
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;
}
extern struct pipe_texture *