aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAnuj Phogat <[email protected]>2014-06-05 11:13:16 -0700
committerAnuj Phogat <[email protected]>2014-08-04 17:11:44 -0700
commite0fe00eeac75d8fdd378a1f7633d2efd1db0a7b0 (patch)
tree718992fad9afbc9f032f2ebdb84d07074405ea5b /src
parent2d362a6aee0a1acab08590f2ba0ce50743546209 (diff)
mesa: Add a helper function _mesa_is_enum_format_unsized()
Function is utilized by next patch in the series. V2: Add missing formats. Cc: <[email protected]> Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/glformats.c56
-rw-r--r--src/mesa/main/glformats.h3
2 files changed, 59 insertions, 0 deletions
diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
index a0c7170dd32..77eee4f22ea 100644
--- a/src/mesa/main/glformats.c
+++ b/src/mesa/main/glformats.c
@@ -354,6 +354,62 @@ _mesa_bytes_per_vertex_attrib(GLint comps, GLenum type)
}
/**
+ * Test if the given format is unsized.
+ */
+GLboolean
+_mesa_is_enum_format_unsized(GLenum format)
+{
+ switch (format) {
+ case GL_RGBA:
+ case GL_BGRA:
+ case GL_ABGR_EXT:
+ case GL_RGB:
+ case GL_BGR:
+ case GL_RG:
+ case GL_RED:
+ case GL_GREEN:
+ case GL_BLUE:
+ case GL_ALPHA:
+ case GL_INTENSITY:
+ case GL_LUMINANCE:
+ case GL_LUMINANCE_ALPHA:
+
+ case GL_SRGB:
+ case GL_SRGB_ALPHA:
+ case GL_SLUMINANCE:
+ case GL_SLUMINANCE_ALPHA:
+
+ case GL_RGBA_SNORM:
+ case GL_RGB_SNORM:
+ case GL_RG_SNORM:
+ case GL_RED_SNORM:
+ case GL_ALPHA_SNORM:
+ case GL_INTENSITY_SNORM:
+ case GL_LUMINANCE_SNORM:
+ case GL_LUMINANCE_ALPHA_SNORM:
+
+ case GL_RED_INTEGER:
+ case GL_GREEN_INTEGER:
+ case GL_BLUE_INTEGER:
+ case GL_ALPHA_INTEGER:
+ case GL_RGB_INTEGER:
+ case GL_RGBA_INTEGER:
+ case GL_BGR_INTEGER:
+ case GL_BGRA_INTEGER:
+ case GL_RG_INTEGER:
+ case GL_LUMINANCE_INTEGER_EXT:
+ case GL_LUMINANCE_ALPHA_INTEGER_EXT:
+
+ case GL_DEPTH_COMPONENT:
+ case GL_DEPTH_STENCIL:
+ case GL_STENCIL_INDEX:
+ return GL_TRUE;
+ default:
+ return GL_FALSE;
+ }
+}
+
+/**
* Test if the given format is a SNORM (signed-normalized) format.
*/
GLboolean
diff --git a/src/mesa/main/glformats.h b/src/mesa/main/glformats.h
index 76e9a2493d6..6c553aee821 100644
--- a/src/mesa/main/glformats.h
+++ b/src/mesa/main/glformats.h
@@ -57,6 +57,9 @@ extern GLboolean
_mesa_is_type_unsigned(GLenum type);
extern GLboolean
+_mesa_is_enum_format_unsized(GLenum format);
+
+extern GLboolean
_mesa_is_enum_format_snorm(GLenum format);
extern GLboolean