Cycles: Improve handling of tile file error
Expose them to the interface, and stop rendering as soon as possible. Differential Revision: https://developer.blender.org/D12617
This commit is contained in:
parent
52a702468a
commit
728ae33f37
|
@ -589,6 +589,12 @@ void BlenderSession::render_frame_finish()
|
|||
|
||||
for (string_view filename : full_buffer_files_) {
|
||||
session->process_full_buffer_from_disk(filename);
|
||||
if (check_and_report_session_error()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (string_view filename : full_buffer_files_) {
|
||||
path_remove(filename);
|
||||
}
|
||||
|
||||
|
@ -1036,20 +1042,27 @@ void BlenderSession::update_status_progress()
|
|||
last_progress = progress;
|
||||
}
|
||||
|
||||
if (session->progress.get_error()) {
|
||||
string error = session->progress.get_error_message();
|
||||
if (error != last_error) {
|
||||
/* TODO(sergey): Currently C++ RNA API doesn't let us to
|
||||
* use mnemonic name for the variable. Would be nice to
|
||||
* have this figured out.
|
||||
*
|
||||
* For until then, 1 << 5 means RPT_ERROR.
|
||||
*/
|
||||
b_engine.report(1 << 5, error.c_str());
|
||||
b_engine.error_set(error.c_str());
|
||||
last_error = error;
|
||||
}
|
||||
check_and_report_session_error();
|
||||
}
|
||||
|
||||
bool BlenderSession::check_and_report_session_error()
|
||||
{
|
||||
if (!session->progress.get_error()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const string error = session->progress.get_error_message();
|
||||
if (error != last_error) {
|
||||
/* TODO(sergey): Currently C++ RNA API doesn't let us to use mnemonic name for the variable.
|
||||
* Would be nice to have this figured out.
|
||||
*
|
||||
* For until then, 1 << 5 means RPT_ERROR. */
|
||||
b_engine.report(1 << 5, error.c_str());
|
||||
b_engine.error_set(error.c_str());
|
||||
last_error = error;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void BlenderSession::tag_update()
|
||||
|
|
|
@ -147,6 +147,11 @@ class BlenderSession {
|
|||
protected:
|
||||
void stamp_view_layer_metadata(Scene *scene, const string &view_layer_name);
|
||||
|
||||
/* Check whether session error happenned.
|
||||
* If so, it is reported to the render engine and true is returned.
|
||||
* Otherwise false is returned. */
|
||||
bool check_and_report_session_error();
|
||||
|
||||
void builtin_images_load();
|
||||
|
||||
/* Is used after each render layer synchronization is done with the goal
|
||||
|
|
|
@ -801,7 +801,7 @@ void PathTrace::tile_buffer_write_to_disk()
|
|||
}
|
||||
|
||||
if (!tile_manager_.write_tile(*buffers)) {
|
||||
LOG(ERROR) << "Error writing tile to file.";
|
||||
device_->set_error("Error writing tile to file");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -894,7 +894,14 @@ void PathTrace::process_full_buffer_from_disk(string_view filename)
|
|||
|
||||
DenoiseParams denoise_params;
|
||||
if (!tile_manager_.read_full_buffer_from_disk(filename, &full_frame_buffers, &denoise_params)) {
|
||||
LOG(ERROR) << "Error reading tiles from file.";
|
||||
const string error_message = "Error reading tiles from file";
|
||||
if (progress_) {
|
||||
progress_->set_error(error_message);
|
||||
progress_->set_cancel(error_message);
|
||||
}
|
||||
else {
|
||||
LOG(ERROR) << error_message;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -436,7 +436,12 @@ bool TileManager::open_tile_output()
|
|||
return false;
|
||||
}
|
||||
|
||||
write_state_.tile_out->open(write_state_.filename, write_state_.image_spec);
|
||||
if (!write_state_.tile_out->open(write_state_.filename, write_state_.image_spec)) {
|
||||
LOG(ERROR) << "Error opening tile file: " << write_state_.tile_out->geterror();
|
||||
write_state_.tile_out = nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
write_state_.num_tiles_written = 0;
|
||||
|
||||
VLOG(3) << "Opened tile file " << write_state_.filename;
|
||||
|
@ -497,6 +502,7 @@ bool TileManager::write_tile(const RenderBuffers &tile_buffers)
|
|||
TypeDesc::FLOAT,
|
||||
pixels)) {
|
||||
LOG(ERROR) << "Error writing tile " << write_state_.tile_out->geterror();
|
||||
return false;
|
||||
}
|
||||
|
||||
++write_state_.num_tiles_written;
|
||||
|
|
Loading…
Reference in New Issue