[Bf-blender-cvs] [510541563ef] blender-v2.83-release: Cycles: Enable OptiX on all Maxwell+ GPUs

Patrick Mours noreply at git.blender.org
Mon Feb 8 16:50:13 CET 2021


Commit: 510541563efa8f34e3ed6632e53aef31c3665a2f
Author: Patrick Mours
Date:   Fri Jun 5 12:33:00 2020 +0200
Branches: blender-v2.83-release
https://developer.blender.org/rB510541563efa8f34e3ed6632e53aef31c3665a2f

Cycles: Enable OptiX on all Maxwell+ GPUs

===================================================================

M	intern/cycles/device/device_optix.cpp

===================================================================

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);
   }
 }



More information about the Bf-blender-cvs mailing list