From: Kenneth Graunke Date: Wed, 12 Jun 2019 02:20:58 +0000 (-0700) Subject: st/mesa: Respect GL_TEXTURE_SRGB_DECODE_EXT in GenerateMipmaps() X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1d75f525891efd6483404da6b4ae70784179db9c;p=mesa.git st/mesa: Respect GL_TEXTURE_SRGB_DECODE_EXT in GenerateMipmaps() Apparently, we're supposed to look at the texture object's built-in sampler object's sRGB decode setting in order to decide whether to decode/downsample/re-encode, or simply downsample as-is. Previously, we had just respected the pipe_resource's format. Fixes SKQP's Skia_Unit_Tests.SRGBMipMaps test. (This ports commit 337a808062c756b474ee80a9ac04b5a3dbbeb67e from i965 to st/mesa for Gallium drivers.) Reviewed-by: Eric Anholt --- diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c index d6e9136384e..b71a8ee57bb 100644 --- a/src/mesa/state_tracker/st_gen_mipmap.c +++ b/src/mesa/state_tracker/st_gen_mipmap.c @@ -125,6 +125,9 @@ st_generate_mipmap(struct gl_context *ctx, GLenum target, else format = pt->format; + if (texObj->Sampler.sRGBDecode == GL_SKIP_DECODE_EXT) + format = util_format_linear(format); + /* First see if the driver supports hardware mipmap generation, * if not then generate the mipmap by rendering/texturing. * If that fails, use the software fallback.