summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/gallivm/lp_bld_arit.c
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2010-03-04 10:50:26 -0700
committerBrian Paul <brianp@vmware.com>2010-03-04 10:53:27 -0700
commit516bad2272aa9bb3c85516e0023ddd2ed236dcef (patch)
tree74ec872cad6dfe5fe976d5bbb0941dff90a42355 /src/gallium/auxiliary/gallivm/lp_bld_arit.c
parent6464d81e779e8c05ef96c9e5dab4422ff1f25464 (diff)
gallivm: added lp_build_fract()
Diffstat (limited to 'src/gallium/auxiliary/gallivm/lp_bld_arit.c')
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_arit.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.c b/src/gallium/auxiliary/gallivm/lp_bld_arit.c
index 42ae9f6a22..32f9e5201c 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.
*/