Report more uniform progress when rendering on GPU

This commit is contained in:
2018-08-08 11:24:29 +02:00
parent b216fcb8cb
commit f8d385c99f
2 changed files with 26 additions and 3 deletions

View File

@@ -58,11 +58,11 @@ def benchmarkBlenderWatched(command):
else:
logger.DEBUG("Line from stdout: {}" . format(line))
st.update(line)
if st.current_tiles != 0:
if st.current_tiles != 0 or st.current_sample != None:
elapsed_time = time.time() - start_time
elapsed_time_str = util.humanReadableTimeDifference(elapsed_time)
progress.progress(st.current_tiles,
st.total_tiles,
progress.progress(int(st.getCurrentProgress()),
100,
prefix="Path Tracing Tiles {}" .
format(elapsed_time_str))

View File

@@ -28,15 +28,25 @@ class Stats:
self.device_memory_usage = "N/A"
# Current stats.
self.path_tracing = ""
self.current_tiles = 0
self.total_tiles = 0
self.current_sample = None
self.total_samples = None
def update(self, line):
# Current tile progress.
match = self.re_path_tracing.match(line)
if match:
self.path_tracing = match.group(1)
self.current_tiles = int(match.group(2))
self.total_tiles = int(match.group(3))
self.current_sample = match.group(6)
if self.current_sample is not None:
self.current_sample = int(self.current_sample)
self.total_samples = match.group(7)
if self.total_samples is not None:
self.total_samples = int(self.total_samples)
# Total render time.
match = self.re_total_render_time.match(line)
if match:
@@ -62,6 +72,19 @@ class Stats:
mem > self.device_peak_memory:
self.device_peak_memory = mem
def getCurrentProgress(self):
if self.total_tiles == 0:
return 0
if not self.total_samples:
return float(self.current_tiles) / float(self.total_tiles) * 100
current_tile = self.current_tiles
# Workaround for current master.
if self.total_samples == self.current_sample:
current_tile = max(current_tile - 1, 0)
total_samples = self.total_tiles * self.total_samples
current_sample = current_tile * self.total_samples + self.current_sample
return float(current_sample) / float(total_samples) * 100
def print(self):
# TODO(sergey): Check that all stats are available.
print("Total pipeline render time: {} ({} sec)"