forked from surge-synthesizer/surge
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. Add the google C++ cpu detection protable code as a submod 2. Turn on AVX flags at build time 3. If you are running on a non-AVX box pop a warning saying may not work in the future 4. get popcorn Closes surge-synthesizer#4466
- Loading branch information
Showing
7 changed files
with
152 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule cpu_features
added at
3e8243
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
/* | ||
** Surge Synthesizer is Free and Open Source Software | ||
** | ||
** Surge is made available under the Gnu General Public License, v3.0 | ||
** https://www.gnu.org/licenses/gpl-3.0.en.html | ||
** | ||
** Copyright 2004-2021 by various individuals as described by the Git transaction log | ||
** | ||
** All source at: https://github.com/surge-synthesizer/surge.git | ||
** | ||
** Surge was a commercial product from 2004-2018, with Copyright and ownership | ||
** in that period held by Claes Johanson at Vember Audio. Claes made Surge | ||
** open source in September 2018. | ||
*/ | ||
|
||
#include "CPUFeatures.h" | ||
#include "globals.h" | ||
|
||
#if ARM_NEON | ||
#else | ||
#include "cpuinfo_x86.h" | ||
#endif | ||
|
||
using namespace cpu_features; | ||
|
||
namespace Surge | ||
{ | ||
namespace CPUFeatures | ||
{ | ||
#if ARM_NEON | ||
#else | ||
static const X86Features features = GetX86Info().features; | ||
#endif | ||
|
||
std::string cpuBrand() | ||
{ | ||
#if ARM_NEON | ||
return "ARM Processor"; | ||
#else | ||
char bs[49]; | ||
FillX86BrandString(bs); | ||
return bs; | ||
#endif | ||
} | ||
|
||
bool isArm() | ||
{ | ||
#if ARM_NEON | ||
return true; | ||
#else | ||
return false; | ||
#endif | ||
} | ||
bool isX86() | ||
{ | ||
#if ARM_NEON | ||
return false; | ||
#else | ||
return true; | ||
#endif | ||
} | ||
bool hasSSE2() | ||
{ | ||
#if ARM_NEON | ||
return true; // thanks simde | ||
#else | ||
return features.sse2; | ||
#endif | ||
} | ||
bool hasAVX() | ||
{ | ||
#if ARM_NEON | ||
return true; // thanks simde | ||
#else | ||
return features.avx; | ||
#endif | ||
} | ||
|
||
#if !CPU_FEATURES_COMPILED_X86_AVX | ||
#error "You must compile SURGE with AVX support in compiler flags" | ||
#endif | ||
} // namespace CPUFeatures | ||
} // namespace Surge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
** Surge Synthesizer is Free and Open Source Software | ||
** | ||
** Surge is made available under the Gnu General Public License, v3.0 | ||
** https://www.gnu.org/licenses/gpl-3.0.en.html | ||
** | ||
** Copyright 2004-2021 by various individuals as described by the Git transaction log | ||
** | ||
** All source at: https://github.com/surge-synthesizer/surge.git | ||
** | ||
** Surge was a commercial product from 2004-2018, with Copyright and ownership | ||
** in that period held by Claes Johanson at Vember Audio. Claes made Surge | ||
** open source in September 2018. | ||
*/ | ||
|
||
#ifndef SURGE_XT_CPUFEATURES_H | ||
#define SURGE_XT_CPUFEATURES_H | ||
|
||
#include <string> | ||
|
||
namespace Surge | ||
{ | ||
namespace CPUFeatures | ||
{ | ||
std::string cpuBrand(); | ||
bool isArm(); | ||
bool isX86(); | ||
bool hasSSE2(); | ||
bool hasAVX(); | ||
}; // namespace CPUFeatures | ||
} // namespace Surge | ||
|
||
#endif // SURGE_XT_CPUFEATURES_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters