diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2014-07-23 01:41:01 +0400 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2014-07-25 18:42:53 +0400 |
commit | fc55c41bba8121bf3db67280c26e840f8b3f4124 (patch) | |
tree | 181abfb43fbbdf84b85206ddc1c2de7635a0dbaf /intern/cycles/device/device_task.cpp | |
parent | 2e50b4dc511567a3dfb280e30b5606873fc62d31 (diff) |
Cycles Bake: show progress bar during bake
Baking progress preview is not possible, in parts due to the way the API
was designed. But at least you get to see the progress bar while baking.
Reviewers: sergey
Differential Revision: https://developer.blender.org/D656
Diffstat (limited to 'intern/cycles/device/device_task.cpp')
-rw-r--r-- | intern/cycles/device/device_task.cpp | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/intern/cycles/device/device_task.cpp b/intern/cycles/device/device_task.cpp index f436b54df68..dc124f8cf37 100644 --- a/intern/cycles/device/device_task.cpp +++ b/intern/cycles/device/device_task.cpp @@ -35,7 +35,7 @@ DeviceTask::DeviceTask(Type type_) last_update_time = time_dt(); } -void DeviceTask::split(list<DeviceTask>& tasks, int num, int max_size) +int DeviceTask::get_subtask_count(int num, int max_size) { if(max_size != 0) { int max_size_num; @@ -53,7 +53,21 @@ void DeviceTask::split(list<DeviceTask>& tasks, int num, int max_size) if(type == SHADER) { num = min(shader_w, num); + } + else if(type == PATH_TRACE) { + } + else { + num = min(h, num); + } + return num; +} + +void DeviceTask::split(list<DeviceTask>& tasks, int num, int max_size) +{ + num = get_subtask_count(num, max_size); + + if(type == SHADER) { for(int i = 0; i < num; i++) { int tx = shader_x + (shader_w/num)*i; int tw = (i == num-1)? shader_w - i*(shader_w/num): shader_w/num; @@ -71,8 +85,6 @@ void DeviceTask::split(list<DeviceTask>& tasks, int num, int max_size) tasks.push_back(*this); } else { - num = min(h, num); - for(int i = 0; i < num; i++) { int ty = y + (h/num)*i; int th = (i == num-1)? h - i*(h/num): h/num; @@ -87,9 +99,10 @@ void DeviceTask::split(list<DeviceTask>& tasks, int num, int max_size) } } -void DeviceTask::update_progress(RenderTile &rtile) +void DeviceTask::update_progress(RenderTile *rtile) { - if (type != PATH_TRACE) + if((type != PATH_TRACE) && + (type != SHADER)) return; if(update_progress_sample) @@ -99,7 +112,7 @@ void DeviceTask::update_progress(RenderTile &rtile) double current_time = time_dt(); if (current_time - last_update_time >= 1.0) { - update_tile_sample(rtile); + update_tile_sample(*rtile); last_update_time = current_time; } |