Cycles: Enable OptiX on all Maxwell+ GPUs
This commit is contained in:
parent
ad0da42751
commit
510541563e
Notes:
blender-bot
2023-02-14 07:17:43 +01:00
Referenced by issue #77348, Blender LTS: Maintenance Task 2.83
|
@ -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);
|
||||
|
||||
int major;
|
||||
cuDeviceGetAttribute(&major, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR, info.num);
|
||||
if (major < 5) {
|
||||
continue; // Only Maxwell and up are supported by OptiX
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
// Only add devices with RTX support
|
||||
if (rtcore_version != 0 || getenv("CYCLES_OPTIX_TEST")) {
|
||||
devices.push_back(info);
|
||||
}
|
||||
devices.push_back(info);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue