[Bf-blender-cvs] [89d61f006c9] cycles-x: Cycles X: restore get_devices() API function
Brecht Van Lommel
noreply at git.blender.org
Thu Jul 22 18:20:51 CEST 2021
Commit: 89d61f006c9f89539b0f9a70db4eaa2225025564
Author: Brecht Van Lommel
Date: Thu Jul 22 17:40:53 2021 +0200
Branches: cycles-x
https://developer.blender.org/rB89d61f006c9f89539b0f9a70db4eaa2225025564
Cycles X: restore get_devices() API function
Removal of this broke some render farm scripts. Keep it around for backwards
compatibility but recommend using refresh_devices() instead for refreshing
the device list.
===================================================================
M intern/cycles/blender/addon/properties.py
===================================================================
diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py
index 1df57e5bef2..0b5ecfbb5b3 100644
--- a/intern/cycles/blender/addon/properties.py
+++ b/intern/cycles/blender/addon/properties.py
@@ -1326,6 +1326,20 @@ class CyclesPreferences(bpy.types.AddonPreferences):
devices.extend(cpu_devices)
return devices
+ # Refresh device list. This does not happen automatically on Blender
+ # startup due to unstable OpenCL implementations that can cause crashes.
+ def refresh_devices(self):
+ import _cycles
+ # Ensure `self.devices` is not re-allocated when the second call to
+ # get_devices_for_type is made, freeing items from the first list.
+ for device_type in ('CUDA', 'OPTIX', 'OPENCL'):
+ self.update_device_entries(_cycles.available_devices(device_type))
+
+ # Deprecated: use refresh_devices instead.
+ def get_devices(self, compute_device_type=''):
+ self.refresh_devices()
+ return None
+
def get_num_gpu_devices(self):
import _cycles
device_list = _cycles.available_devices(self.compute_device_type)
More information about the Bf-blender-cvs
mailing list