Mesa (master): gallivm: fix sampling for s3tc srgb formats when using texture cache

Roland Scheidegger sroland at kemper.freedesktop.org
Wed Nov 4 13:22:18 UTC 2015


Module: Mesa
Branch: master
Commit: c19443bc8b68ef4697ead1998286e42bd4d8a572
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=c19443bc8b68ef4697ead1998286e42bd4d8a572

Author: Roland Scheidegger <sroland at vmware.com>
Date:   Wed Nov  4 14:21:43 2015 +0100

gallivm: fix sampling for s3tc srgb formats when using texture cache

This actually stored the values as 8bit linear values in the cache,
then did another srgb->linear conversion...
We don't want to do the former (decoding 8bit srgb values to 8bit linear
completely defeats the purpose of srgb in the first place), so just decode
to 8bit srgb.
Fixes piglit.spec.ext_texture_srgb.texwrap formats-s3tc tests.

---

 src/gallium/auxiliary/gallivm/lp_bld_format_soa.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_format_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_format_soa.c
index 42aef83..8bae94a 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_format_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_format_soa.c
@@ -492,9 +492,11 @@ lp_build_fetch_rgba_soa(struct gallivm_state *gallivm,
        (type.length == 1 || (type.length % 4 == 0)) &&
        cache) {
       const struct util_format_description *format_decompressed;
+      const struct util_format_description *flinear_desc;
       LLVMValueRef packed;
+      flinear_desc = util_format_description(util_format_linear(format_desc->format));
       packed = lp_build_fetch_cached_texels(gallivm,
-                                            format_desc,
+                                            flinear_desc,
                                             type.length,
                                             base_ptr,
                                             offset,




More information about the mesa-commit mailing list