diff --git a/intern/cycles/device/device.cpp b/intern/cycles/device/device.cpp index 0a2378eb679..d871149bd87 100644 --- a/intern/cycles/device/device.cpp +++ b/intern/cycles/device/device.cpp @@ -208,6 +208,27 @@ vector Device::available_types() return types; } +static void device_oidn_init_once() +{ + static bool initialized = false; + + if (initialized == false) { + /* Disable OIDN for HIP until it has been tested to be stable on more systems. + * + * In older drivers with an integrated GPU, this may crash with message: + * "hipErrorNoBinaryForGpu: Unable to find code object for all current devices". + * + * This also affects systems which have for example an NVIDIA GPU as OIDN + * initializes all device types together. */ +#ifdef _WIN32 + _putenv_s("OIDN_DEVICE_HIP", "0"); +#else + setenv("OIDN_DEVICE_HIP", "0", true); +#endif + initialized = true; + } +} + vector Device::available_devices(uint mask) { /* Lazy initialize devices. On some platforms OpenCL or CUDA drivers can @@ -216,6 +237,8 @@ vector Device::available_devices(uint mask) thread_scoped_lock lock(device_mutex); vector devices; + device_oidn_init_once(); + #if defined(WITH_CUDA) || defined(WITH_OPTIX) if (mask & (DEVICE_MASK_CUDA | DEVICE_MASK_OPTIX)) { if (!(devices_initialized_mask & DEVICE_MASK_CUDA)) { @@ -314,6 +337,8 @@ string Device::device_capabilities(uint mask) thread_scoped_lock lock(device_mutex); string capabilities = ""; + device_oidn_init_once(); + if (mask & DEVICE_MASK_CPU) { capabilities += "\nCPU device capabilities: "; capabilities += device_cpu_capabilities() + "\n";