diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-01-29 18:39:30 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-01-29 19:00:02 +0300 |
commit | 001414fb2f7346d2ff332bf851373522d87659d7 (patch) | |
tree | 366112462b869a31767d7439b04b900ba21044c1 /intern/cycles/app/cycles_standalone.cpp | |
parent | e37b9b5d0d2664697de8f1c7614e88073dd8ff49 (diff) |
Cycles: delay CUDA and OpenCL initialization to avoid driver crashes.
We've had many reported crashes on Windows where we suspect there is a
corrupted OpenCL driver. The purpose here is to keep Blender generally
usable in such cases.
Now it always shows None / CUDA / OpenCL in the preferences, and only when
selecting one will it reveal if there are any GPUs available. This should
avoid crashes when opening the preferences or on startup.
Differential Revision: https://developer.blender.org/D4265
Diffstat (limited to 'intern/cycles/app/cycles_standalone.cpp')
-rw-r--r-- | intern/cycles/app/cycles_standalone.cpp | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/intern/cycles/app/cycles_standalone.cpp b/intern/cycles/app/cycles_standalone.cpp index ff2e0156b1a..9c899a38e7b 100644 --- a/intern/cycles/app/cycles_standalone.cpp +++ b/intern/cycles/app/cycles_standalone.cpp @@ -363,13 +363,8 @@ static void options_parse(int argc, const char **argv) string devicename = "CPU"; bool list = false; - vector<DeviceType>& types = Device::available_types(); - - /* TODO(sergey): Here's a feedback loop happens: on the one hand we want - * the device list to be printed in help message, on the other hand logging - * is not initialized yet so we wouldn't have debug log happening in the - * device initialization. - */ + /* List devices for which support is compiled in. */ + vector<DeviceType> types = Device::available_types(); foreach(DeviceType type, types) { if(device_names != "") device_names += ", "; @@ -421,7 +416,7 @@ static void options_parse(int argc, const char **argv) } if(list) { - vector<DeviceInfo>& devices = Device::available_devices(); + vector<DeviceInfo> devices = Device::available_devices(); printf("Devices:\n"); foreach(DeviceInfo& info, devices) { @@ -456,15 +451,12 @@ static void options_parse(int argc, const char **argv) /* find matching device */ DeviceType device_type = Device::type_from_string(devicename.c_str()); - vector<DeviceInfo>& devices = Device::available_devices(); - bool device_available = false; + vector<DeviceInfo> devices = Device::available_devices(DEVICE_MASK(device_type)); - foreach(DeviceInfo& device, devices) { - if(device_type == device.type) { - options.session_params.device = device; - device_available = true; - break; - } + bool device_available = false; + if (!devices.empty()) { + options.session_params.device = devices.front(); + device_available = true; } /* handle invalid configurations */ |