Fix: Cycles crash when using denoising in build without OIDN
We could try to prevent these parameters to be set earlier in Blender sync, but I think it's better to handle for all integrations. Pull Request: https://projects.blender.org/blender/blender/pulls/132477
This commit is contained in:
committed by
Brecht Van Lommel
parent
f301952b6a
commit
56b7d43887
@@ -163,6 +163,10 @@ unique_ptr<Denoiser> Denoiser::create(Device *denoiser_device,
|
||||
#endif
|
||||
}
|
||||
|
||||
if (!openimagedenoise_supported()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/* Used preference CPU when possible, and fallback on CPU fallback device otherwise. */
|
||||
return make_unique<OIDNDenoiser>(is_cpu_denoiser_device ? single_denoiser_device :
|
||||
cpu_fallback_device,
|
||||
|
||||
@@ -540,17 +540,21 @@ void PathTrace::set_denoiser_params(const DenoiseParams ¶ms)
|
||||
denoiser_ = Denoiser::create(
|
||||
effective_denoise_device, cpu_fallback_device, effective_denoise_params);
|
||||
|
||||
/* Only take into account the "immediate" cancel to have interactive rendering responding to
|
||||
* navigation as quickly as possible, but allow to run denoiser after user hit Escape key while
|
||||
* doing offline rendering. */
|
||||
denoiser_->is_cancelled_cb = [this]() { return render_cancel_.is_requested; };
|
||||
if (denoiser_) {
|
||||
/* Only take into account the "immediate" cancel to have interactive rendering responding to
|
||||
* navigation as quickly as possible, but allow to run denoiser after user hit Escape key
|
||||
* while doing offline rendering. */
|
||||
denoiser_->is_cancelled_cb = [this]() { return render_cancel_.is_requested; };
|
||||
}
|
||||
}
|
||||
|
||||
/* Use actual parameters, if available */
|
||||
if (denoise_device_)
|
||||
if (denoise_device_ && denoiser_) {
|
||||
render_scheduler_.set_denoiser_params(denoiser_->get_params());
|
||||
else
|
||||
}
|
||||
else {
|
||||
render_scheduler_.set_denoiser_params(effective_denoise_params);
|
||||
}
|
||||
}
|
||||
|
||||
void PathTrace::set_adaptive_sampling(const AdaptiveSampling &adaptive_sampling)
|
||||
@@ -1041,7 +1045,7 @@ void PathTrace::process_full_buffer_from_disk(string_view filename)
|
||||
|
||||
render_state_.has_denoised_result = false;
|
||||
|
||||
if (denoise_params.use) {
|
||||
if (denoise_params.use && denoiser_) {
|
||||
progress_set_status(layer_view_name, "Denoising");
|
||||
|
||||
/* If GPU should be used is not based on file metadata. */
|
||||
|
||||
@@ -614,7 +614,9 @@ DenoiserPipeline::DenoiserPipeline(DeviceInfo &denoiser_device_info, const Denoi
|
||||
cpu_device = device_cpu_create(cpu_devices[0], device->stats, device->profiler, true);
|
||||
|
||||
denoiser = Denoiser::create(device, cpu_device, params);
|
||||
denoiser->load_kernels(nullptr);
|
||||
if (denoiser) {
|
||||
denoiser->load_kernels(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
DenoiserPipeline::~DenoiserPipeline()
|
||||
@@ -630,6 +632,11 @@ bool DenoiserPipeline::run()
|
||||
|
||||
int num_frames = output.size();
|
||||
|
||||
if (!denoiser) {
|
||||
error = "Failed to create denoiser";
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int frame = 0; frame < num_frames; frame++) {
|
||||
/* Skip empty output paths. */
|
||||
if (output[frame].empty()) {
|
||||
|
||||
Reference in New Issue
Block a user