Mesa (master): glsl: Define isnormal and copysign for MSVC to fix build.

Vinson Lee vlee at kemper.freedesktop.org
Sun Sep 22 23:12:06 UTC 2013


Module: Mesa
Branch: master
Commit: 6d29db715b8d60718ada1ab8ad19d969cac43caf
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6d29db715b8d60718ada1ab8ad19d969cac43caf

Author: Vinson Lee <vlee at freedesktop.org>
Date:   Sun Sep 22 16:08:26 2013 -0700

glsl: Define isnormal and copysign for MSVC to fix build.

This patch fixes these MSVC build errors.

ir_constant_expression.cpp
src\glsl\ir_constant_expression.cpp(564) : warning C4244: '=' : conversion from 'int' to 'float', possible loss of data
src\glsl\ir_constant_expression.cpp(1384) : error C3861: 'isnormal': identifier not found
src\glsl\ir_constant_expression.cpp(1385) : error C3861: 'copysign': identifier not found

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=69541
Signed-off-by: Vinson Lee <vlee at freedesktop.org>
Acked-by: Matt Turner <mattst88 at gmail.com>

---

 src/glsl/ir_constant_expression.cpp |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp
index 4579ef2..12641e5 100644
--- a/src/glsl/ir_constant_expression.cpp
+++ b/src/glsl/ir_constant_expression.cpp
@@ -40,6 +40,20 @@
 #include "glsl_types.h"
 #include "program/hash_table.h"
 
+#if defined(_MSC_VER) && (_MSC_VER < 1800)
+static int isnormal(double x)
+{
+   return _fpclass(x) == _FPCLASS_NN || _fpclass(x) == _FPCLASS_PN;
+}
+#endif
+
+#if defined(_MSC_VER)
+static double copysign(double x, double y)
+{
+   return _copysign(x, y);
+}
+#endif
+
 static float
 dot(ir_constant *op0, ir_constant *op1)
 {




More information about the mesa-commit mailing list