summaryrefslogtreecommitdiff
path: root/src/gallium/include/pipe/p_format.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/include/pipe/p_format.h')
-rw-r--r--src/gallium/include/pipe/p_format.h24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/gallium/include/pipe/p_format.h b/src/gallium/include/pipe/p_format.h
index a279eefef9..e31538c95f 100644
--- a/src/gallium/include/pipe/p_format.h
+++ b/src/gallium/include/pipe/p_format.h
@@ -536,14 +536,36 @@ 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_stencil( enum pipe_format format )
+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 */
+#define pf_is_depth_stencil pf_is_depth_or_stencil
+
+static INLINE boolean
pf_is_compressed( enum pipe_format format )
{
return pf_layout(format) == PIPE_FORMAT_LAYOUT_DXT ? TRUE : FALSE;