From 50b09c85ec866513841e7e772a3c18795d8d439b Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 19 Mar 2024 17:38:51 +0100 Subject: [PATCH] Cycles: Allow enabling OIDN for HIP with environment variable Using the existing OIDN_DEVICE_HIP, don't overwrite it if it was already set. --- intern/cycles/device/device.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/intern/cycles/device/device.cpp b/intern/cycles/device/device.cpp index d871149bd87..4f9fc51b488 100644 --- a/intern/cycles/device/device.cpp +++ b/intern/cycles/device/device.cpp @@ -220,11 +220,13 @@ static void device_oidn_init_once() * * This also affects systems which have for example an NVIDIA GPU as OIDN * initializes all device types together. */ + if (getenv("OIDN_DEVICE_HIP") == nullptr) { #ifdef _WIN32 - _putenv_s("OIDN_DEVICE_HIP", "0"); + _putenv_s("OIDN_DEVICE_HIP", "0"); #else - setenv("OIDN_DEVICE_HIP", "0", true); + setenv("OIDN_DEVICE_HIP", "0", true); #endif + } initialized = true; } } -- 2.30.2