Move pf_is_depth_stencil() to u_format auxiliary module.

This commit is contained in:
Michal Krol 2009-12-03 10:12:47 +01:00
parent 3400b668e3
commit d28740c298
6 changed files with 19 additions and 18 deletions

View file

@ -128,6 +128,19 @@ util_format_is_compressed(enum pipe_format format)
return desc->layout == UTIL_FORMAT_LAYOUT_DXT ? TRUE : FALSE;
}
static INLINE boolean
util_format_is_depth_or_stencil(enum pipe_format format)
{
const struct util_format_description *desc = util_format_description(format);
assert(format);
if (!format) {
return FALSE;
}
return desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS ? TRUE : FALSE;
}
/*
* Format access functions.

View file

@ -548,13 +548,6 @@ pf_get_2d_size(const struct pipe_format_block *block, size_t stride, unsigned he
return pf_get_nblocksy(block, height)*stride;
}
static INLINE boolean
pf_is_depth_or_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;
}
static INLINE boolean
pf_is_depth_and_stencil( enum pipe_format format )
{
@ -562,13 +555,6 @@ pf_is_depth_and_stencil( enum pipe_format format )
pf_get_component_bits( format, PIPE_FORMAT_COMP_S ) != 0);
}
/** DEPRECATED: For backwards compatibility */
static INLINE boolean
pf_is_depth_stencil( enum pipe_format format )
{
return pf_is_depth_or_stencil( format );
}
enum pipe_video_chroma_format
{
PIPE_VIDEO_CHROMA_FORMAT_420,

View file

@ -47,7 +47,7 @@ for name, value in globals().items():
formats[value] = name
def is_depth_stencil_format(format):
# FIXME: make and use binding to pf_is_depth_stencil
# FIXME: make and use binding to util_format_is_depth_or_stencil
return format in (
PIPE_FORMAT_Z32_UNORM,
PIPE_FORMAT_Z24S8_UNORM,

View file

@ -40,6 +40,7 @@
#include "pipe/p_state.h"
#include "pipe/p_inlines.h"
#include "util/u_format.h"
#include "util/u_rect.h"
/* Make all the #if cases in the code esier to read */
@ -92,7 +93,7 @@ dri2_do_create_buffer(DrawablePtr pDraw, DRI2BufferPtr buffer, unsigned int form
case 9:
#endif
if (exa_priv->depth_stencil_tex &&
!pf_is_depth_stencil(exa_priv->depth_stencil_tex->format))
!util_format_is_depth_or_stencil(exa_priv->depth_stencil_tex->format))
exa_priv->depth_stencil_tex = NULL;
/* Fall through */
case DRI2BufferDepth:

View file

@ -49,6 +49,7 @@
#include "st_public.h"
#include "st_texture.h"
#include "util/u_format.h"
#include "util/u_rect.h"
@ -133,7 +134,7 @@ st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
template.depth0 = 1;
template.last_level = 0;
template.nr_samples = rb->NumSamples;
if (pf_is_depth_stencil(format)) {
if (util_format_is_depth_or_stencil(format)) {
template.tex_usage = PIPE_TEXTURE_USAGE_DEPTH_STENCIL;
}
else {

View file

@ -205,7 +205,7 @@ static GLuint
default_usage(enum pipe_format fmt)
{
GLuint usage = PIPE_TEXTURE_USAGE_SAMPLER;
if (pf_is_depth_stencil(fmt))
if (util_format_is_depth_or_stencil(fmt))
usage |= PIPE_TEXTURE_USAGE_DEPTH_STENCIL;
else
usage |= PIPE_TEXTURE_USAGE_RENDER_TARGET;