Commit 6d63b6e5 authored by Jordan Justen's avatar Jordan Justen

glformats: add functions to detect signed/unsigned integer types

Signed-off-by: default avatarJordan Justen <jordan.l.justen@intel.com>
Reviewed-by: default avatarIan Romanick <ian.d.romanick@intel.com>
parent 2ace406b
......@@ -353,21 +353,9 @@ _mesa_bytes_per_vertex_attrib(GLint comps, GLenum type)
* Test if the given format is an integer (non-normalized) format.
*/
GLboolean
_mesa_is_enum_format_integer(GLenum format)
_mesa_is_enum_format_unsigned_int(GLenum format)
{
switch (format) {
/* generic integer formats */
case GL_RED_INTEGER_EXT:
case GL_GREEN_INTEGER_EXT:
case GL_BLUE_INTEGER_EXT:
case GL_ALPHA_INTEGER_EXT:
case GL_RGB_INTEGER_EXT:
case GL_RGBA_INTEGER_EXT:
case GL_BGR_INTEGER_EXT:
case GL_BGRA_INTEGER_EXT:
case GL_LUMINANCE_INTEGER_EXT:
case GL_LUMINANCE_ALPHA_INTEGER_EXT:
case GL_RG_INTEGER:
/* specific integer formats */
case GL_RGBA32UI_EXT:
case GL_RGB32UI_EXT:
......@@ -393,6 +381,34 @@ _mesa_is_enum_format_integer(GLenum format)
case GL_INTENSITY8UI_EXT:
case GL_LUMINANCE8UI_EXT:
case GL_LUMINANCE_ALPHA8UI_EXT:
case GL_RGB10_A2UI:
return GL_TRUE;
default:
return GL_FALSE;
}
}
/**
* Test if the given format is an integer (non-normalized) format.
*/
GLboolean
_mesa_is_enum_format_signed_int(GLenum format)
{
switch (format) {
/* generic integer formats */
case GL_RED_INTEGER_EXT:
case GL_GREEN_INTEGER_EXT:
case GL_BLUE_INTEGER_EXT:
case GL_ALPHA_INTEGER_EXT:
case GL_RGB_INTEGER_EXT:
case GL_RGBA_INTEGER_EXT:
case GL_BGR_INTEGER_EXT:
case GL_BGRA_INTEGER_EXT:
case GL_LUMINANCE_INTEGER_EXT:
case GL_LUMINANCE_ALPHA_INTEGER_EXT:
case GL_RG_INTEGER:
/* specific integer formats */
case GL_RGBA32I_EXT:
case GL_RGB32I_EXT:
case GL_RG32I:
......@@ -417,7 +433,6 @@ _mesa_is_enum_format_integer(GLenum format)
case GL_INTENSITY8I_EXT:
case GL_LUMINANCE8I_EXT:
case GL_LUMINANCE_ALPHA8I_EXT:
case GL_RGB10_A2UI:
return GL_TRUE;
default:
return GL_FALSE;
......@@ -425,6 +440,17 @@ _mesa_is_enum_format_integer(GLenum format)
}
/**
* Test if the given format is an integer (non-normalized) format.
*/
GLboolean
_mesa_is_enum_format_integer(GLenum format)
{
return _mesa_is_enum_format_unsigned_int(format) ||
_mesa_is_enum_format_signed_int(format);
}
/**
* Test if the given type is an integer (non-normalized) format.
*/
......
......@@ -61,6 +61,12 @@ _mesa_is_type_unsigned(GLenum type);
extern GLboolean
_mesa_is_enum_format_integer(GLenum format);
extern GLboolean
_mesa_is_enum_format_unsigned_int(GLenum format);
extern GLboolean
_mesa_is_enum_format_signed_int(GLenum format);
extern GLboolean
_mesa_is_enum_format_or_type_integer(GLenum format, GLenum type);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment