summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2009-10-24 11:33:10 -0600
committerBrian Paul <[email protected]>2009-10-24 11:33:10 -0600
commit7b16c43e436715bef9118fdb28ca8a9ad91b1e66 (patch)
tree84d947d1f640610355dd6649bfb96e68df80b5a1 /src/mesa
parent51bc12d62338ad1874c437d692e1182c0bf3d4cd (diff)
mesa: added _mesa_get_format_block_size()
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/main/formats.c16
-rw-r--r--src/mesa/main/formats.h3
2 files changed, 19 insertions, 0 deletions
diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c
index 773a8f70b31..72d043c4c39 100644
--- a/src/mesa/main/formats.c
+++ b/src/mesa/main/formats.c
@@ -753,6 +753,22 @@ _mesa_get_format_base_format(gl_format format)
}
+/**
+ * Return the block size (in pixels) for the given format. Normally
+ * the block size is 1x1. But compressed formats will have block sizes
+ * of 4x4 or 8x4 pixels, etc.
+ * \param bw returns block width in pixels
+ * \param bh returns block height in pixels
+ */
+void
+_mesa_get_format_block_size(gl_format format, GLuint *bw, GLuint *bh)
+{
+ const struct gl_format_info *info = _mesa_get_format_info(format);
+ *bw = info->BlockWidth;
+ *bh = info->BlockHeight;
+}
+
+
/** Is the given format a compressed format? */
GLboolean
_mesa_is_format_compressed(gl_format format)
diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h
index 72f1b1e2874..91ea023077f 100644
--- a/src/mesa/main/formats.h
+++ b/src/mesa/main/formats.h
@@ -155,6 +155,9 @@ _mesa_get_format_datatype(gl_format format);
extern GLenum
_mesa_get_format_base_format(gl_format format);
+extern void
+_mesa_get_format_block_size(gl_format format, GLuint *bw, GLuint *bh);
+
extern GLboolean
_mesa_is_format_compressed(gl_format format);