diff options
Diffstat (limited to 'intern/cycles/device/device_multi.cpp')
-rw-r--r-- | intern/cycles/device/device_multi.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/intern/cycles/device/device_multi.cpp b/intern/cycles/device/device_multi.cpp index b272e59f99d..35faadcbec5 100644 --- a/intern/cycles/device/device_multi.cpp +++ b/intern/cycles/device/device_multi.cpp @@ -46,10 +46,13 @@ class MultiDevice : public Device { list<SubDevice> devices, denoising_devices; device_ptr unique_key; vector<vector<SubDevice *>> peer_islands; + bool use_denoising; bool matching_rendering_and_denoising_devices; MultiDevice(DeviceInfo &info, Stats &stats, Profiler &profiler, bool background_) - : Device(info, stats, profiler, background_), unique_key(1) + : Device(info, stats, profiler, background_), + unique_key(1), + use_denoising(!info.denoising_devices.empty()) { foreach (DeviceInfo &subinfo, info.multi_devices) { /* Always add CPU devices at the back since GPU devices can change @@ -194,6 +197,7 @@ class MultiDevice : public Device { if (!sub.device->load_kernels(requested_features)) return false; + use_denoising = requested_features.use_denoising; if (requested_features.use_denoising) { /* Only need denoising feature, everything else is unused. */ DeviceRequestedFeatures denoising_features; @@ -400,7 +404,7 @@ class MultiDevice : public Device { size_t existing_size = mem.device_size; /* The tile buffers are allocated on each device (see below), so copy to all of them */ - if (strcmp(mem.name, "RenderBuffers") == 0) { + if (strcmp(mem.name, "RenderBuffers") == 0 && use_denoising) { foreach (SubDevice &sub, devices) { mem.device = sub.device; mem.device_pointer = (existing_key) ? sub.ptr_map[existing_key] : 0; @@ -466,7 +470,7 @@ class MultiDevice : public Device { /* This is a hack to only allocate the tile buffers on denoising devices * Similarly the tile buffers also need to be allocated separately on all devices so any * overlap rendered for denoising does not interfere with each other */ - if (strcmp(mem.name, "RenderBuffers") == 0) { + if (strcmp(mem.name, "RenderBuffers") == 0 && use_denoising) { vector<device_ptr> device_pointers; device_pointers.reserve(devices.size()); @@ -518,7 +522,7 @@ class MultiDevice : public Device { size_t existing_size = mem.device_size; /* Free memory that was allocated for all devices (see above) on each device */ - if (strcmp(mem.name, "RenderBuffers") == 0 || mem.type == MEM_PIXELS) { + if (mem.type == MEM_PIXELS || (strcmp(mem.name, "RenderBuffers") == 0 && use_denoising)) { foreach (SubDevice &sub, devices) { mem.device = sub.device; mem.device_pointer = sub.ptr_map[key]; |