Cycles: Select Metal compute device by default on Apple Silicon machines

_No response_

Pull Request: https://projects.blender.org/blender/blender/pulls/121672
This commit is contained in:
Michael Jones
2024-05-11 09:32:55 +02:00
committed by Michael Jones (Apple)
parent c3fc905544
commit 09ba1486f8

View File

@@ -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,
)