mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-17 11:24:27 +01:00
M1: Correctly detect core count.
This commit is contained in:
1 parent
20d579c3b8
commit
9c8feefcdc
2 files changed
+24
-4
No files matched your search
@@ -19,6 +19,11 @@
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#if PPSSPP_PLATFORM(MAC)
|
||||
#include <sys/sysctl.h>
|
||||
#endif
|
||||
|
||||
|
||||
#if PPSSPP_ARCH(ARM) || PPSSPP_ARCH(ARM64)
|
||||
|
||||
#include <ctype.h>
|
||||
@@ -246,6 +251,17 @@ void CPUInfo::Detect()
|
||||
#endif
|
||||
strcpy(brand_string, "Apple A");
|
||||
num_cores = 2;
|
||||
#elif PPSSPP_PLATFORM(MAC)
|
||||
strcpy(brand_string, "Apple M1");
|
||||
int num = 0;
|
||||
size_t sz = sizeof(num);
|
||||
if (sysctlbyname("hw.physicalcpu_max", &num, &sz, nullptr, 0) == 0) {
|
||||
num_cores = num;
|
||||
sz = sizeof(num);
|
||||
if (sysctlbyname("hw.logicalcpu_max", &num, &sz, nullptr, 0) == 0) {
|
||||
logical_cpu_count = num / num_cores;
|
||||
}
|
||||
}
|
||||
#elif PPSSPP_PLATFORM(WINDOWS)
|
||||
truncate_cpy(brand_string, GetCPUBrandString().c_str());
|
||||
isVFP3 = true;
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "Common/StringUtils.h"
|
||||
|
||||
#if defined(_WIN32) && !defined(__MINGW32__)
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <Windows.h>
|
||||
#define _interlockedbittestandset workaround_ms_header_bug_platform_sdk6_set
|
||||
@@ -53,7 +54,8 @@ void do_cpuidex(u32 regs[4], u32 cpuid_leaf, u32 ecxval) {
|
||||
void do_cpuid(u32 regs[4], u32 cpuid_leaf) {
|
||||
__cpuid((int *)regs, cpuid_leaf);
|
||||
}
|
||||
#else
|
||||
|
||||
#else // _WIN32
|
||||
|
||||
#ifdef _M_SSE
|
||||
#include <emmintrin.h>
|
||||
@@ -68,7 +70,7 @@ static unsigned long long _xgetbv(unsigned int index)
|
||||
|
||||
#else
|
||||
#define _XCR_XFEATURE_ENABLED_MASK 0
|
||||
#endif
|
||||
#endif // _M_SSE
|
||||
|
||||
#if !defined(MIPS)
|
||||
|
||||
@@ -92,8 +94,10 @@ void do_cpuid(u32 regs[4], u32 cpuid_leaf)
|
||||
do_cpuidex(regs, cpuid_leaf, 0);
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
#endif // !defined(MIPS)
|
||||
|
||||
#endif // !win32
|
||||
|
||||
|
||||
CPUInfo cpu_info;
|
||||
|
||||
|
||||
Reference in new issue
Block a user