summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/fbobject.c4
-rw-r--r--src/mesa/main/formats.c12
-rw-r--r--src/mesa/main/formats.h4
-rw-r--r--src/mesa/main/framebuffer.c2
-rw-r--r--src/mesa/main/glformats.c2
-rw-r--r--src/mesa/main/texcompress_astc.cpp2
-rw-r--r--src/mesa/main/teximage.c8
7 files changed, 12 insertions, 22 deletions
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 09143d30af5..d95f2444f00 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -4282,8 +4282,8 @@ get_framebuffer_attachment_parameter(struct gl_context *ctx,
}
else {
if (ctx->Extensions.EXT_sRGB) {
- *params =
- _mesa_get_format_color_encoding(att->Renderbuffer->Format);
+ *params = (_mesa_is_format_srgb(att->Renderbuffer->Format) ?
+ GL_SRGB : GL_LINEAR);
}
else {
/* According to ARB_framebuffer_sRGB, we should return LINEAR
diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c
index 4a08d1a0158..fb1f47bd11b 100644
--- a/src/mesa/main/formats.c
+++ b/src/mesa/main/formats.c
@@ -590,19 +590,13 @@ _mesa_is_format_color_format(mesa_format format)
}
}
-
-/**
- * Return color encoding for given format.
- * \return GL_LINEAR or GL_SRGB
- */
-GLenum
-_mesa_get_format_color_encoding(mesa_format format)
+bool
+_mesa_is_format_srgb(mesa_format format)
{
const struct mesa_format_info *info = _mesa_get_format_info(format);
- return info->IsSRGBFormat ? GL_SRGB : GL_LINEAR;
+ return info->IsSRGBFormat;
}
-
/**
* Return TRUE if format is an ETC2 compressed format specified
* by GL_ARB_ES3_compatibility.
diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h
index 60d6b58ae33..abfd73313ef 100644
--- a/src/mesa/main/formats.h
+++ b/src/mesa/main/formats.h
@@ -736,8 +736,8 @@ _mesa_is_format_astc_2d(mesa_format format);
bool
_mesa_is_format_color_format(mesa_format format);
-extern GLenum
-_mesa_get_format_color_encoding(mesa_format format);
+bool
+_mesa_is_format_srgb(mesa_format format);
extern uint32_t
_mesa_format_image_size(mesa_format format, int width,
diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c
index 0abfdd83902..96efc0a4b54 100644
--- a/src/mesa/main/framebuffer.c
+++ b/src/mesa/main/framebuffer.c
@@ -458,7 +458,7 @@ _mesa_update_framebuffer_visual(struct gl_context *ctx,
fb->Visual.alphaBits = _mesa_get_format_bits(fmt, GL_ALPHA_BITS);
fb->Visual.rgbBits = fb->Visual.redBits
+ fb->Visual.greenBits + fb->Visual.blueBits;
- if (_mesa_get_format_color_encoding(fmt) == GL_SRGB)
+ if (_mesa_is_format_srgb(fmt))
fb->Visual.sRGBCapable = ctx->Extensions.EXT_sRGB;
break;
}
diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
index bd087848803..3e493cd5c2d 100644
--- a/src/mesa/main/glformats.c
+++ b/src/mesa/main/glformats.c
@@ -1373,7 +1373,7 @@ _mesa_is_compressed_format(const struct gl_context *ctx, GLenum format)
switch (_mesa_get_format_layout(m_format)) {
case MESA_FORMAT_LAYOUT_S3TC:
- if (_mesa_get_format_color_encoding(m_format) == GL_LINEAR) {
+ if (!_mesa_is_format_srgb(m_format)) {
return _mesa_has_EXT_texture_compression_s3tc(ctx);
} else {
return (_mesa_has_EXT_texture_sRGB(ctx) ||
diff --git a/src/mesa/main/texcompress_astc.cpp b/src/mesa/main/texcompress_astc.cpp
index 23540c47017..63676dfa64c 100644
--- a/src/mesa/main/texcompress_astc.cpp
+++ b/src/mesa/main/texcompress_astc.cpp
@@ -1830,7 +1830,7 @@ _mesa_unpack_astc_2d_ldr(uint8_t *dst_row,
mesa_format format)
{
assert(_mesa_is_format_astc_2d(format));
- bool srgb = _mesa_get_format_color_encoding(format) == GL_SRGB;
+ bool srgb = _mesa_is_format_srgb(format);
unsigned blk_w, blk_h;
_mesa_get_format_block_size(format, &blk_w, &blk_h);
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 253183da815..336a9592b56 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -2416,14 +2416,10 @@ copytexture_error_check( struct gl_context *ctx, GLuint dimensions,
}
if (_mesa_is_gles3(ctx)) {
- bool rb_is_srgb = false;
+ bool rb_is_srgb = (ctx->Extensions.EXT_sRGB &&
+ _mesa_is_format_srgb(rb->Format));
bool dst_is_srgb = false;
- if (ctx->Extensions.EXT_sRGB &&
- _mesa_get_format_color_encoding(rb->Format) == GL_SRGB) {
- rb_is_srgb = true;
- }
-
if (_mesa_get_linear_internalformat(internalFormat) != internalFormat) {
dst_is_srgb = true;
}