summaryrefslogtreecommitdiffstats
path: root/src/gallium/include
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2009-06-10 15:31:12 +0100
committerJosé Fonseca <[email protected]>2009-06-10 15:31:12 +0100
commit8bfbb7ec8b978d4b56ad6be7dca0290a96e91e6a (patch)
tree7da0e18291b9cf5561a90762eb57ae44a685a399 /src/gallium/include
parent76a1017e978f8e51114d765c8c98ff25da13042b (diff)
gallium: Shorthand functions for computing stride and sizes for a rect.
Diffstat (limited to 'src/gallium/include')
-rw-r--r--src/gallium/include/pipe/p_format.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/gallium/include/pipe/p_format.h b/src/gallium/include/pipe/p_format.h
index a279eefef9e..187377f92ae 100644
--- a/src/gallium/include/pipe/p_format.h
+++ b/src/gallium/include/pipe/p_format.h
@@ -536,6 +536,18 @@ 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 )
{