Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make sure we get the mixers we need.
  • Loading branch information
icculus committed Jun 19, 2018
1 parent 0f3f994 commit 8a2b575
Showing 1 changed file with 23 additions and 12 deletions.
35 changes: 23 additions & 12 deletions mojoal.c
Expand Up @@ -22,6 +22,25 @@
#include "AL/alc.h"
#include "SDL.h"

#ifdef __SSE__ /* if you are on x86 or x86-64, we assume you have SSE1 by now. */
#define NEED_SCALAR_FALLBACK 0
#elif (defined(__ARM_ARCH) && (__ARM_ARCH >= 8)) /* ARMv8 always has NEON. */
#define NEED_SCALAR_FALLBACK 0
#elif (defined(__APPLE__) && defined(__ARM_ARCH) && (__ARM_ARCH >= 7)) /* All ARMv7 chips from Apple have NEON. */
#define NEED_SCALAR_FALLBACK 0
#elif (defined(__WINDOWS__) || defined(__WINRT__)) && defined(_M_ARM) /* all WinRT-level Microsoft devices have NEON */
#define NEED_SCALAR_FALLBACK 0
#else
#define NEED_SCALAR_FALLBACK 1
#endif

/* Some platforms fail to define __ARM_NEON__, others need it or arm_neon.h will fail. */
#if (defined(__ARM_ARCH) || defined(_M_ARM))
# if !NEED_SCALAR_FALLBACK && !defined(__ARM_NEON__)
# define __ARM_NEON__ 1
# endif
#endif

#ifdef __SSE__
#include <xmmintrin.h>
#endif
Expand Down Expand Up @@ -181,18 +200,6 @@
#define SIMDALIGNEDSTRUCT struct
#endif

#ifdef __SSE__ /* if you are on x86 or x86-64, we assume you have SSE1 by now. */
#define NEED_SCALAR_FALLBACK 0
#elif (defined(__ARM_ARCH) && (__ARM_ARCH >= 8)) /* ARMv8 always has NEON. */
#define NEED_SCALAR_FALLBACK 0
#elif (defined(__APPLE__) && defined(__ARM_ARCH) && (__ARM_ARCH >= 7)) /* All ARMv7 chips from Apple have NEON. */
#define NEED_SCALAR_FALLBACK 0
#elif (defined(__WINDOWS__) || defined(__WINRT__)) && defined(_M_ARM) /* all WinRT-level Microsoft devices have NEON */
#define NEED_SCALAR_FALLBACK 0
#else
#define NEED_SCALAR_FALLBACK 1
#endif

#ifdef __SSE__ /* we assume you always have this on x86/x86-64 chips. SSE1 is 20 years old! */
#define has_sse 1
#endif
Expand Down Expand Up @@ -1049,6 +1056,8 @@ static void mix_buffer(const ALbuffer *buffer, const ALfloat * restrict panning,
{
#if NEED_SCALAR_FALLBACK
mix_float32_c1_scalar(panning, data, stream, mixframes);
#else
SDL_assert(!"uhoh, we didn't compile in enough mixers!");
#endif
}
} else {
Expand All @@ -1061,6 +1070,8 @@ static void mix_buffer(const ALbuffer *buffer, const ALfloat * restrict panning,
{
#if NEED_SCALAR_FALLBACK
mix_float32_c2_scalar(panning, data, stream, mixframes);
#else
SDL_assert(!"uhoh, we didn't compile in enough mixers!");
#endif
}
}
Expand Down

0 comments on commit 8a2b575

Please sign in to comment.