Skip to content

Commit

Permalink
graphene-config: Hide SIMD implementation from GObject-Introspection
Browse files Browse the repository at this point in the history
Exposing the various #mesondefine'd constants results in the GIR XML
unnecessarily varying between architectures.

Conversely, GObject-Introspection's rather simplistic cpp parser
thinks GRAPHENE_SIMD_S is always defined to "sse", even on
architectures where it should not be.

Introspected code is not going to be able to use SIMD anyway, so this
doesn't seem to have any value.

Resolves: ebassi#211
Signed-off-by: Simon McVittie <[email protected]>
  • Loading branch information
smcv committed Feb 12, 2021
1 parent 6f0e97a commit 9512a42
Showing 1 changed file with 26 additions and 24 deletions.
50 changes: 26 additions & 24 deletions include/graphene-config.h.meson
Original file line number Diff line number Diff line change
Expand Up @@ -11,41 +11,41 @@
extern "C" {
#endif

#ifndef GRAPHENE_SIMD_BENCHMARK
#ifndef __GI_SCANNER__
# ifndef GRAPHENE_SIMD_BENCHMARK

# if defined(__SSE__) || \
# if defined(__SSE__) || \
(defined(_M_X64) && (_M_X64 > 0))
#mesondefine GRAPHENE_HAS_SSE
# endif

# if defined(__ARM_NEON__) || defined (_M_ARM64)
# if defined(__ARM_NEON__) || defined (_M_ARM64)
#mesondefine GRAPHENE_HAS_ARM_NEON
# endif
# endif

# if defined(__GNUC__) && (__GNUC__ >= 4 && __GNUC_MINOR__ >= 9) && !defined(__arm__)
# if defined(__GNUC__) && (__GNUC__ >= 4 && __GNUC_MINOR__ >= 9) && !defined(__arm__)
#mesondefine GRAPHENE_HAS_GCC
# endif
# endif

# define GRAPHENE_HAS_SCALAR 1
#endif /* GRAPHENE_SIMD_BENCHMARK */
# define GRAPHENE_HAS_SCALAR 1
# endif /* GRAPHENE_SIMD_BENCHMARK */

#if defined(GRAPHENE_HAS_SSE)
# define GRAPHENE_USE_SSE
# define GRAPHENE_SIMD_S "sse"
#elif defined(GRAPHENE_HAS_ARM_NEON)
# define GRAPHENE_USE_ARM_NEON
# define GRAPHENE_SIMD_S "neon"
#elif defined(GRAPHENE_HAS_GCC)
# define GRAPHENE_USE_GCC
# define GRAPHENE_SIMD_S "gcc"
#elif defined(GRAPHENE_HAS_SCALAR)
# define GRAPHENE_USE_SCALAR
# define GRAPHENE_SIMD_S "scalar"
#else
# error "Unsupported platform."
#endif
# if defined(GRAPHENE_HAS_SSE)
# define GRAPHENE_USE_SSE
# define GRAPHENE_SIMD_S "sse"
# elif defined(GRAPHENE_HAS_ARM_NEON)
# define GRAPHENE_USE_ARM_NEON
# define GRAPHENE_SIMD_S "neon"
# elif defined(GRAPHENE_HAS_GCC)
# define GRAPHENE_USE_GCC
# define GRAPHENE_SIMD_S "gcc"
# elif defined(GRAPHENE_HAS_SCALAR)
# define GRAPHENE_USE_SCALAR
# define GRAPHENE_SIMD_S "scalar"
# else
# error "Unsupported platform."
# endif

#ifndef __GI_SCANNER__
# if defined(GRAPHENE_USE_SSE)
# include <xmmintrin.h>
# include <emmintrin.h>
Expand Down Expand Up @@ -82,6 +82,8 @@ typedef struct {
* our public API, and introspection cannot use the SIMD API
* directly anyway.
*/
# define GRAPHENE_USE_SCALAR

typedef struct {
/*< private >*/
float x, y, z, w;
Expand Down

0 comments on commit 9512a42

Please sign in to comment.