Cycles: Fix crash using OptiX denoiser with unsupported device selected
Fixes an issue where Blender would crash if the OptiX denoiser was selected, but an unsupported GPU device (E.g. Intel GPU) was selected in preferences. This crash would occur because Cycles uses the device in preferences to setup the denoiser, and there was no check stopping an unsupported GPU from being used to try and setup and run the denoiser. Pull Request: https://projects.blender.org/blender/blender/pulls/124001
This commit is contained in:
parent
3f6d9fa00d
commit
4961b93136
@ -1695,6 +1695,7 @@ class CyclesPreferences(bpy.types.AddonPreferences):
|
||||
import _cycles
|
||||
compute_device_type = self.get_compute_device_type()
|
||||
|
||||
if compute_device_type == 'OPTIX':
|
||||
# We need any OptiX devices, used for rendering
|
||||
for device in _cycles.available_devices(compute_device_type):
|
||||
device_type = device[1]
|
||||
|
@ -97,7 +97,9 @@ unique_ptr<Denoiser> Denoiser::create(Device *denoiser_device,
|
||||
bool is_cpu_denoiser_device = single_denoiser_device->info.type == DEVICE_CPU;
|
||||
if (is_cpu_denoiser_device == false) {
|
||||
#ifdef WITH_OPTIX
|
||||
if (params.type == DENOISER_OPTIX) {
|
||||
if (params.type == DENOISER_OPTIX &&
|
||||
OptiXDenoiser::is_device_supported(single_denoiser_device->info))
|
||||
{
|
||||
return make_unique<OptiXDenoiser>(single_denoiser_device, params);
|
||||
}
|
||||
#endif
|
||||
|
@ -219,6 +219,14 @@ uint OptiXDenoiser::get_device_type_mask() const
|
||||
return DEVICE_MASK_OPTIX;
|
||||
}
|
||||
|
||||
bool OptiXDenoiser::is_device_supported(const DeviceInfo &device)
|
||||
{
|
||||
if (device.type == DEVICE_OPTIX) {
|
||||
return device.denoisers & DENOISER_OPTIX;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool OptiXDenoiser::denoise_buffer(const DenoiseTask &task)
|
||||
{
|
||||
OptiXDevice *const optix_device = static_cast<OptiXDevice *>(denoiser_device_);
|
||||
|
@ -18,6 +18,8 @@ class OptiXDenoiser : public DenoiserGPU {
|
||||
OptiXDenoiser(Device *denoiser_device, const DenoiseParams ¶ms);
|
||||
~OptiXDenoiser();
|
||||
|
||||
static bool is_device_supported(const DeviceInfo &device);
|
||||
|
||||
protected:
|
||||
virtual uint get_device_type_mask() const override;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user