diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-09-09 13:27:51 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-09-13 14:46:49 +0300 |
commit | 0de69e56b43f194d3d79ad28c3cd6e49e88aa8d2 (patch) | |
tree | 9841a5136a8fceed9c971a1c5db3c3f5529659e0 /intern/cycles/render/svm.h | |
parent | f38f7874488de876410e1bb4acf67a4629ba2b82 (diff) |
Cycles: Implement threaded SVM nodes compilation
The title says it all actually. From tests with barber shop scene here
gives 2-3x speedup for shader compilation on my oldie i7 machine. The
gain is mainly due to textures metadata query from jpeg files (which
seems to requite de-compression before metadata can be read). But in
theory could give nice improvements for scenes with huge node trees
as well (i'm talking about node trees of complexity of fractal which
we had reports about in the past).
Reviewers: juicyfruit, dingto, lukasstockner97, brecht
Reviewed By: brecht
Subscribers: monio, Blendify
Differential Revision: https://developer.blender.org/D2215
Diffstat (limited to 'intern/cycles/render/svm.h')
-rw-r--r-- | intern/cycles/render/svm.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/intern/cycles/render/svm.h b/intern/cycles/render/svm.h index 99e91ca0c3e..a501b6bc8b1 100644 --- a/intern/cycles/render/svm.h +++ b/intern/cycles/render/svm.h @@ -23,6 +23,7 @@ #include "util_set.h" #include "util_string.h" +#include "util_thread.h" CCL_NAMESPACE_BEGIN @@ -46,6 +47,15 @@ public: void device_update(Device *device, DeviceScene *dscene, Scene *scene, Progress& progress); void device_free(Device *device, DeviceScene *dscene, Scene *scene); + +protected: + /* Lock used to synchronize threaded nodes compilation. */ + thread_spin_lock nodes_lock_; + + void device_update_shader(Scene *scene, + Shader *shader, + Progress *progress, + vector<int4> *global_svm_nodes); }; /* Graph Compiler */ @@ -200,7 +210,7 @@ protected: /* compile */ void compile_type(Shader *shader, ShaderGraph *graph, ShaderType type); - vector<int4> svm_nodes; + vector<int4> current_svm_nodes; ShaderType current_type; Shader *current_shader; ShaderGraph *current_graph; |