diff options
author | Sergey Sharybin <sergey@blender.org> | 2022-01-28 15:25:23 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey@blender.org> | 2022-01-28 16:28:04 +0300 |
commit | 430f71fce289e876602178330ac725c46c043abf (patch) | |
tree | 103e8c8a5067ac36ecf0416a0c1b72282489c1a6 /intern/cycles/integrator/denoiser_oidn.cpp | |
parent | 29a1d8b1d3fbf5bc6cc77906ded2178b5d77793b (diff) |
Fix insufficient CPU flags checks for Cycles OIDN
Sometime throughout development some checks got lost during refactor.
This change makes it so that if OIDN is not supported on the current
CPU Cycles will report an error and stop rendering. This behavior is
similar to when an OptiX denoiser is requested and there is no OptiX
compatible device available.
The easiest way to verify this change is to force return false from
the `openimagedenoise_supported()`.
Fixes Cycles part of the T94127.
Differential Revision: https://developer.blender.org/D13944
Diffstat (limited to 'intern/cycles/integrator/denoiser_oidn.cpp')
-rw-r--r-- | intern/cycles/integrator/denoiser_oidn.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/intern/cycles/integrator/denoiser_oidn.cpp b/intern/cycles/integrator/denoiser_oidn.cpp index a08aec513fc..4676e69c4fb 100644 --- a/intern/cycles/integrator/denoiser_oidn.cpp +++ b/intern/cycles/integrator/denoiser_oidn.cpp @@ -37,8 +37,6 @@ OIDNDenoiser::OIDNDenoiser(Device *path_trace_device, const DenoiseParams ¶m : Denoiser(path_trace_device, params) { DCHECK_EQ(params.type, DENOISER_OPENIMAGEDENOISE); - - DCHECK(openimagedenoise_supported()) << "OpenImageDenoiser is not supported on this platform."; } #ifdef WITH_OPENIMAGEDENOISE @@ -585,6 +583,9 @@ bool OIDNDenoiser::denoise_buffer(const BufferParams &buffer_params, const int num_samples, bool allow_inplace_modification) { + DCHECK(openimagedenoise_supported()) + << "OpenImageDenoiser is not supported on this platform or build."; + #ifdef WITH_OPENIMAGEDENOISE thread_scoped_lock lock(mutex_); @@ -635,4 +636,20 @@ uint OIDNDenoiser::get_device_type_mask() const return DEVICE_MASK_CPU; } +Device *OIDNDenoiser::ensure_denoiser_device(Progress *progress) +{ +#ifndef WITH_OPENIMAGEDENOISE + path_trace_device_->set_error("Build without OpenImageDenoiser"); + return nullptr; +#else + if (!openimagedenoise_supported()) { + path_trace_device_->set_error( + "OpenImageDenoiser is not supported on this CPU: missing SSE 4.1 support"); + return nullptr; + } + + return Denoiser::ensure_denoiser_device(progress); +#endif +} + CCL_NAMESPACE_END |