summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/formats.c
diff options
context:
space:
mode:
authorAnuj Phogat <anuj.phogat@gmail.com>2016-03-09 11:38:54 -0800
committerAnuj Phogat <anuj.phogat@gmail.com>2016-05-03 03:43:17 -0700
commit9163c37349a2f4ddb3ebc2722f8a768e282884a0 (patch)
tree90ef8847860056eafc59061a2275162d8426a77b /src/mesa/main/formats.c
parent6abb1b4984bba5560baccd53e68237ab86822ec0 (diff)
downloadexternal_mesa3d-9163c37349a2f4ddb3ebc2722f8a768e282884a0.zip
external_mesa3d-9163c37349a2f4ddb3ebc2722f8a768e282884a0.tar.gz
external_mesa3d-9163c37349a2f4ddb3ebc2722f8a768e282884a0.tar.bz2
mesa: Add a helper function to query 3D block sizes
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com> Reviewed-by: Brian Paul <brianp@vmware.com>
Diffstat (limited to 'src/mesa/main/formats.c')
-rw-r--r--src/mesa/main/formats.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c
index 3d2349b..cfaac04 100644
--- a/src/mesa/main/formats.c
+++ b/src/mesa/main/formats.c
@@ -321,6 +321,27 @@ _mesa_get_format_block_size(mesa_format format, GLuint *bw, GLuint *bh)
/**
+ * Return the block size (in pixels) for the given format. Normally
+ * the block size is 1x1x1. But compressed formats will have block
+ * sizes of 4x4x4, 3x3x3 pixels, etc.
+ * \param bw returns block width in pixels
+ * \param bh returns block height in pixels
+ * \param bd returns block depth in pixels
+ */
+void
+_mesa_get_format_block_size_3d(mesa_format format,
+ GLuint *bw,
+ GLuint *bh,
+ GLuint *bd)
+{
+ const struct gl_format_info *info = _mesa_get_format_info(format);
+ *bw = info->BlockWidth;
+ *bh = info->BlockHeight;
+ *bd = info->BlockDepth;
+}
+
+
+/**
* Returns the an array of four numbers representing the transformation
* from the RGBA or SZ colorspace to the given format. For array formats,
* the i'th RGBA component is given by: