summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2019-07-01 15:43:19 -0700
committerEric Anholt <[email protected]>2019-07-16 12:51:13 -0700
commit4d23157a8bf5da2f20ad477029fcf59d9df8557e (patch)
tree443ac4dfe62817446c49f5fb2b27c896246593f7 /src/mesa/main
parent35e2d31ba4218cd55085c97764741eaf2fa3a332 (diff)
mesa: Give _mesa_format_get_color_encoding a clearer name.
It only returned one of two values. Reviewed-by: Thomas Helland <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]>
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;
}