summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/formats.c
diff options
context:
space:
mode:
authorJason Ekstrand <jason.ekstrand@intel.com>2014-08-26 14:26:44 -0700
committerIago Toral Quiroga <itoral@igalia.com>2015-01-12 11:20:28 +0100
commitf89793946af22b720f746a5fb8b33d7b2f3e199b (patch)
tree2d1ea566846572f2c0db404a53c350b4132f8115 /src/mesa/main/formats.c
parent3c19251f28e6b4feff81f48b1c73f1f2e09e38e1 (diff)
downloadexternal_mesa3d-f89793946af22b720f746a5fb8b33d7b2f3e199b.zip
external_mesa3d-f89793946af22b720f746a5fb8b33d7b2f3e199b.tar.gz
external_mesa3d-f89793946af22b720f746a5fb8b33d7b2f3e199b.tar.bz2
mesa: Add a _mesa_is_format_color_format helper
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com> Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Diffstat (limited to 'src/mesa/main/formats.c')
-rw-r--r--src/mesa/main/formats.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c
index b10b628..6eb80fb 100644
--- a/src/mesa/main/formats.c
+++ b/src/mesa/main/formats.c
@@ -472,6 +472,25 @@ _mesa_is_format_integer(mesa_format format)
return (info->DataType == GL_INT || info->DataType == GL_UNSIGNED_INT);
}
+
+/**
+ * Return true if the given format is a color format.
+ */
+GLenum
+_mesa_is_format_color_format(mesa_format format)
+{
+ const struct gl_format_info *info = _mesa_get_format_info(format);
+ switch (info->BaseFormat) {
+ case GL_DEPTH_COMPONENT:
+ case GL_STENCIL_INDEX:
+ case GL_DEPTH_STENCIL:
+ return false;
+ default:
+ return true;
+ }
+}
+
+
/**
* Return color encoding for given format.
* \return GL_LINEAR or GL_SRGB