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 <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7549>
This commit is contained in:
Erik Faye-Lund 2020-11-11 14:54:20 +01:00 committed by Marge Bot
parent 03cfc93ab5
commit 9e4f588318
1 changed files with 21 additions and 0 deletions

View File

@ -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 },