[Bf-blender-cvs] [87ba01dba90] blender-v2.93-release: Fix missing Cycles CPU name on macOS Arm

Christian Baars noreply at git.blender.org
Thu Apr 29 15:59:34 CEST 2021


Commit: 87ba01dba90b0b2ffbad2b9e07552734959814db
Author: Christian Baars
Date:   Thu Apr 29 15:52:27 2021 +0200
Branches: blender-v2.93-release
https://developer.blender.org/rB87ba01dba90b0b2ffbad2b9e07552734959814db

Fix missing Cycles CPU name on macOS Arm

Differential Revision: https://developer.blender.org/D11061

===================================================================

M	intern/cycles/util/util_system.cpp

===================================================================

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] = "";



More information about the Bf-blender-cvs mailing list