summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-09-15 01:59:40 +0300
committerAndrei Karas <akaras@inbox.ru>2017-09-15 01:59:40 +0300
commit49ccccb2603278260e02bb43fb38251589ab4bd1 (patch)
treed849b91e7f0d2364d1d62bd0ec3cf35f91575f9a /src
parentc92942cd07aa0f1d5a6dd2460b588b70ca752df4 (diff)
downloadplus-49ccccb2603278260e02bb43fb38251589ab4bd1.tar.gz
plus-49ccccb2603278260e02bb43fb38251589ab4bd1.tar.bz2
plus-49ccccb2603278260e02bb43fb38251589ab4bd1.tar.xz
plus-49ccccb2603278260e02bb43fb38251589ab4bd1.zip
Detect cpu flags by sdl if other ways impossible to use.
Diffstat (limited to 'src')
-rw-r--r--src/utils/cpu.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/utils/cpu.cpp b/src/utils/cpu.cpp
index 5ae30c506..ef6a419b6 100644
--- a/src/utils/cpu.cpp
+++ b/src/utils/cpu.cpp
@@ -111,8 +111,35 @@ void Cpu::detect()
logger->log("cpu features was not detected");
#else // OTHER
+#ifdef USE_SDL2
+ if (SDL_HasMMX())
+ mCpuFlags |= FEATURE_MMX;
+ if (SDL_HasSSE())
+ mCpuFlags |= FEATURE_SSE;
+ if (SDL_HasSSE2())
+ mCpuFlags |= FEATURE_SSE2;
+ if (SDL_HasSSE3())
+ mCpuFlags |= FEATURE_SSSE3;
+ if (SDL_HasSSE41())
+ mCpuFlags |= FEATURE_SSE4;
+ if (SDL_HasSSE42())
+ mCpuFlags |= FEATURE_SSE42;
+
+#if SDL_VERSION_ATLEAST(2, 0, 2)
+ if (SDL_HasAVX())
+ mCpuFlags |= FEATURE_AVX;
+#endif // SDL_VERSION_ATLEAST(2, 0, 2)
+#if SDL_VERSION_ATLEAST(2, 0, 4)
+ if (SDL_HasAVX2())
+ mCpuFlags |= FEATURE_AVX2;
+#endif // SDL_VERSION_ATLEAST(2, 0, 4)
+
+ printFlags();
+#else // USE_SDL2
+
if (logger)
logger->log("cpu features not supported");
+#endif // USE_SDL2
#endif // (defined(__amd64__) || defined(__i386__)) && defined(__GNUC__)
// && (GCC_VERSION >= 40800) && !defined(ANDROID)