Mesa (master): gallivm: cosf/sinf are macros on MSVC.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Mon May 10 07:32:14 UTC 2010


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

Author: José Fonseca <jfonseca at vmware.com>
Date:   Mon May 10 08:30:28 2010 +0100

gallivm: cosf/sinf are macros on MSVC.

So taking the function address does not work.

---

 src/gallium/auxiliary/gallivm/lp_bld_arit.c |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.c b/src/gallium/auxiliary/gallivm/lp_bld_arit.c
index 9aea04e..0f56f2a 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_arit.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.c
@@ -1231,18 +1231,28 @@ lp_build_sincos(struct lp_build_context *bld,
    return res;
 }
 
+static float c_cosf( float f )
+{
+   return (float) cos( (double) f );
+}
+
+static float c_sinf( float f )
+{
+   return (float) sin( (double) f );
+}
+
 LLVMValueRef
 lp_build_cos(struct lp_build_context *bld,
              LLVMValueRef a)
 {
-   return lp_build_sincos(bld, "cosf", &cosf, a);
+   return lp_build_sincos(bld, "cosf", &c_cosf, a);
 }
 
 LLVMValueRef
 lp_build_sin(struct lp_build_context *bld,
              LLVMValueRef a)
 {
-   return lp_build_sincos(bld, "sinf", &sinf, a);
+   return lp_build_sincos(bld, "sinf", &c_sinf, a);
 }
 
 #else /* !PIPE_OS_WINDOWS */




More information about the mesa-commit mailing list