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

Author: Erik Faye-Lund <[email protected]>
Date:   Wed Nov 11 14:54:20 2020 +0100

llvmpipe: fix arith-test build on msvc

These functions aren't implemented using plain functions in the MSVC
runtime, so trying to take the function pointers directly cause
compilation errors.

Instead, let's call them from a wrapper-function, and use a
pre-processor define to replace the usage in this case. This makes these
build fine on MSVC.

Reviewed-by: Jesse Natalie <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7549>

---

 src/gallium/drivers/llvmpipe/lp_test_arit.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/src/gallium/drivers/llvmpipe/lp_test_arit.c 
b/src/gallium/drivers/llvmpipe/lp_test_arit.c
index 873dcf37fac..c602d001f2f 100644
--- a/src/gallium/drivers/llvmpipe/lp_test_arit.c
+++ b/src/gallium/drivers/llvmpipe/lp_test_arit.c
@@ -293,6 +293,27 @@ const float fract_values[] = {
  * Unary test cases.
  */
 
+#ifdef _MSC_VER
+#define WRAP(func) \
+static float \
+wrap_ ## func ## (float x) \
+{ \
+   return func(x); \
+}
+WRAP(expf)
+WRAP(logf)
+WRAP(sinf)
+WRAP(cosf)
+WRAP(floorf)
+WRAP(ceilf)
+#define expf wrap_expf
+#define logf wrap_logf
+#define sinf wrap_sinf
+#define cosf wrap_cosf
+#define floorf wrap_floorf
+#define ceilf wrap_ceilf
+#endif
+
 static const struct unary_test_t
 unary_tests[] = {
    {"abs", &lp_build_abs, &fabsf, sgn_values, ARRAY_SIZE(sgn_values), 20.0 },

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to