Fix T93125: Cycles wrong remaining render time with high number of samples
Avoid integer overflow.
This commit is contained in:
parent
7293c1b357
commit
cfd0e96e47
Notes:
blender-bot
2023-02-14 04:10:15 +01:00
Referenced by issue #93125, Cycles: The "Remaining Time" is kinda wonky if launched via CLI
|
@ -129,7 +129,7 @@ void BlenderSession::create_session()
|
|||
/* reset status/progress */
|
||||
last_status = "";
|
||||
last_error = "";
|
||||
last_progress = -1.0f;
|
||||
last_progress = -1.0;
|
||||
start_resize_time = 0.0;
|
||||
|
||||
/* create session */
|
||||
|
@ -854,7 +854,7 @@ void BlenderSession::get_status(string &status, string &substatus)
|
|||
session->progress.get_status(status, substatus);
|
||||
}
|
||||
|
||||
void BlenderSession::get_progress(float &progress, double &total_time, double &render_time)
|
||||
void BlenderSession::get_progress(double &progress, double &total_time, double &render_time)
|
||||
{
|
||||
session->progress.get_time(total_time, render_time);
|
||||
progress = session->progress.get_progress();
|
||||
|
@ -862,7 +862,7 @@ void BlenderSession::get_progress(float &progress, double &total_time, double &r
|
|||
|
||||
void BlenderSession::update_bake_progress()
|
||||
{
|
||||
float progress = session->progress.get_progress();
|
||||
double progress = session->progress.get_progress();
|
||||
|
||||
if (progress != last_progress) {
|
||||
b_engine.update_progress(progress);
|
||||
|
@ -874,7 +874,7 @@ void BlenderSession::update_status_progress()
|
|||
{
|
||||
string timestatus, status, substatus;
|
||||
string scene_status = "";
|
||||
float progress;
|
||||
double progress;
|
||||
double total_time, remaining_time = 0, render_time;
|
||||
float mem_used = (float)session->stats.mem_used / 1024.0f / 1024.0f;
|
||||
float mem_peak = (float)session->stats.mem_peak / 1024.0f / 1024.0f;
|
||||
|
|
|
@ -82,7 +82,7 @@ class BlenderSession {
|
|||
void tag_redraw();
|
||||
void tag_update();
|
||||
void get_status(string &status, string &substatus);
|
||||
void get_progress(float &progress, double &total_time, double &render_time);
|
||||
void get_progress(double &progress, double &total_time, double &render_time);
|
||||
void test_cancel();
|
||||
void update_status_progress();
|
||||
void update_bake_progress();
|
||||
|
@ -108,7 +108,7 @@ class BlenderSession {
|
|||
|
||||
string last_status;
|
||||
string last_error;
|
||||
float last_progress;
|
||||
double last_progress;
|
||||
double last_status_time;
|
||||
|
||||
int width, height;
|
||||
|
|
|
@ -847,7 +847,8 @@ void PathTrace::progress_update_if_needed(const RenderWork &render_work)
|
|||
{
|
||||
if (progress_ != nullptr) {
|
||||
const int2 tile_size = get_render_tile_size();
|
||||
const int num_samples_added = tile_size.x * tile_size.y * render_work.path_trace.num_samples;
|
||||
const uint64_t num_samples_added = uint64_t(tile_size.x) * tile_size.y *
|
||||
render_work.path_trace.num_samples;
|
||||
const int current_sample = render_work.path_trace.start_sample +
|
||||
render_work.path_trace.num_samples;
|
||||
progress_->add_samples(num_samples_added, current_sample);
|
||||
|
|
|
@ -504,7 +504,7 @@ void Session::set_display_driver(unique_ptr<DisplayDriver> driver)
|
|||
|
||||
double Session::get_estimated_remaining_time() const
|
||||
{
|
||||
const float completed = progress.get_progress();
|
||||
const double completed = progress.get_progress();
|
||||
if (completed == 0.0f) {
|
||||
return 0.0;
|
||||
}
|
||||
|
@ -573,7 +573,7 @@ void Session::update_status_time(bool show_pause, bool show_done)
|
|||
}
|
||||
|
||||
/* Sample. */
|
||||
if (num_samples == Integrator::MAX_SAMPLES) {
|
||||
if (!params.background && num_samples == Integrator::MAX_SAMPLES) {
|
||||
substatus = status_append(substatus, string_printf("Sample %d", current_sample));
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -200,12 +200,12 @@ class Progress {
|
|||
total_pixel_samples = total_pixel_samples_;
|
||||
}
|
||||
|
||||
float get_progress() const
|
||||
double get_progress() const
|
||||
{
|
||||
thread_scoped_lock lock(progress_mutex);
|
||||
|
||||
if (total_pixel_samples > 0) {
|
||||
return ((float)pixel_samples) / total_pixel_samples;
|
||||
return ((double)pixel_samples) / (double)total_pixel_samples;
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue