diff options
author | Dave Airlie <airlied@redhat.com> | 2012-02-06 18:48:17 +0000 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2012-02-17 17:39:02 +0000 |
commit | 7199b0b6811b3340cb5c531c8625220e964fa16c (patch) | |
tree | abfeabdfa32a63a51cdc3f323cdb93b8f421d7ec | |
parent | 117a0e91afa4fae55df88de48a058c9b881c6b14 (diff) | |
download | external_mesa3d-7199b0b6811b3340cb5c531c8625220e964fa16c.zip external_mesa3d-7199b0b6811b3340cb5c531c8625220e964fa16c.tar.gz external_mesa3d-7199b0b6811b3340cb5c531c8625220e964fa16c.tar.bz2 |
gallivm: fetch immediates to correct type (v2)
Fetch float/uint/int immediates.
v2: bitcast to uint/int to floats as per Jose's suggestions.
Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c index 0ae7790..9a12db7 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c @@ -1409,11 +1409,30 @@ 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 = 0; i < size; ++i ) - bld->immediates[bld->num_immediates][i] = - lp_build_const_vec(gallivm, bld_base->base.type, imm->u[i].Float); + break; + case TGSI_IMM_UINT32: + for( i = 0; i < size; ++i ) { + LLVMValueRef tmp = lp_build_const_vec(gallivm, bld_base->uint_bld.type, imm->u[i].Uint); + bld->immediates[bld->num_immediates][i] = + LLVMConstBitCast(tmp, bld_base->base.vec_type); + } + break; + case TGSI_IMM_INT32: + for( i = 0; i < size; ++i ) { + LLVMValueRef tmp = lp_build_const_vec(gallivm, bld_base->int_bld.type, imm->u[i].Int); + bld->immediates[bld->num_immediates][i] = + LLVMConstBitCast(tmp, bld_base->base.vec_type); + } + + break; + } for( i = size; i < 4; ++i ) bld->immediates[bld->num_immediates][i] = bld_base->base.undef; |