summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/llvmpipe/lp_bld_const.c
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2009-08-21 07:34:15 +0100
committerJosé Fonseca <[email protected]>2009-08-29 09:21:37 +0100
commit33ce51bc0d52dcfbfa481211dd1fe73a5ecb948f (patch)
tree265dc567e34ee4336481b39a1fd8d438464be41c /src/gallium/drivers/llvmpipe/lp_bld_const.c
parentd07b0383660cd318ba43abad11bb80de4a124951 (diff)
llvmpipe: Several fixes of the conversion test.
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_bld_const.c')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_bld_const.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_const.c b/src/gallium/drivers/llvmpipe/lp_bld_const.c
index 20f0d3c40bb..991cf24a9ea 100644
--- a/src/gallium/drivers/llvmpipe/lp_bld_const.c
+++ b/src/gallium/drivers/llvmpipe/lp_bld_const.c
@@ -33,6 +33,7 @@
* @author Jose Fonseca <[email protected]>
*/
+#include <float.h>
#include "util/u_debug.h"
@@ -92,6 +93,27 @@ lp_const_scale(union lp_type type)
}
+double
+lp_const_eps(union lp_type type)
+{
+ if (type.floating) {
+ switch(type.width) {
+ case 32:
+ return FLT_EPSILON;
+ case 64:
+ return DBL_EPSILON;
+ default:
+ assert(0);
+ return 0.0;
+ }
+ }
+ else {
+ double scale = lp_const_scale(type);
+ return 1.0/scale;
+ }
+}
+
+
LLVMValueRef
lp_build_undef(union lp_type type)
{