From dd921238d9223f550d3043313c9c38d07620de5d Mon Sep 17 00:00:00 2001 From: Lukas Stockner Date: Mon, 7 Nov 2016 02:33:53 +0100 Subject: Cycles: Refactor Device selection to allow individual GPU compute device selection Previously, it was only possible to choose a single GPU or all of that type (CUDA or OpenCL). Now, a toggle button is displayed for every device. These settings are tied to the PCI Bus ID of the devices, so they're consistent across hardware addition and removal (but not when swapping/moving cards). From the code perspective, the more important change is that now, the compute device properties are stored in the Addon preferences of the Cycles addon, instead of directly in the User Preferences. This allows for a cleaner implementation, removing the Cycles C API functions that were called by the RNA code to specify the enum items. Note that this change is neither backwards- nor forwards-compatible, but since it's only a User Preference no existing files are broken. Reviewers: #cycles, brecht Reviewed By: #cycles, brecht Subscribers: brecht, juicyfruit, mib2berlin, Blendify Differential Revision: https://developer.blender.org/D2338 --- intern/cycles/device/device.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'intern/cycles/device/device.h') diff --git a/intern/cycles/device/device.h b/intern/cycles/device/device.h index 77dc1fa9713..b9bdffa2618 100644 --- a/intern/cycles/device/device.h +++ b/intern/cycles/device/device.h @@ -49,7 +49,7 @@ class DeviceInfo { public: DeviceType type; string description; - string id; + string id; /* used for user preferences, should stay fixed with changing hardware config */ int num; bool display_device; bool advanced_shading; @@ -69,6 +69,12 @@ public: has_bindless_textures = false; use_split_kernel = false; } + + bool operator==(const DeviceInfo &info) { + /* Multiple Devices with the same ID would be very bad. */ + assert(id != info.id || (type == info.type && num == info.num && description == info.description)); + return id == info.id; + } }; class DeviceRequestedFeatures { @@ -282,6 +288,7 @@ public: static vector& available_types(); static vector& available_devices(); static string device_capabilities(); + static DeviceInfo get_multi_device(vector subdevices); /* Tag devices lists for update. */ static void tag_update(); -- cgit v1.2.3