From 0de69e56b43f194d3d79ad28c3cd6e49e88aa8d2 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 9 Sep 2016 12:27:51 +0200 Subject: 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 --- intern/cycles/render/svm.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'intern/cycles/render/svm.h') 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 *global_svm_nodes); }; /* Graph Compiler */ @@ -200,7 +210,7 @@ protected: /* compile */ void compile_type(Shader *shader, ShaderGraph *graph, ShaderType type); - vector svm_nodes; + vector current_svm_nodes; ShaderType current_type; Shader *current_shader; ShaderGraph *current_graph; -- cgit v1.2.3