OSDN Git Service

gallivm: added lp_build_fract()
authorBrian Paul <brianp@vmware.com>
Thu, 4 Mar 2010 17:50:26 +0000 (10:50 -0700)
committerBrian Paul <brianp@vmware.com>
Thu, 4 Mar 2010 17:53:27 +0000 (10:53 -0700)
src/gallium/auxiliary/gallivm/lp_bld_arit.c
src/gallium/auxiliary/gallivm/lp_bld_arit.h

index 42ae9f6..32f9e52 100644 (file)
@@ -900,6 +900,19 @@ lp_build_ceil(struct lp_build_context *bld,
 
 
 /**
+ * Return fractional part of 'a' computed as a - floor(f)
+ * Typically used in texture coord arithmetic.
+ */
+LLVMValueRef
+lp_build_fract(struct lp_build_context *bld,
+               LLVMValueRef a)
+{
+   assert(bld->type.floating);
+   return lp_build_sub(bld, a, lp_build_floor(bld, a));
+}
+
+
+/**
  * Convert to integer, through whichever rounding method that's fastest,
  * typically truncating toward zero.
  */
index 866349d..55385e3 100644 (file)
@@ -149,6 +149,10 @@ lp_build_trunc(struct lp_build_context *bld,
                LLVMValueRef a);
 
 LLVMValueRef
+lp_build_fract(struct lp_build_context *bld,
+               LLVMValueRef a);
+
+LLVMValueRef
 lp_build_ifloor(struct lp_build_context *bld,
                 LLVMValueRef a);
 LLVMValueRef