summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2010-03-04 10:50:26 -0700
committerBrian Paul <[email protected]>2010-03-04 10:53:27 -0700
commit516bad2272aa9bb3c85516e0023ddd2ed236dcef (patch)
tree74ec872cad6dfe5fe976d5bbb0941dff90a42355
parent6464d81e779e8c05ef96c9e5dab4422ff1f25464 (diff)
gallivm: added lp_build_fract()
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_arit.c13
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_arit.h4
2 files changed, 17 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.c b/src/gallium/auxiliary/gallivm/lp_bld_arit.c
index 42ae9f6a22c..32f9e5201c5 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_arit.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.c
@@ -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.
*/
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.h b/src/gallium/auxiliary/gallivm/lp_bld_arit.h
index 866349d8cba..55385e3a66a 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_arit.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.h
@@ -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