aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-09-19 08:37:00 +0200
committermarha <marha@users.sourceforge.net>2013-09-19 08:37:00 +0200
commit1531508ab9f3e354128ce17889784b703e99a480 (patch)
treee5948d468cf71b3ce08a824dd0c01f26efd4789a /mesalib/src
parentd7abd621605ffd1af1a5594f8c10780689eebaea (diff)
downloadvcxsrv-1531508ab9f3e354128ce17889784b703e99a480.tar.gz
vcxsrv-1531508ab9f3e354128ce17889784b703e99a480.tar.bz2
vcxsrv-1531508ab9f3e354128ce17889784b703e99a480.zip
Implemented unknown functions in visual studio
Diffstat (limited to 'mesalib/src')
-rw-r--r--mesalib/src/glsl/ir_constant_expression.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/mesalib/src/glsl/ir_constant_expression.cpp b/mesalib/src/glsl/ir_constant_expression.cpp
index 4579ef209..3e30510a6 100644
--- a/mesalib/src/glsl/ir_constant_expression.cpp
+++ b/mesalib/src/glsl/ir_constant_expression.cpp
@@ -40,6 +40,21 @@
#include "glsl_types.h"
#include "program/hash_table.h"
+#ifdef _MSC_VER
+#include <limits>
+
+inline bool isnormal(float x)
+{
+ if(x < 0) x = -x;
+ return x >= (std::numeric_limits<float>::min)()
+ && x <= (std::numeric_limits<float>::max)();
+}
+inline float copysign(const float& x, const float& y)
+{
+ return fabs(x) * ((y<0) ? -1 : 1);
+}
+#endif
+
static float
dot(ir_constant *op0, ir_constant *op1)
{
@@ -1382,7 +1397,7 @@ ir_expression::constant_expression_value(struct hash_table *variable_context)
data.f[c] = ldexp(op[0]->value.f[c], op[1]->value.i[c]);
/* Flush subnormal values to zero. */
if (!isnormal(data.f[c]))
- data.f[c] = copysign(0.0, op[0]->value.f[c]);
+ data.f[c] = copysign(0.0f, op[0]->value.f[c]);
}
break;