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>
This commit is contained in:
Jason Ekstrand 2014-08-26 14:26:44 -07:00 committed by Iago Toral Quiroga
parent 3c19251f28
commit f89793946a
2 changed files with 22 additions and 0 deletions

View File

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

View File

@ -625,6 +625,9 @@ _mesa_is_format_integer(mesa_format format);
extern bool
_mesa_is_format_etc2(mesa_format format);
GLenum
_mesa_is_format_color_format(mesa_format format);
extern GLenum
_mesa_get_format_color_encoding(mesa_format format);