summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/formats.c
diff options
context:
space:
mode:
authorNanley Chery <nanley.g.chery@intel.com>2015-05-19 09:58:17 -0700
committerNanley Chery <nanley.g.chery@intel.com>2015-08-24 16:08:01 -0700
commit8f378d1083179ea9e760688582faf95aea880b94 (patch)
tree2165a32169788cb3e3fc66527ab11f3c218d0716 /src/mesa/main/formats.c
parent4f2cdd849738019ce9552ee1d5f8dafce8af3f10 (diff)
downloadexternal_mesa3d-8f378d1083179ea9e760688582faf95aea880b94.zip
external_mesa3d-8f378d1083179ea9e760688582faf95aea880b94.tar.gz
external_mesa3d-8f378d1083179ea9e760688582faf95aea880b94.tar.bz2
mesa/formats: store whether or not a format is sRGB in gl_format_info
v2: remove extra newline. v3: use bool instead of GLboolean. Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com> Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Diffstat (limited to 'src/mesa/main/formats.c')
-rw-r--r--src/mesa/main/formats.c28
1 files changed, 4 insertions, 24 deletions
diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c
index 673c6b9..5e1d9a6 100644
--- a/src/mesa/main/formats.c
+++ b/src/mesa/main/formats.c
@@ -65,6 +65,8 @@ struct gl_format_info
GLubyte DepthBits;
GLubyte StencilBits;
+ bool IsSRGBFormat;
+
/**
* To describe compressed formats. If not compressed, Width=Height=1.
*/
@@ -568,30 +570,8 @@ _mesa_is_format_color_format(mesa_format format)
GLenum
_mesa_get_format_color_encoding(mesa_format format)
{
- /* XXX this info should be encoded in gl_format_info */
- switch (format) {
- case MESA_FORMAT_BGR_SRGB8:
- case MESA_FORMAT_A8B8G8R8_SRGB:
- case MESA_FORMAT_B8G8R8A8_SRGB:
- case MESA_FORMAT_A8R8G8B8_SRGB:
- case MESA_FORMAT_R8G8B8A8_SRGB:
- case MESA_FORMAT_L_SRGB8:
- case MESA_FORMAT_L8A8_SRGB:
- case MESA_FORMAT_A8L8_SRGB:
- case MESA_FORMAT_SRGB_DXT1:
- case MESA_FORMAT_SRGBA_DXT1:
- case MESA_FORMAT_SRGBA_DXT3:
- case MESA_FORMAT_SRGBA_DXT5:
- case MESA_FORMAT_R8G8B8X8_SRGB:
- case MESA_FORMAT_ETC2_SRGB8:
- case MESA_FORMAT_ETC2_SRGB8_ALPHA8_EAC:
- case MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1:
- case MESA_FORMAT_B8G8R8X8_SRGB:
- case MESA_FORMAT_BPTC_SRGB_ALPHA_UNORM:
- return GL_SRGB;
- default:
- return GL_LINEAR;
- }
+ const struct gl_format_info *info = _mesa_get_format_info(format);
+ return info->IsSRGBFormat ? GL_SRGB : GL_LINEAR;
}