diff options
author | Jordan Justen <[email protected]> | 2012-12-27 13:24:57 -0800 |
---|---|---|
committer | Jordan Justen <[email protected]> | 2013-01-04 17:26:00 -0800 |
commit | 8d99b2504532869967af34935ccb016a25bdd9c0 (patch) | |
tree | ef7af418669cd5e6096b4646fe1ec5bcc145774b | |
parent | 3613e67b4a80c5973c6bfdf08d796c41093e681d (diff) |
glformats: add functions to detect signed/unsigned integer types
Signed-off-by: Jordan Justen <[email protected]>
-rw-r--r-- | src/mesa/main/glformats.c | 54 | ||||
-rw-r--r-- | src/mesa/main/glformats.h | 6 |
2 files changed, 46 insertions, 14 deletions
diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c index d3ed8093e16..d2126bba6b0 100644 --- a/src/mesa/main/glformats.c +++ b/src/mesa/main/glformats.c @@ -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; @@ -426,6 +441,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. */ GLboolean diff --git a/src/mesa/main/glformats.h b/src/mesa/main/glformats.h index ccfb5e13ca4..d1208ef4ffe 100644 --- a/src/mesa/main/glformats.h +++ b/src/mesa/main/glformats.h @@ -62,6 +62,12 @@ 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); extern GLboolean |