diff options
author | Jeroen Bakker <j.bakker@atmind.nl> | 2019-03-13 14:31:48 +0300 |
---|---|---|
committer | Jeroen Bakker <j.bakker@atmind.nl> | 2019-03-15 18:18:21 +0300 |
commit | 2f6257fd7fe305e3b226a8b505eb614bbeaf762a (patch) | |
tree | fba47f34d5bc5f10d50be92e5dd8b14fa9ecc9a9 /intern/cycles/util | |
parent | 62377431114411c50ededadf98fda284ec4061c5 (diff) |
Cycles/OpenCL: Compile Kernels During Scene Update
The main goals of this change is faster starting when using foreground
rendering.
This patch will build kernels in parallel to the update process of
the scene. When these optimized kernels are not available (yet) an AO
kernel will be used.
These AO kernels are fast to compile (3-7 seconds) and can be
reused by all scenes. When the final kernels become available we
will switch to these kernels.
In background mode the AO kernels will not be used.
Some kernels are being used during Scene update (displace, background
light). When these kernels are being used the process can halt until
these become available.
Reviewed By: brecht, #cycles
Maniphest Tasks: T61752
Differential Revision: https://developer.blender.org/D4428
Diffstat (limited to 'intern/cycles/util')
-rw-r--r-- | intern/cycles/util/util_progress.h | 23 | ||||
-rw-r--r-- | intern/cycles/util/util_task.cpp | 6 | ||||
-rw-r--r-- | intern/cycles/util/util_task.h | 1 |
3 files changed, 30 insertions, 0 deletions
diff --git a/intern/cycles/util/util_progress.h b/intern/cycles/util/util_progress.h index 4ed9ebd60ff..06900d14cdc 100644 --- a/intern/cycles/util/util_progress.h +++ b/intern/cycles/util/util_progress.h @@ -46,6 +46,7 @@ public: substatus = ""; sync_status = ""; sync_substatus = ""; + kernel_status = ""; update_cb = function_null; cancel = false; cancel_message = ""; @@ -86,6 +87,7 @@ public: substatus = ""; sync_status = ""; sync_substatus = ""; + kernel_status = ""; cancel = false; cancel_message = ""; error = false; @@ -313,6 +315,25 @@ public: } } + + /* kernel status */ + + void set_kernel_status(const string &kernel_status_) + { + { + thread_scoped_lock lock(progress_mutex); + kernel_status = kernel_status_; + } + + set_update(); + } + + void get_kernel_status(string &kernel_status_) + { + thread_scoped_lock lock(progress_mutex); + kernel_status_ = kernel_status; + } + /* callback */ void set_update() @@ -356,6 +377,8 @@ protected: string sync_status; string sync_substatus; + string kernel_status; + volatile bool cancel; string cancel_message; diff --git a/intern/cycles/util/util_task.cpp b/intern/cycles/util/util_task.cpp index 2a705c2432b..ce166af206a 100644 --- a/intern/cycles/util/util_task.cpp +++ b/intern/cycles/util/util_task.cpp @@ -148,6 +148,12 @@ bool TaskPool::canceled() return do_cancel; } +bool TaskPool::finished() +{ + thread_scoped_lock num_lock(num_mutex); + return num == 0; +} + void TaskPool::num_decrease(int done) { num_mutex.lock(); diff --git a/intern/cycles/util/util_task.h b/intern/cycles/util/util_task.h index 15f0d341be7..a7e19d1ab75 100644 --- a/intern/cycles/util/util_task.h +++ b/intern/cycles/util/util_task.h @@ -93,6 +93,7 @@ public: void wait_work(Summary *stats = NULL); /* work and wait until all tasks are done */ void cancel(); /* cancel all tasks, keep worker threads running */ void stop(); /* stop all worker threads */ + bool finished(); /* check if all work has been completed */ bool canceled(); /* for worker threads, test if canceled */ |