diff options
author | Patrick Mours <pmours@nvidia.com> | 2020-02-12 17:36:12 +0300 |
---|---|---|
committer | Patrick Mours <pmours@nvidia.com> | 2020-02-12 17:46:30 +0300 |
commit | 6389471c40d41c79ce633449756cd684261e1d64 (patch) | |
tree | b235371a8302220a404df23a25a80c11287e3b7b /intern | |
parent | 83c6f09746d70c63c964a21286cd4b873a63f76d (diff) |
Fix NLM denoiser no longer working with OptiX after recent commit
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/device/device_optix.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/intern/cycles/device/device_optix.cpp b/intern/cycles/device/device_optix.cpp index 4a711c50731..adb0f60a006 100644 --- a/intern/cycles/device/device_optix.cpp +++ b/intern/cycles/device/device_optix.cpp @@ -659,8 +659,10 @@ class OptiXDevice : public CUDADevice { bool launch_denoise(DeviceTask &task, RenderTile &rtile, int thread_index) { - int total_samples = rtile.start_sample + rtile.num_samples; + // Update current sample (for display and NLM denoising task) + rtile.sample = rtile.start_sample + rtile.num_samples; + // Make CUDA context current now, since it is used for both denoising tasks const CUDAContextScope scope(cuContext); // Choose between OptiX and NLM denoising @@ -770,7 +772,7 @@ class OptiXDevice : public CUDADevice { &task.pass_stride, const_cast<int *>(pass_offset), &task.denoising.optix_input_passes, - &total_samples}; + &rtile.sample}; CUDA_GET_BLOCKSIZE(convert_to_rgb_func, rect_size.x, rect_size.y); CUDA_LAUNCH_KERNEL(convert_to_rgb_func, args); @@ -920,8 +922,6 @@ class OptiXDevice : public CUDADevice { CUDADevice::denoise(rtile, denoising); } - // Update current sample, so it is displayed correctly - rtile.sample = total_samples; // Update task progress after the denoiser completed processing task.update_progress(&rtile, rtile.w * rtile.h); @@ -1448,6 +1448,11 @@ class OptiXDevice : public CUDADevice { // Upload texture information to device if it has changed since last launch load_texture_info(); + { // Synchronize all memory copies before executing task + const CUDAContextScope scope(cuContext); + check_result_cuda(cuCtxSynchronize()); + } + if (task.type == DeviceTask::FILM_CONVERT) { // Execute in main thread because of OpenGL access film_convert(task, task.buffer, task.rgba_byte, task.rgba_half); |