From 87ba01dba90b0b2ffbad2b9e07552734959814db Mon Sep 17 00:00:00 2001 From: Christian Baars Date: Thu, 29 Apr 2021 15:52:27 +0200 Subject: Fix missing Cycles CPU name on macOS Arm Differential Revision: https://developer.blender.org/D11061 --- intern/cycles/util/util_system.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'intern') diff --git a/intern/cycles/util/util_system.cpp b/intern/cycles/util/util_system.cpp index 6500a59e42c..8971867b736 100644 --- a/intern/cycles/util/util_system.cpp +++ b/intern/cycles/util/util_system.cpp @@ -145,7 +145,7 @@ int system_cpu_num_active_group_processors() return numaAPI_GetNumCurrentNodesProcessors(); } -#if !defined(_WIN32) || defined(FREE_WINDOWS) +#if !defined(__APPLE__) && (!defined(_WIN32) || defined(FREE_WINDOWS)) static void __cpuid(int data[4], int selector) { # if defined(__x86_64__) @@ -166,7 +166,13 @@ static void __cpuid(int data[4], int selector) string system_cpu_brand_string() { -#if !defined(WIN32) && !defined(__x86_64__) && !defined(__i386__) +#if defined(__APPLE__) + char modelname[512] = ""; + size_t bufferlen = 512; + if (sysctlbyname("machdep.cpu.brand_string", &modelname, &bufferlen, NULL, 0) == 0) { + return modelname; + } +#elif !defined(WIN32) && !defined(__x86_64__) && !defined(__i386__) FILE *cpuinfo = fopen("/proc/cpuinfo", "r"); if (cpuinfo != nullptr) { char cpuinfo_buf[513] = ""; -- cgit v1.2.3