Fix T101651: Cycles crashes when failing to initialize render device
The issue here was that PathTraceWork was set up before checking if any error occurred, and it didn't account for the dummy device so it called a non-implemented function. This fix therefore avoids creating PathTraceWork for dummy devices and checks for device creation errors earlier in the process.
This commit is contained in:
parent
7d7318f6c5
commit
95aac5df73
|
@ -43,8 +43,11 @@ PathTrace::PathTrace(Device *device,
|
|||
/* Create path tracing work in advance, so that it can be reused by incremental sampling as much
|
||||
* as possible. */
|
||||
device_->foreach_device([&](Device *path_trace_device) {
|
||||
path_trace_works_.emplace_back(PathTraceWork::create(
|
||||
path_trace_device, film, device_scene, &render_cancel_.is_requested));
|
||||
unique_ptr<PathTraceWork> work = PathTraceWork::create(
|
||||
path_trace_device, film, device_scene, &render_cancel_.is_requested);
|
||||
if (work) {
|
||||
path_trace_works_.emplace_back(std::move(work));
|
||||
}
|
||||
});
|
||||
|
||||
work_balance_infos_.resize(path_trace_works_.size());
|
||||
|
|
|
@ -23,6 +23,10 @@ unique_ptr<PathTraceWork> PathTraceWork::create(Device *device,
|
|||
if (device->info.type == DEVICE_CPU) {
|
||||
return make_unique<PathTraceWorkCPU>(device, film, device_scene, cancel_requested_flag);
|
||||
}
|
||||
if (device->info.type == DEVICE_DUMMY) {
|
||||
/* Dummy devices can't perform any work. */
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return make_unique<PathTraceWorkGPU>(device, film, device_scene, cancel_requested_flag);
|
||||
}
|
||||
|
|
|
@ -17,6 +17,9 @@ void work_balance_do_initial(vector<WorkBalanceInfo> &work_balance_infos)
|
|||
work_balance_infos[0].weight = 1.0;
|
||||
return;
|
||||
}
|
||||
else if (num_infos == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* There is no statistics available, so start with an equal distribution. */
|
||||
const double weight = 1.0 / num_infos;
|
||||
|
|
|
@ -43,6 +43,10 @@ Session::Session(const SessionParams ¶ms_, const SceneParams &scene_params)
|
|||
|
||||
device = Device::create(params.device, stats, profiler);
|
||||
|
||||
if (device->have_error()) {
|
||||
progress.set_error(device->error_message());
|
||||
}
|
||||
|
||||
scene = new Scene(scene_params, device);
|
||||
|
||||
/* Configure path tracer. */
|
||||
|
|
Loading…
Reference in New Issue