From 35e2d31ba4218cd55085c97764741eaf2fa3a332 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 1 Jul 2019 15:38:56 -0700 Subject: [PATCH] mesa: Drop redundant checks for sRGB before sRGB to linear conversion. _mesa_get_srgb_format_linear() just returns the original format if it wasn't sRGB. Reviewed-by: Thomas Helland Reviewed-by: Kristian H. Kristensen --- src/mesa/drivers/dri/i965/brw_blorp.c | 6 +++--- src/mesa/swrast/s_texfetch.c | 4 +--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_blorp.c b/src/mesa/drivers/dri/i965/brw_blorp.c index c32e3d1f9c0..044b9d045e3 100644 --- a/src/mesa/drivers/dri/i965/brw_blorp.c +++ b/src/mesa/drivers/dri/i965/brw_blorp.c @@ -299,10 +299,10 @@ brw_blorp_blit_miptrees(struct brw_context *brw, dst_level, dst_layer, dst_x0, dst_y0, dst_x1, dst_y1, mirror_x, mirror_y); - if (!decode_srgb && _mesa_get_format_color_encoding(src_format) == GL_SRGB) + if (!decode_srgb) src_format = _mesa_get_srgb_format_linear(src_format); - if (!encode_srgb && _mesa_get_format_color_encoding(dst_format) == GL_SRGB) + if (!encode_srgb) dst_format = _mesa_get_srgb_format_linear(dst_format); /* When doing a multisample resolve of a GL_LUMINANCE32F or GL_INTENSITY32F @@ -1191,7 +1191,7 @@ do_single_blorp_clear(struct brw_context *brw, struct gl_framebuffer *fb, uint32_t x0, x1, y0, y1; mesa_format format = irb->Base.Base.Format; - if (!encode_srgb && _mesa_get_format_color_encoding(format) == GL_SRGB) + if (!encode_srgb) format = _mesa_get_srgb_format_linear(format); enum isl_format isl_format = brw->mesa_to_isl_render_format[format]; diff --git a/src/mesa/swrast/s_texfetch.c b/src/mesa/swrast/s_texfetch.c index ed8df7bab64..079df32f7cd 100644 --- a/src/mesa/swrast/s_texfetch.c +++ b/src/mesa/swrast/s_texfetch.c @@ -491,10 +491,8 @@ set_fetch_functions(const struct gl_sampler_object *samp, STATIC_ASSERT(ARRAY_SIZE(texfetch_funcs) == MESA_FORMAT_COUNT); - if (samp->sRGBDecode == GL_SKIP_DECODE_EXT && - _mesa_get_format_color_encoding(format) == GL_SRGB) { + if (samp->sRGBDecode == GL_SKIP_DECODE_EXT) format = _mesa_get_srgb_format_linear(format); - } assert(format < MESA_FORMAT_COUNT); -- 2.30.2