Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2015-05-09 17:22:16 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2015-05-09 17:22:16 +0300
commit6fc166967989072bda085ae4cf54fc513f6f1daf (patch)
treefa5e0d9f33200fce7b16e6de5528ff8bf790a45e /intern/cycles/render
parent17c95d0a96e306b2f38ff6e489064d6f021e494c (diff)
Cycles: Initial work towards selective nodes support compilation
The goal is to be able to compile kernel with nodes which are actually needed to render current scene, hence improving performance of the kernel, The idea is: - Have few node groups, starting with a group which contains nodes are used really often, and then couple of groups which will be extension of this one. - Have feature-based nodes disabling, so it's possible to disable nodes related to features which are not used with the currently used nodes group. This commit only lays down needed routines for this approach, actual split will happen later after gathering statistics from bunch of production scenes.
Diffstat (limited to 'intern/cycles/render')
-rw-r--r--intern/cycles/render/graph.h18
-rw-r--r--intern/cycles/render/nodes.h1
-rw-r--r--intern/cycles/render/shader.cpp19
-rw-r--r--intern/cycles/render/shader.h3
4 files changed, 41 insertions, 0 deletions
diff --git a/intern/cycles/render/graph.h b/intern/cycles/render/graph.h
index 6744804ef19..e6271009999 100644
--- a/intern/cycles/render/graph.h
+++ b/intern/cycles/render/graph.h
@@ -207,6 +207,24 @@ public:
ShaderBump bump; /* for bump mapping utility */
ShaderNodeSpecialType special_type; /* special node type */
+
+ /* ** Selective nodes compilation ** */
+
+ /* TODO(sergey): More explicitly mention in the function names
+ * that those functions are for selective compilation only?
+ */
+
+ /* Nodes are split into several groups, group of level 0 contains
+ * nodes which are most commonly used, further levels are extension
+ * of previous one and includes less commonly used nodes.
+ */
+ virtual int get_group() { return NODE_GROUP_LEVEL_0; }
+
+ /* Node feature are used to disable huge nodes inside the group,
+ * so it's possible to disable huge nodes inside of the required
+ * nodes group.
+ */
+ virtual int get_feature() { return 0; }
};
diff --git a/intern/cycles/render/nodes.h b/intern/cycles/render/nodes.h
index 686fb5e2fd7..ac7bbaf3547 100644
--- a/intern/cycles/render/nodes.h
+++ b/intern/cycles/render/nodes.h
@@ -415,6 +415,7 @@ public:
void attributes(Shader *shader, AttributeRequestSet *attributes);
bool has_spatial_varying() { return true; }
+ virtual int get_feature() { return NODE_FEATURE_HAIR; }
};
class ValueNode : public ShaderNode {
diff --git a/intern/cycles/render/shader.cpp b/intern/cycles/render/shader.cpp
index 971cd5097de..2eaba3fa786 100644
--- a/intern/cycles/render/shader.cpp
+++ b/intern/cycles/render/shader.cpp
@@ -480,5 +480,24 @@ void ShaderManager::add_default(Scene *scene)
}
}
+void ShaderManager::get_requested_features(Scene *scene, int& max_group, int& features)
+{
+ max_group = NODE_GROUP_LEVEL_0;
+ features = 0;
+ for(int i = 0; i < scene->shaders.size(); i++) {
+ Shader *shader = scene->shaders[i];
+ foreach(ShaderNode *node, shader->graph->nodes) {
+ max_group = min(max_group, node->get_group());
+ features |= node->get_feature();
+ if(node->special_type == SHADER_SPECIAL_TYPE_CLOSURE) {
+ BsdfNode *bsdf_node = static_cast<BsdfNode*>(node);
+ if(CLOSURE_IS_VOLUME(bsdf_node->closure)) {
+ features |= NODE_FEATURE_VOLUME;
+ }
+ }
+ }
+ }
+}
+
CCL_NAMESPACE_END
diff --git a/intern/cycles/render/shader.h b/intern/cycles/render/shader.h
index 5bcb2c4e344..27b239601d0 100644
--- a/intern/cycles/render/shader.h
+++ b/intern/cycles/render/shader.h
@@ -165,6 +165,9 @@ public:
* have any shader assigned explicitly */
static void add_default(Scene *scene);
+ /* Selective nodes compilation. */
+ void get_requested_features(Scene *scene, int& max_group, int& features);
+
protected:
ShaderManager();