Cycles: Added UI to force OIDN to use the CPU #117734
|
@ -1484,6 +1484,13 @@ class CyclesPreferences(bpy.types.AddonPreferences):
|
|||
default=True,
|
||||
)
|
||||
|
||||
use_oidngpu: BoolProperty(
|
||||
name="OpenImageDenoise on GPU",
|
||||
description="Perform denoising on GPU devices. This is significantly faster than on CPU, but requires additional GPU memory. "
|
||||
|
||||
"When large scenes need more GPU memory, this option can be disabled",
|
||||
default=True,
|
||||
)
|
||||
|
||||
kernel_optimization_level: EnumProperty(
|
||||
name="Kernel Optimization",
|
||||
description="Kernels can be optimized based on scene content. Optimized kernels are requested at the start of a render. "
|
||||
|
@ -1686,11 +1693,14 @@ class CyclesPreferences(bpy.types.AddonPreferences):
|
|||
import _cycles
|
||||
has_peer_memory = 0
|
||||
has_rt_api_support = False
|
||||
has_oidn_gpu_support = False
|
||||
for device in _cycles.available_devices(compute_device_type):
|
||||
if device[3] and self.find_existing_device_entry(device).use:
|
||||
has_peer_memory += 1
|
||||
if device[4] and self.find_existing_device_entry(device).use:
|
||||
has_rt_api_support = True
|
||||
if device[5] and self.find_existing_device_entry(device).use:
|
||||
has_oidn_gpu_support = True
|
||||
|
||||
if has_peer_memory > 1:
|
||||
row = layout.row()
|
||||
|
@ -1729,6 +1739,10 @@ class CyclesPreferences(bpy.types.AddonPreferences):
|
|||
row = layout.row()
|
||||
row.prop(self, "use_oneapirt")
|
||||
|
||||
if has_oidn_gpu_support:
|
||||
row = layout.row()
|
||||
row.prop(self, "use_oidngpu")
|
||||
|
||||
def draw(self, context):
|
||||
self.draw_impl(self.layout, context)
|
||||
|
||||
|
|
|
@ -59,6 +59,10 @@ void static adjust_device_info_from_preferences(DeviceInfo &info, PointerRNA cpr
|
|||
if (info.type == DEVICE_HIP && !get_boolean(cpreferences, "use_hiprt")) {
|
||||
info.use_hardware_raytracing = false;
|
||||
}
|
||||
|
||||
if (!get_boolean(cpreferences, "use_oidngpu")) {
|
||||
info.denoisers &= ~DENOISER_OPENIMAGEDENOISE;
|
||||
}
|
||||
}
|
||||
|
||||
DeviceInfo blender_device_info(BL::Preferences &b_preferences,
|
||||
|
|
|
@ -417,12 +417,14 @@ static PyObject *available_devices_func(PyObject * /*self*/, PyObject *args)
|
|||
for (size_t i = 0; i < devices.size(); i++) {
|
||||
DeviceInfo &device = devices[i];
|
||||
string type_name = Device::string_from_type(device.type);
|
||||
PyObject *device_tuple = PyTuple_New(5);
|
||||
PyObject *device_tuple = PyTuple_New(6);
|
||||
PyTuple_SET_ITEM(device_tuple, 0, pyunicode_from_string(device.description.c_str()));
|
||||
PyTuple_SET_ITEM(device_tuple, 1, pyunicode_from_string(type_name.c_str()));
|
||||
PyTuple_SET_ITEM(device_tuple, 2, pyunicode_from_string(device.id.c_str()));
|
||||
PyTuple_SET_ITEM(device_tuple, 3, PyBool_FromLong(device.has_peer_memory));
|
||||
PyTuple_SET_ITEM(device_tuple, 4, PyBool_FromLong(device.use_hardware_raytracing));
|
||||
PyTuple_SET_ITEM(
|
||||
device_tuple, 5, PyBool_FromLong(device.denoisers & DENOISER_OPENIMAGEDENOISE));
|
||||
PyTuple_SET_ITEM(ret, i, device_tuple);
|
||||
}
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ unique_ptr<Denoiser> Denoiser::create(Device *path_trace_device, const DenoisePa
|
|||
|
||||
#ifdef WITH_OPENIMAGEDENOISE
|
||||
if (params.type == DENOISER_OPENIMAGEDENOISE && path_trace_device->info.type != DEVICE_CPU &&
|
||||
(path_trace_device->info.denoisers & DENOISER_OPENIMAGEDENOISE) &&
|
||||
OIDNDenoiserGPU::is_device_supported(path_trace_device->info))
|
||||
{
|
||||
return make_unique<OIDNDenoiserGPU>(path_trace_device, params);
|
||||
|
|
Loading…
Reference in New Issue
This needs a better name and description, like:
Maybe for CUDA/OptiX the name could be dynamically to
OpenImageDenoise on GPU
since there the meaning is ambiguous.What about something like this?
In general we should not use abbreviations like "OIDN" for users. And I prefer to avoid the word "Allow", but mentioning if available in the description is fine.
For the description I think it's also good to have an explanation about why a user might disable it, as I did in mine.