From 4554cdc289f1d97855825127c0bf8c0e7f6a2eda Mon Sep 17 00:00:00 2001
From: José Fonseca <jfonseca@vmware.com>
Date: Tue, 4 May 2010 13:31:50 +0100
Subject: gallivm: Fix several glitches introduced in the prev commit.

---
 src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 4 ++--
 src/gallium/auxiliary/gallivm/lp_bld_tgsi.h       | 3 ---
 src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c   | 6 +++++-
 3 files changed, 7 insertions(+), 6 deletions(-)

(limited to 'src')

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
index 5927923271..d1592c22f4 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
@@ -954,12 +954,12 @@ lp_build_lod_selector(struct lp_build_sample_context *bld,
       dsdy = LLVMBuildExtractElement(bld->builder, ddy[0], index0, "dsdy");
       dsdy = lp_build_abs(float_bld, dsdy);
       if (dims > 1) {
-         dtdx = LLVMBuildExtractElement(bld->builder, ddx[1], index0, "dsdx");
+         dtdx = LLVMBuildExtractElement(bld->builder, ddx[1], index0, "dtdx");
          dtdx = lp_build_abs(float_bld, dtdx);
          dtdy = LLVMBuildExtractElement(bld->builder, ddy[1], index0, "dtdy");
          dtdy = lp_build_abs(float_bld, dtdy);
          if (dims > 2) {
-            drdx = LLVMBuildExtractElement(bld->builder, ddx[2], index0, "dsdx");
+            drdx = LLVMBuildExtractElement(bld->builder, ddx[2], index0, "drdx");
             drdx = lp_build_abs(float_bld, drdx);
             drdy = LLVMBuildExtractElement(bld->builder, ddy[2], index0, "drdy");
             drdy = lp_build_abs(float_bld, drdy);
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
index 4ca730a98a..71c51db786 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
@@ -45,9 +45,6 @@ struct lp_build_context;
 struct lp_build_mask_context;
 
 
-#define LP_BLD_SAMPLER_EXPLICIT_DERIVATIVES 1
-
-
 /**
  * Sampler code generation interface.
  *
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
index 6659cff870..022223bb29 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
@@ -644,7 +644,7 @@ emit_tex( struct lp_build_tgsi_soa_context *bld,
    }
 
    /* FIXME: Treat TEX_MODIFIER_EXPLICIT_LOD correctly */
-   if (modifier == TEX_MODIFIER_LOD_BIAS || TEX_MODIFIER_EXPLICIT_LOD)
+   if (modifier == TEX_MODIFIER_LOD_BIAS || modifier == TEX_MODIFIER_EXPLICIT_LOD)
       lodbias = emit_fetch( bld, inst, 0, 3 );
    else
       lodbias = bld->base.zero;
@@ -676,6 +676,10 @@ emit_tex( struct lp_build_tgsi_soa_context *bld,
       }
       unit = inst->Src[1].Register.Index;
    }
+   for (i = num_coords; i < 3; i++) {
+      ddx[i] = bld->base.undef;
+      ddy[i] = bld->base.undef;
+   }
 
    bld->sampler->emit_fetch_texel(bld->sampler,
                                   bld->base.builder,
-- 
cgit v1.2.3