Merge commit 'origin/openvg-1.0'
[mesa.git] / src / gallium / include / pipe / p_format.h
index 3f65a60436453992984c41f097801464c40e5690..c4469d4a9e98a4fb3b604be7c3abe16160f9c02f 100644 (file)
@@ -536,6 +536,39 @@ pf_get_nblocks(const struct pipe_format_block *block, unsigned width, unsigned h
    return pf_get_nblocksx(block, width)*pf_get_nblocksy(block, height);
 }
 
+static INLINE size_t
+pf_get_stride(const struct pipe_format_block *block, unsigned width)
+{
+   return pf_get_nblocksx(block, width)*block->size;
+}
+
+static INLINE size_t
+pf_get_2d_size(const struct pipe_format_block *block, size_t stride, unsigned height)
+{
+   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 )
+{
+   return (pf_get_component_bits( format, PIPE_FORMAT_COMP_Z ) != 0 &&
+           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 );
+}
+
 static INLINE boolean 
 pf_is_compressed( enum pipe_format format )
 {