diff options
author | Patrick Mours <pmours@nvidia.com> | 2020-02-11 18:30:01 +0300 |
---|---|---|
committer | Patrick Mours <pmours@nvidia.com> | 2020-02-11 20:03:43 +0300 |
commit | 38589de10c098cfe32ac7716f4d7844abf959753 (patch) | |
tree | d28b007bdc75e4eefd1d7ded5115655c50a72140 /intern/cycles/device/opencl/opencl_split.cpp | |
parent | 35490c3ead03d472dbcba36c85d428e81b442520 (diff) |
Cycles: Add support for denoising in the viewport
The OptiX denoiser can be a great help when rendering in the viewport, since it is really fast
and needs few samples to produce convincing results. This patch therefore adds support for
using any Cycles denoiser in the viewport also (but only the OptiX one is selectable because
the NLM one is too slow to be usable currently). It also adds support for denoising on a
different device than rendering (so one can e.g. render with the CPU but denoise with OptiX).
Reviewed By: #cycles, brecht
Differential Revision: https://developer.blender.org/D6554
Diffstat (limited to 'intern/cycles/device/opencl/opencl_split.cpp')
-rw-r--r-- | intern/cycles/device/opencl/opencl_split.cpp | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/intern/cycles/device/opencl/opencl_split.cpp b/intern/cycles/device/opencl/opencl_split.cpp index 76f9ce7a18f..af40aa89db4 100644 --- a/intern/cycles/device/opencl/opencl_split.cpp +++ b/intern/cycles/device/opencl/opencl_split.cpp @@ -1308,13 +1308,7 @@ void OpenCLDevice::thread_run(DeviceTask *task) { flush_texture_buffers(); - if (task->type == DeviceTask::FILM_CONVERT) { - film_convert(*task, task->buffer, task->rgba_byte, task->rgba_half); - } - else if (task->type == DeviceTask::SHADER) { - shader(*task); - } - else if (task->type == DeviceTask::RENDER) { + if (task->type == DeviceTask::RENDER || task->type == DeviceTask::DENOISE) { RenderTile tile; DenoisingTask denoising(this, *task); @@ -1352,6 +1346,30 @@ void OpenCLDevice::thread_run(DeviceTask *task) kgbuffer.free(); } + else if (task->type == DeviceTask::SHADER) { + shader(*task); + } + else if (task->type == DeviceTask::FILM_CONVERT) { + film_convert(*task, task->buffer, task->rgba_byte, task->rgba_half); + } + else if (task->type == DeviceTask::DENOISE_BUFFER) { + RenderTile tile; + tile.x = task->x; + tile.y = task->y; + tile.w = task->w; + tile.h = task->h; + tile.buffer = task->buffer; + tile.sample = task->sample + task->num_samples; + tile.num_samples = task->num_samples; + tile.start_sample = task->sample; + tile.offset = task->offset; + tile.stride = task->stride; + tile.buffers = task->buffers; + + DenoisingTask denoising(this, *task); + denoise(tile, denoising); + task->update_progress(&tile, tile.w * tile.h); + } } void OpenCLDevice::film_convert(DeviceTask &task, |