From 1e1a8d5c8f924d4e72998891a7734a152d7f03f5 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Fri, 9 Feb 2024 15:11:21 +0100 Subject: [PATCH] Fix: Cycles denoise fails with multi tile render and Use GPU off --- intern/cycles/integrator/path_trace.cpp | 3 +++ intern/cycles/integrator/render_scheduler.cpp | 5 +++++ intern/cycles/integrator/render_scheduler.h | 3 ++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/intern/cycles/integrator/path_trace.cpp b/intern/cycles/integrator/path_trace.cpp index 5783f272b6c..cd5dca34d2a 100644 --- a/intern/cycles/integrator/path_trace.cpp +++ b/intern/cycles/integrator/path_trace.cpp @@ -1002,6 +1002,9 @@ void PathTrace::process_full_buffer_from_disk(string_view filename) if (denoise_params.use) { progress_set_status(layer_view_name, "Denoising"); + /* If GPU should be used is not based on file metadata. */ + denoise_params.use_gpu = render_scheduler_.is_denoiser_gpu_used(); + /* Re-use the denoiser as much as possible, avoiding possible device re-initialization. * * It will not conflict with the regular rendering as: diff --git a/intern/cycles/integrator/render_scheduler.cpp b/intern/cycles/integrator/render_scheduler.cpp index 34736c22c40..79487713ded 100644 --- a/intern/cycles/integrator/render_scheduler.cpp +++ b/intern/cycles/integrator/render_scheduler.cpp @@ -46,6 +46,11 @@ void RenderScheduler::set_denoiser_params(const DenoiseParams ¶ms) denoiser_params_ = params; } +bool RenderScheduler::is_denoiser_gpu_used() const +{ + return denoiser_params_.use_gpu; +} + void RenderScheduler::set_limit_samples_per_update(const int limit_samples) { limit_samples_per_update_ = limit_samples; diff --git a/intern/cycles/integrator/render_scheduler.h b/intern/cycles/integrator/render_scheduler.h index 58d1dc48c4b..5278e659fc4 100644 --- a/intern/cycles/integrator/render_scheduler.h +++ b/intern/cycles/integrator/render_scheduler.h @@ -99,8 +99,9 @@ class RenderScheduler { bool is_background() const; void set_denoiser_params(const DenoiseParams ¶ms); - void set_adaptive_sampling(const AdaptiveSampling &adaptive_sampling); + bool is_denoiser_gpu_used() const; + void set_adaptive_sampling(const AdaptiveSampling &adaptive_sampling); bool is_adaptive_sampling_used() const; /* Start sample for path tracing.