28 #ifndef __PlatformInformation_H__
29 #define __PlatformInformation_H__
40 #define OGRE_CPU_UNKNOWN 0
41 #define OGRE_CPU_X86 1
42 #define OGRE_CPU_PPC 2
43 #define OGRE_CPU_ARM 3
47 #if (defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64))) || \
48 (defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)))
49 # define OGRE_CPU OGRE_CPU_X86
51 #elif OGRE_PLATFORM == OGRE_PLATFORM_APPLE && defined(__BIG_ENDIAN__)
52 # define OGRE_CPU OGRE_CPU_PPC
53 #elif OGRE_PLATFORM == OGRE_PLATFORM_APPLE
54 # define OGRE_CPU OGRE_CPU_X86
55 #elif OGRE_PLATFORM == OGRE_PLATFORM_IPHONE && (defined(__i386__) || defined(__x86_64__))
56 # define OGRE_CPU OGRE_CPU_X86
57 #elif defined(__arm__)
58 # define OGRE_CPU OGRE_CPU_ARM
60 # define OGRE_CPU OGRE_CPU_UNKNOWN
65 #if OGRE_COMPILER == OGRE_COMPILER_MSVC
66 # define OGRE_ALIGNED_DECL(type, var, alignment) __declspec(align(alignment)) type var
68 #elif OGRE_COMPILER == OGRE_COMPILER_GNUC
69 # define OGRE_ALIGNED_DECL(type, var, alignment) type var __attribute__((__aligned__(alignment)))
72 # define OGRE_ALIGNED_DECL(type, var, alignment) type var
77 #if OGRE_CPU == OGRE_CPU_X86
78 # define OGRE_SIMD_ALIGNMENT 16
81 # define OGRE_SIMD_ALIGNMENT 16
86 #define OGRE_SIMD_ALIGNED_DECL(type, var) OGRE_ALIGNED_DECL(type, var, OGRE_SIMD_ALIGNMENT)
90 #if OGRE_DOUBLE_PRECISION == 0 && OGRE_CPU == OGRE_CPU_X86 && OGRE_COMPILER == OGRE_COMPILER_MSVC
91 # define __OGRE_HAVE_SSE 1
92 #elif OGRE_DOUBLE_PRECISION == 0 && OGRE_CPU == OGRE_CPU_X86 && OGRE_COMPILER == OGRE_COMPILER_GNUC && OGRE_PLATFORM != OGRE_PLATFORM_APPLE_IOS
93 # define __OGRE_HAVE_SSE 1
98 #if OGRE_DOUBLE_PRECISION == 0 && OGRE_CPU == OGRE_CPU_ARM && OGRE_COMPILER == OGRE_COMPILER_GNUC && defined(__ARM_ARCH_6K__) && defined(__VFP_FP__)
99 # define __OGRE_HAVE_VFP 1
104 #if OGRE_DOUBLE_PRECISION == 0 && OGRE_CPU == OGRE_CPU_ARM && OGRE_COMPILER == OGRE_COMPILER_GNUC && defined(__ARM_ARCH_7A__) && defined(__ARM_NEON__)
105 # define __OGRE_HAVE_NEON 1
108 #ifndef __OGRE_HAVE_SSE
109 # define __OGRE_HAVE_SSE 0
112 #ifndef __OGRE_HAVE_VFP
113 # define __OGRE_HAVE_VFP 0
116 #ifndef __OGRE_HAVE_NEON
117 # define __OGRE_HAVE_NEON 0
148 #if OGRE_CPU == OGRE_CPU_X86
149 CPU_FEATURE_SSE = 1 << 0,
150 CPU_FEATURE_SSE2 = 1 << 1,
151 CPU_FEATURE_SSE3 = 1 << 2,
152 CPU_FEATURE_MMX = 1 << 3,
153 CPU_FEATURE_MMXEXT = 1 << 4,
154 CPU_FEATURE_3DNOW = 1 << 5,
155 CPU_FEATURE_3DNOWEXT = 1 << 6,
156 CPU_FEATURE_CMOV = 1 << 7,
157 CPU_FEATURE_TSC = 1 << 8,
158 CPU_FEATURE_FPU = 1 << 9,
159 CPU_FEATURE_PRO = 1 << 10,
160 CPU_FEATURE_HTT = 1 << 11,
161 #elif OGRE_CPU == OGRE_CPU_ARM
162 CPU_FEATURE_VFP = 1 << 12,
163 CPU_FEATURE_NEON = 1 << 13,
174 static const String& getCpuIdentifier(
void);
181 static uint getCpuFeatures(
void);
188 static bool hasCpuFeature(CpuFeatures feature);
192 static void log(
Log* pLog);
200 #endif // __PlatformInformation_H__