diff options
author | Patrick Mours <pmours@nvidia.com> | 2020-06-05 13:33:00 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2021-02-08 15:32:12 +0300 |
commit | 510541563efa8f34e3ed6632e53aef31c3665a2f (patch) | |
tree | 8ef505b056d4dda56ff2ecf6e658fe7c25cc60bf | |
parent | ad0da42751596a63a1bc4de5135cd43f7c3921bb (diff) |
Cycles: Enable OptiX on all Maxwell+ GPUs
-rw-r--r-- | intern/cycles/device/device_optix.cpp | 34 |
1 files changed, 11 insertions, 23 deletions
diff --git a/intern/cycles/device/device_optix.cpp b/intern/cycles/device/device_optix.cpp index 441fa35f8af..db04c13d083 100644 --- a/intern/cycles/device/device_optix.cpp +++ b/intern/cycles/device/device_optix.cpp @@ -1537,34 +1537,22 @@ bool device_optix_init() void device_optix_info(const vector<DeviceInfo> &cuda_devices, vector<DeviceInfo> &devices) { + devices.reserve(cuda_devices.size()); + // Simply add all supported CUDA devices as OptiX devices again - for (const DeviceInfo &cuda_info : cuda_devices) { - DeviceInfo info = cuda_info; + for (DeviceInfo info : cuda_devices) { assert(info.type == DEVICE_CUDA); - info.type = DEVICE_OPTIX; - info.id += "_OptiX"; - // Figure out RTX support - CUdevice cuda_device = 0; - CUcontext cuda_context = NULL; - unsigned int rtcore_version = 0; - if (cuDeviceGet(&cuda_device, info.num) == CUDA_SUCCESS && - cuDevicePrimaryCtxRetain(&cuda_context, cuda_device) == CUDA_SUCCESS) { - OptixDeviceContext optix_context = NULL; - if (optixDeviceContextCreate(cuda_context, nullptr, &optix_context) == OPTIX_SUCCESS) { - optixDeviceContextGetProperty(optix_context, - OPTIX_DEVICE_PROPERTY_RTCORE_VERSION, - &rtcore_version, - sizeof(rtcore_version)); - optixDeviceContextDestroy(optix_context); - } - cuDevicePrimaryCtxRelease(cuda_device); + int major; + cuDeviceGetAttribute(&major, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR, info.num); + if (major < 5) { + continue; // Only Maxwell and up are supported by OptiX } - // Only add devices with RTX support - if (rtcore_version != 0 || getenv("CYCLES_OPTIX_TEST")) { - devices.push_back(info); - } + info.type = DEVICE_OPTIX; + info.id += "_OptiX"; + + devices.push_back(info); } } |