summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/formats.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2011-12-24 08:54:25 -0700
committerBrian Paul <[email protected]>2011-12-24 08:54:25 -0700
commit488d7fc67d36bc0e5247f5d011e8ad4c2dceb5a7 (patch)
tree2db7a002401f69c74822e0efab67bce7875ac76e /src/mesa/main/formats.c
parentfd104a84591ae854c5d6adc81e2dc31ef6ab9e8a (diff)
mesa: add _mesa_get_format_max_bits()
Returns max bits per channel for the given format. Reviewed-by: José Fonseca <[email protected]>
Diffstat (limited to 'src/mesa/main/formats.c')
-rw-r--r--src/mesa/main/formats.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c
index 1f83a5368d7..cca0014b178 100644
--- a/src/mesa/main/formats.c
+++ b/src/mesa/main/formats.c
@@ -27,6 +27,7 @@
#include "imports.h"
#include "formats.h"
#include "mfeatures.h"
+#include "macros.h"
/**
@@ -1613,6 +1614,21 @@ _mesa_get_format_bits(gl_format format, GLenum pname)
}
+GLuint
+_mesa_get_format_max_bits(gl_format format)
+{
+ const struct gl_format_info *info = _mesa_get_format_info(format);
+ GLuint max = MAX2(info->RedBits, info->GreenBits);
+ max = MAX2(max, info->BlueBits);
+ max = MAX2(max, info->AlphaBits);
+ max = MAX2(max, info->LuminanceBits);
+ max = MAX2(max, info->IntensityBits);
+ max = MAX2(max, info->DepthBits);
+ max = MAX2(max, info->StencilBits);
+ return max;
+}
+
+
/**
* Return the data type (or more specifically, the data representation)
* for the given format.