mesa: add _mesa_get_format_max_bits()

Returns max bits per channel for the given format.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
This commit is contained in:
Brian Paul 2011-12-24 08:54:25 -07:00
parent fd104a8459
commit 488d7fc67d
2 changed files with 19 additions and 0 deletions

View file

@ -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.

View file

@ -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);