Mesa (master): mesa: Fix msvc build of glsl.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Mon Aug 23 19:55:55 UTC 2010


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

Author: Aras Pranckevicius <aras at unity3d.com>
Date:   Mon Aug 23 09:19:51 2010 +0300

mesa: Fix msvc build of glsl.

Signed-off-by: José Fonseca <jfonseca at vmware.com>

---

 src/mesa/main/imports.h |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h
index e967b14..22ac26e 100644
--- a/src/mesa/main/imports.h
+++ b/src/mesa/main/imports.h
@@ -120,7 +120,7 @@ typedef union { GLfloat f; GLint i; } fi_type;
  * \name Work-arounds for platforms that lack C99 math functions
  */
 /*@{*/
-#if (defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE < 600)) && !defined(_ISOC99_SOURCE) \
+#if (!defined(_XOPEN_SOURCE) || (_XOPEN_SOURCE < 600)) && !defined(_ISOC99_SOURCE) \
    && (!defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)) \
    && (!defined(_MSC_VER) || (_MSC_VER < 1400))
 #define acosf(f) ((float) acos(f))
@@ -141,7 +141,12 @@ typedef union { GLfloat f; GLint i; } fi_type;
 #define sqrtf(f) ((float) sqrt(f))
 #define tanf(f) ((float) tan(f))
 #define tanhf(f) ((float) tanh(f))
-#define truncf(f) ((float) trunc(f))
+#endif
+
+#if defined(_MSC_VER)
+static INLINE float truncf(float x) { return x < 0.0f ? ceilf(x) : floorf(x); }
+static INLINE float exp2f(float x) { return powf(2.0f, x); }
+static INLINE float log2f(float x) { return logf(x) * 1.442695041f; }
 #endif
 /*@}*/
 




More information about the mesa-commit mailing list