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

Author: Brian Paul <bri...@vmware.com>
Date:   Wed Mar 10 18:06:02 2010 -0700

gallivm: constant building for scalar zero

---

 src/gallium/auxiliary/gallivm/lp_bld_const.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_const.c 
b/src/gallium/auxiliary/gallivm/lp_bld_const.c
index 5344775..8a275fa 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_const.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_const.c
@@ -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);
+   }
 }
                
 

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to