Returns max bits per channel for the given format. --- src/mesa/main/formats.c | 16 ++++++++++++++++ src/mesa/main/formats.h | 3 +++ 2 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c index 1f83a53..cca0014 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. diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h index e6b429d..9609343 100644 --- a/src/mesa/main/formats.h +++ b/src/mesa/main/formats.h @@ -290,6 +290,9 @@ _mesa_get_format_bytes(gl_format format); extern GLint _mesa_get_format_bits(gl_format format, GLenum pname); +extern GLuint +_mesa_get_format_max_bits(gl_format format); + extern GLenum _mesa_get_format_datatype(gl_format format); -- 1.7.3.4 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev