Fix #106667: Cycles: Multi-device denoise runs denoising data passes

Only use the denoised buffer for access of denoised passes, and
access the rest of the passes from the original render buffer.

This allows in-place modification of the guiding passes needed
by the denoiser without affecting the final render result pixels.

Pull Request: https://projects.blender.org/blender/blender/pulls/106668
This commit is contained in:
Sergey Sharybin 2023-04-07 16:49:43 +02:00 committed by Sergey Sharybin
parent ade103d7b8
commit 44d5a894c1
2 changed files with 11 additions and 1 deletions

@ -109,6 +109,11 @@ class PassAccessor {
/* Set pass data for the given render buffers. Used for baking to read from passes. */
bool set_render_tile_pixels(RenderBuffers *render_buffers, const Source &source);
const PassAccessInfo &get_pass_access_info() const
{
return pass_access_info_;
}
protected:
virtual void init_kernel_film_convert(KernelFilmConvert *kfilm_convert,
const BufferParams &buffer_params,

@ -1036,7 +1036,12 @@ bool PathTrace::get_render_tile_pixels(const PassAccessor &pass_accessor,
}
if (big_tile_denoise_work_ && render_state_.has_denoised_result) {
return big_tile_denoise_work_->get_render_tile_pixels(pass_accessor, destination);
/* Only use the big tile denoised buffer to access the denoised passes.
* The guiding passes are allowed to be modified in-place for the needs of the denoiser,
* so copy those from the original devices buffers. */
if (pass_accessor.get_pass_access_info().mode == PassMode::DENOISED) {
return big_tile_denoise_work_->get_render_tile_pixels(pass_accessor, destination);
}
}
bool success = true;