Mesa (master): gallivm: Re-add the kludge for lp_build_lerp of fixed point types.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Tue Dec 4 21:18:47 UTC 2012


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

Author: José Fonseca <jfonseca at vmware.com>
Date:   Tue Dec  4 21:16:13 2012 +0000

gallivm: Re-add the kludge for lp_build_lerp of fixed point types.

I removed it in commit 7d44d354bdba853e453ce3991396e2b0933468f4 but
texture sample code still relies on it.

Not sure how to this cleanly, so put it pack for now.

---

 src/gallium/auxiliary/gallivm/lp_bld_arit.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.c b/src/gallium/auxiliary/gallivm/lp_bld_arit.c
index 4c6fd9e..8b19ebd 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_arit.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.c
@@ -1000,8 +1000,12 @@ lp_build_lerp_simple(struct lp_build_context *bld,
 
    res = lp_build_add(bld, v0, res);
 
-   if (normalized && !bld->type.sign) {
+   if ((normalized && !bld->type.sign) || bld->type.fixed) {
       /* We need to mask out the high order bits when lerping 8bit normalized colors stored on 16bits */
+      /* XXX: This step is necessary for lerping 8bit colors stored on 16bits,
+       * but it will be wrong for true fixed point use cases. Basically we need
+       * a more powerful lp_type, capable of further distinguishing the values
+       * interpretation from the value storage. */
       res = LLVMBuildAnd(builder, res, lp_build_const_int_vec(bld->gallivm, bld->type, (1 << half_width) - 1), "");
    }
 




More information about the mesa-commit mailing list