[Mesa-dev] [PATCH] gallivm: fetch immediates to correct type

Dave Airlie airlied at gmail.com
Mon Feb 6 10:49:11 PST 2012


From: Dave Airlie <airlied at redhat.com>

Fetch float/uint/int immediates.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c |   30 ++++++++++++++++++----
 1 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
index 7503c48..ecb2a67 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
@@ -1419,14 +1419,32 @@ void lp_emit_immediate_soa(
    const uint size = imm->Immediate.NrTokens - 1;
    assert(size <= 4);
    assert(bld->num_immediates < LP_MAX_TGSI_IMMEDIATES);
+   switch (imm->Immediate.DataType) {
+   case TGSI_IMM_FLOAT32:
+      for( i = 0; i < size; ++i )
+         bld->immediates[bld->num_immediates][i] =
+            lp_build_const_vec(gallivm, bld_base->base.type, imm->u[i].Float);
+
+      for( i = size; i < 4; ++i )
+         bld->immediates[bld->num_immediates][i] = bld_base->base.undef;
+      break;
+   case TGSI_IMM_UINT32:
+      for( i = 0; i < size; ++i )
+         bld->immediates[bld->num_immediates][i] =
+            lp_build_const_vec(gallivm, bld_base->uintbld.type, imm->u[i].Uint);
 
-   for( i = 0; i < size; ++i )
-      bld->immediates[bld->num_immediates][i] =
-              lp_build_const_vec(gallivm, bld_base->base.type, imm->u[i].Float);
-
-   for( i = size; i < 4; ++i )
-      bld->immediates[bld->num_immediates][i] = bld_base->base.undef;
+      for( i = size; i < 4; ++i )
+         bld->immediates[bld->num_immediates][i] = bld_base->uintbld.undef;
+      break;
+   case TGSI_IMM_INT32:
+      for( i = 0; i < size; ++i )
+         bld->immediates[bld->num_immediates][i] =
+            lp_build_const_vec(gallivm, bld_base->intbld.type, imm->u[i].Int);
 
+      for( i = size; i < 4; ++i )
+         bld->immediates[bld->num_immediates][i] = bld_base->intbld.undef;
+      break;
+   }
    bld->num_immediates++;
 }
 
-- 
1.7.7.6



More information about the mesa-dev mailing list