Browse Source

gallivm: constant building for scalar zero

tags/mesa-7.9-rc1
Brian Paul 16 years ago
parent
commit
22bb7ffd04
1 changed files with 10 additions and 2 deletions
  1. 10
    2
      src/gallium/auxiliary/gallivm/lp_bld_const.c

+ 10
- 2
src/gallium/auxiliary/gallivm/lp_bld_const.c View File

@@ -221,8 +221,16 @@ lp_build_undef(struct lp_type type)
LLVMValueRef
lp_build_zero(struct lp_type type)
{
LLVMTypeRef vec_type = lp_build_vec_type(type);
return LLVMConstNull(vec_type);
if (type.length == 1) {
if (type.floating)
return LLVMConstReal(LLVMFloatType(), 0.0);
else
return LLVMConstInt(LLVMIntType(type.width), 0, 0);
}
else {
LLVMTypeRef vec_type = lp_build_vec_type(type);
return LLVMConstNull(vec_type);
}
}


Loading…
Cancel
Save