<div dir="ltr">This just occurred to me, but why are we generating mipmaps in meta?  We could do it in blorp in a half-dozen lines...<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Aug 12, 2016 at 3:59 PM, Kenneth Graunke <span dir="ltr"><<a href="mailto:kenneth@whitecape.org" target="_blank">kenneth@whitecape.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">When generating mipmaps for sRGB textures, force both decode and encode,<br>
so the filtering is done in linear colorspace, regardless of settings.<br>
<br>
Fixes a WebGL conformance test in Chrome:<br>
<a href="https://www.khronos.org/registry/webgl/sdk/tests/conformance2/textures/misc/tex-srgb-mipmap.html?webglVersion=2" rel="noreferrer" target="_blank">https://www.khronos.org/<wbr>registry/webgl/sdk/tests/<wbr>conformance2/textures/misc/<wbr>tex-srgb-mipmap.html?<wbr>webglVersion=2</a><br>
<br>
Signed-off-by: Kenneth Graunke <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>><br>
---<br>
 src/mesa/drivers/common/meta_<wbr>generate_mipmap.c | 12 ++++++++++--<br>
 1 file changed, 10 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/src/mesa/drivers/common/<wbr>meta_generate_mipmap.c b/src/mesa/drivers/common/<wbr>meta_generate_mipmap.c<br>
index 9cebbf7..bbe9d6d 100644<br>
--- a/src/mesa/drivers/common/<wbr>meta_generate_mipmap.c<br>
+++ b/src/mesa/drivers/common/<wbr>meta_generate_mipmap.c<br>
@@ -221,9 +221,17 @@ _mesa_meta_GenerateMipmap(<wbr>struct gl_context *ctx, GLenum target,<br>
                                 GL_LINEAR);<br>
       _mesa_set_sampler_wrap(ctx, mipmap->samp_obj, GL_CLAMP_TO_EDGE,<br>
                              GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE);<br>
+   }<br>
+<br>
+   if (ctx->Extensions.EXT_texture_<wbr>sRGB_decode) {<br>
+      const struct gl_texture_image *baseImage =<br>
+         _mesa_select_tex_image(texObj, target, texObj->BaseLevel);<br>
+      const bool srgb =<br>
+         _mesa_get_format_color_<wbr>encoding(baseImage->TexFormat) == GL_SRGB;<br>
<br>
-      /* We don't want to encode or decode sRGB values; treat them as linear. */<br>
-      _mesa_set_sampler_srgb_decode(<wbr>ctx, mipmap->samp_obj, GL_SKIP_DECODE_EXT);<br>
+      _mesa_set_sampler_srgb_decode(<wbr>ctx, mipmap->samp_obj,<br>
+                                    srgb ? GL_DECODE_EXT : GL_SKIP_DECODE_EXT);<br>
+      _mesa_set_framebuffer_srgb(<wbr>ctx, srgb);<br>
    }<br>
<br>
    _mesa_bind_sampler(ctx, ctx->Texture.CurrentUnit, mipmap->samp_obj);<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.9.2<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div>