Cycles: Ignore preprocessing time in ETA calculation
This patch makes Cycles ignore the time spent in BVH construction etc. when estimating the remaining time. Considering that the remaining time is calculated based on the average time per tile so far, as far as I understand it makes no sense to include the preprocessing time. Reviewers: sergey, #cycles Reviewed By: sergey, #cycles Subscribers: sergey Projects: #cycles Differential Revision: https://developer.blender.org/D895
This commit is contained in:
parent
0d6e88b446
commit
193871ae7d
@ -778,19 +778,23 @@ void BlenderSession::get_status(string& status, string& substatus)
|
||||
session->progress.get_status(status, substatus);
|
||||
}
|
||||
|
||||
void BlenderSession::get_progress(float& progress, double& total_time)
|
||||
void BlenderSession::get_progress(float& progress, double& total_time, double& render_time)
|
||||
{
|
||||
double tile_time;
|
||||
int tile, sample, samples_per_tile;
|
||||
int tile_total = session->tile_manager.state.num_tiles;
|
||||
int samples = session->tile_manager.state.sample + 1;
|
||||
int total_samples = session->tile_manager.num_samples;
|
||||
|
||||
session->progress.get_tile(tile, total_time, tile_time);
|
||||
session->progress.get_tile(tile, total_time, render_time, tile_time);
|
||||
|
||||
sample = session->progress.get_sample();
|
||||
samples_per_tile = session->tile_manager.num_samples;
|
||||
|
||||
if(samples_per_tile && tile_total)
|
||||
if(background && samples_per_tile && tile_total)
|
||||
progress = ((float)sample / (float)(tile_total * samples_per_tile));
|
||||
else if(!background && samples > 0 && total_samples != USHRT_MAX)
|
||||
progress = ((double)samples) / total_samples;
|
||||
else
|
||||
progress = 0.0;
|
||||
}
|
||||
@ -820,20 +824,18 @@ void BlenderSession::update_status_progress()
|
||||
string timestatus, status, substatus;
|
||||
string scene = "";
|
||||
float progress;
|
||||
double total_time, remaining_time = 0;
|
||||
double total_time, remaining_time = 0, render_time;
|
||||
char time_str[128];
|
||||
float mem_used = (float)session->stats.mem_used / 1024.0f / 1024.0f;
|
||||
float mem_peak = (float)session->stats.mem_peak / 1024.0f / 1024.0f;
|
||||
int samples = session->tile_manager.state.sample + 1;
|
||||
int total_samples = session->tile_manager.num_samples;
|
||||
|
||||
get_status(status, substatus);
|
||||
get_progress(progress, total_time);
|
||||
get_progress(progress, total_time, render_time);
|
||||
|
||||
if(progress > 0)
|
||||
remaining_time = (1.0 - (double)progress) * (render_time / (double)progress);
|
||||
|
||||
if(background) {
|
||||
if(progress > 0)
|
||||
remaining_time = (1.0 - (double)progress) * (total_time / (double)progress);
|
||||
|
||||
scene += " | " + b_scene.name();
|
||||
if(b_rlay_name != "")
|
||||
scene += ", " + b_rlay_name;
|
||||
@ -841,9 +843,6 @@ void BlenderSession::update_status_progress()
|
||||
else {
|
||||
BLI_timestr(total_time, time_str, sizeof(time_str));
|
||||
timestatus = "Time:" + string(time_str) + " | ";
|
||||
|
||||
if(samples > 0 && total_samples != USHRT_MAX)
|
||||
remaining_time = (total_samples - samples) * (total_time / samples);
|
||||
}
|
||||
|
||||
if(remaining_time > 0) {
|
||||
|
@ -70,7 +70,7 @@ public:
|
||||
void tag_redraw();
|
||||
void tag_update();
|
||||
void get_status(string& status, string& substatus);
|
||||
void get_progress(float& progress, double& total_time);
|
||||
void get_progress(float& progress, double& total_time, double& render_time);
|
||||
void test_cancel();
|
||||
void update_status_progress();
|
||||
void update_bake_progress();
|
||||
|
@ -199,8 +199,7 @@ void Session::run_gpu()
|
||||
paused_time = 0.0;
|
||||
last_update_time = time_dt();
|
||||
|
||||
if(!params.background)
|
||||
progress.set_start_time(start_time + paused_time);
|
||||
progress.set_render_start_time(start_time + paused_time);
|
||||
|
||||
while(!progress.get_cancel()) {
|
||||
/* advance to next tile */
|
||||
@ -233,6 +232,7 @@ void Session::run_gpu()
|
||||
|
||||
if(!params.background)
|
||||
progress.set_start_time(start_time + paused_time);
|
||||
progress.set_render_start_time(start_time + paused_time);
|
||||
|
||||
update_status_time(pause, no_tiles);
|
||||
progress.set_update();
|
||||
@ -517,6 +517,7 @@ void Session::run_cpu()
|
||||
|
||||
if(!params.background)
|
||||
progress.set_start_time(start_time + paused_time);
|
||||
progress.set_render_start_time(start_time + paused_time);
|
||||
|
||||
update_status_time(pause, no_tiles);
|
||||
progress.set_update();
|
||||
@ -665,7 +666,8 @@ void Session::reset_(BufferParams& buffer_params, int samples)
|
||||
paused_time = 0.0;
|
||||
|
||||
if(!params.background)
|
||||
progress.set_start_time(start_time + paused_time);
|
||||
progress.set_start_time(start_time);
|
||||
progress.set_render_start_time(start_time);
|
||||
}
|
||||
|
||||
void Session::reset(BufferParams& buffer_params, int samples)
|
||||
|
@ -61,7 +61,7 @@ public:
|
||||
thread_scoped_lock lock(progress.progress_mutex);
|
||||
|
||||
progress.get_status(status, substatus);
|
||||
progress.get_tile(tile, total_time, tile_time);
|
||||
progress.get_tile(tile, total_time, render_time, tile_time);
|
||||
|
||||
sample = progress.get_sample();
|
||||
|
||||
@ -73,7 +73,9 @@ public:
|
||||
tile = 0;
|
||||
sample = 0;
|
||||
start_time = time_dt();
|
||||
render_start_time = time_dt();
|
||||
total_time = 0.0f;
|
||||
render_time = 0.0f;
|
||||
tile_time = 0.0f;
|
||||
status = "Initializing";
|
||||
substatus = "";
|
||||
@ -143,21 +145,30 @@ public:
|
||||
start_time = start_time_;
|
||||
}
|
||||
|
||||
void set_render_start_time(double render_start_time_)
|
||||
{
|
||||
thread_scoped_lock lock(progress_mutex);
|
||||
|
||||
render_start_time = render_start_time_;
|
||||
}
|
||||
|
||||
void set_tile(int tile_, double tile_time_)
|
||||
{
|
||||
thread_scoped_lock lock(progress_mutex);
|
||||
|
||||
tile = tile_;
|
||||
total_time = time_dt() - start_time;
|
||||
render_time = time_dt() - render_start_time;
|
||||
tile_time = tile_time_;
|
||||
}
|
||||
|
||||
void get_tile(int& tile_, double& total_time_, double& tile_time_)
|
||||
void get_tile(int& tile_, double& total_time_, double& render_time_, double& tile_time_)
|
||||
{
|
||||
thread_scoped_lock lock(progress_mutex);
|
||||
|
||||
tile_ = tile;
|
||||
total_time_ = (total_time > 0.0)? total_time: 0.0;
|
||||
render_time_ = (render_time > 0.0)? render_time: 0.0;
|
||||
tile_time_ = tile_time;
|
||||
}
|
||||
|
||||
@ -195,6 +206,7 @@ public:
|
||||
status = status_;
|
||||
substatus = substatus_;
|
||||
total_time = time_dt() - start_time;
|
||||
render_time = time_dt() - render_start_time;
|
||||
}
|
||||
|
||||
set_update();
|
||||
@ -206,6 +218,7 @@ public:
|
||||
thread_scoped_lock lock(progress_mutex);
|
||||
substatus = substatus_;
|
||||
total_time = time_dt() - start_time;
|
||||
render_time = time_dt() - render_start_time;
|
||||
}
|
||||
|
||||
set_update();
|
||||
@ -218,6 +231,7 @@ public:
|
||||
sync_status = status_;
|
||||
sync_substatus = substatus_;
|
||||
total_time = time_dt() - start_time;
|
||||
render_time = time_dt() - render_start_time;
|
||||
}
|
||||
|
||||
set_update();
|
||||
@ -230,6 +244,7 @@ public:
|
||||
thread_scoped_lock lock(progress_mutex);
|
||||
sync_substatus = substatus_;
|
||||
total_time = time_dt() - start_time;
|
||||
render_time = time_dt() - render_start_time;
|
||||
}
|
||||
|
||||
set_update();
|
||||
@ -273,8 +288,8 @@ protected:
|
||||
int tile; /* counter for rendered tiles */
|
||||
int sample; /* counter of rendered samples, global for all tiles */
|
||||
|
||||
double start_time;
|
||||
double total_time;
|
||||
double start_time, render_start_time;
|
||||
double total_time, render_time;
|
||||
double tile_time;
|
||||
|
||||
string status;
|
||||
|
Loading…
Reference in New Issue
Block a user