diff options
Diffstat (limited to 'intern/cycles/render/graph.h')
-rw-r--r-- | intern/cycles/render/graph.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/intern/cycles/render/graph.h b/intern/cycles/render/graph.h index 6ad40720d4c..17fb75d459f 100644 --- a/intern/cycles/render/graph.h +++ b/intern/cycles/render/graph.h @@ -197,7 +197,15 @@ public: virtual void attributes(Shader *shader, AttributeRequestSet *attributes); virtual void compile(SVMCompiler& compiler) = 0; virtual void compile(OSLCompiler& compiler) = 0; - virtual void optimize(Scene * /*scene*/) {}; + + /* ** Node optimization ** */ + /* Check whether the node can be replaced with single constant. */ + virtual bool constant_fold(ShaderOutput * /*socket*/, float3 * /*optimized_value*/) { return false; } + + /* Simplify settings used by artists to the ones which are simpler to + * evaluate in the kernel but keep the final result unchanged. + */ + virtual void simplify_settings(Scene * /*scene*/) {}; virtual bool has_surface_emission() { return false; } virtual bool has_surface_transparent() { return false; } @@ -307,7 +315,8 @@ protected: void break_cycles(ShaderNode *node, vector<bool>& visited, vector<bool>& on_stack); void clean(Scene *scene); - void simplify_nodes(Scene *scene); + void simplify_settings(Scene *scene); + void constant_fold(set<ShaderNode*>& visited, ShaderNode *node); void bump_from_displacement(); void refine_bump_nodes(); void default_inputs(bool do_osl); |