From 09ba1486f8224abb9d1bd0e633124512de88b914 Mon Sep 17 00:00:00 2001 From: Michael Jones Date: Sat, 11 May 2024 09:32:55 +0200 Subject: [PATCH] Cycles: Select Metal compute device by default on Apple Silicon machines _No response_ Pull Request: https://projects.blender.org/blender/blender/pulls/121672 --- intern/cycles/blender/addon/properties.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py index 6933f6ba32a..9b7af95d858 100644 --- a/intern/cycles/blender/addon/properties.py +++ b/intern/cycles/blender/addon/properties.py @@ -1452,6 +1452,14 @@ class CyclesDeviceSettings(bpy.types.PropertyGroup): class CyclesPreferences(bpy.types.AddonPreferences): bl_idname = __package__ + def default_device(): + import platform + # Default to selecting the Metal compute device on Apple Silicon GPUs + # (drivers are tightly integrated with macOS so pose no stability risk) + if (platform.system() == 'Darwin') and (platform.machine() == 'arm64'): + return 5 + return 0 + def get_device_types(self, context): import _cycles has_cuda, has_optix, has_hip, has_metal, has_oneapi, has_hiprt = _cycles.get_device_types() @@ -1473,6 +1481,7 @@ class CyclesPreferences(bpy.types.AddonPreferences): compute_device_type: EnumProperty( name="Compute Device Type", description="Device to use for computation (rendering with Cycles)", + default=CyclesPreferences.default_device(), items=CyclesPreferences.get_device_types, )