diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-05-14 17:23:24 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-05-14 17:23:24 +0300 |
commit | bd80c216355655830bde7f4b569b554dbd34d575 (patch) | |
tree | a1a8ca50a425e024df5547c23c52fd2f1e54ed57 /intern/cycles | |
parent | fc4f2571ba29e8f29e7f1d8a915f3a9e38229a28 (diff) | |
parent | b7386c66f9fdd8b6a3139c1ea4a4256c9729aab5 (diff) |
Merge branch 'blender-v2.83-release'
Diffstat (limited to 'intern/cycles')
-rw-r--r-- | intern/cycles/device/device.cpp | 12 | ||||
-rw-r--r-- | intern/cycles/device/device_intern.h | 2 | ||||
-rw-r--r-- | intern/cycles/device/device_optix.cpp | 18 |
3 files changed, 14 insertions, 18 deletions
diff --git a/intern/cycles/device/device.cpp b/intern/cycles/device/device.cpp index dfbf57e8b88..bad156d40bf 100644 --- a/intern/cycles/device/device.cpp +++ b/intern/cycles/device/device.cpp @@ -494,16 +494,18 @@ vector<DeviceInfo> Device::available_devices(uint mask) } #endif -#ifdef WITH_CUDA - if (mask & DEVICE_MASK_CUDA) { +#if defined(WITH_CUDA) || defined(WITH_OPTIX) + if (mask & (DEVICE_MASK_CUDA | DEVICE_MASK_OPTIX)) { if (!(devices_initialized_mask & DEVICE_MASK_CUDA)) { if (device_cuda_init()) { device_cuda_info(cuda_devices); } devices_initialized_mask |= DEVICE_MASK_CUDA; } - foreach (DeviceInfo &info, cuda_devices) { - devices.push_back(info); + if (mask & DEVICE_MASK_CUDA) { + foreach (DeviceInfo &info, cuda_devices) { + devices.push_back(info); + } } } #endif @@ -512,7 +514,7 @@ vector<DeviceInfo> Device::available_devices(uint mask) if (mask & DEVICE_MASK_OPTIX) { if (!(devices_initialized_mask & DEVICE_MASK_OPTIX)) { if (device_optix_init()) { - device_optix_info(optix_devices); + device_optix_info(cuda_devices, optix_devices); } devices_initialized_mask |= DEVICE_MASK_OPTIX; } diff --git a/intern/cycles/device/device_intern.h b/intern/cycles/device/device_intern.h index 0c229ac24cf..94d63e8f333 100644 --- a/intern/cycles/device/device_intern.h +++ b/intern/cycles/device/device_intern.h @@ -45,7 +45,7 @@ Device *device_multi_create(DeviceInfo &info, Stats &stats, Profiler &profiler, void device_cpu_info(vector<DeviceInfo> &devices); void device_opencl_info(vector<DeviceInfo> &devices); void device_cuda_info(vector<DeviceInfo> &devices); -void device_optix_info(vector<DeviceInfo> &devices); +void device_optix_info(const vector<DeviceInfo> &cuda_devices, vector<DeviceInfo> &devices); void device_network_info(vector<DeviceInfo> &devices); string device_cpu_capabilities(); diff --git a/intern/cycles/device/device_optix.cpp b/intern/cycles/device/device_optix.cpp index 37d6ae3d041..e839d852127 100644 --- a/intern/cycles/device/device_optix.cpp +++ b/intern/cycles/device/device_optix.cpp @@ -1534,14 +1534,11 @@ bool device_optix_init() return true; } -void device_optix_info(vector<DeviceInfo> &devices) +void device_optix_info(const vector<DeviceInfo> &cuda_devices, vector<DeviceInfo> &devices) { // Simply add all supported CUDA devices as OptiX devices again - vector<DeviceInfo> cuda_devices; - device_cuda_info(cuda_devices); - - for (auto it = cuda_devices.begin(); it != cuda_devices.end();) { - DeviceInfo &info = *it; + for (const DeviceInfo &cuda_info : cuda_devices) { + DeviceInfo info = cuda_info; assert(info.type == DEVICE_CUDA); info.type = DEVICE_OPTIX; info.id += "_OptiX"; @@ -1564,13 +1561,10 @@ void device_optix_info(vector<DeviceInfo> &devices) } // Only add devices with RTX support - if (rtcore_version == 0 && !getenv("CYCLES_OPTIX_TEST")) - it = cuda_devices.erase(it); - else - ++it; + if (rtcore_version != 0 || getenv("CYCLES_OPTIX_TEST")) { + devices.push_back(info); + } } - - devices.insert(devices.end(), cuda_devices.begin(), cuda_devices.end()); } Device *device_optix_create(DeviceInfo &info, Stats &stats, Profiler &profiler, bool background) |