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:
authorThomas Dinges <blender@dingto.org>2015-11-25 15:52:39 +0300
committerThomas Dinges <blender@dingto.org>2015-11-25 15:57:54 +0300
commite796581655ed9a36c263a20e7ed97856fc0f1070 (patch)
tree6e946a9e683c9fb82911eb01f9380b8df1276e26 /intern/cycles/render/nodes.h
parent415b5a43690b3b823506871335281df717309f72 (diff)
Cycles: Refactor of constant fold.
* Move constant folding from nodes to the shader graph. This way it's part of our (later) 4-step optimization process. * Instead of only doing a one level constant fold, we can now do a recursive constant fold, allowing us to simplify shaders much further. Constant folding is implemented for Blackbody, Math and VectorMath nodes. Example (the highlighted nodes are removed before rendering): Before: http://archive.dingto.org/2015/blender/code/one_level_constant_fold.jpg Now: http://archive.dingto.org/2015/blender/code/multi_level_constant_fold.jpg Thanks to Sergey and Brecht for Review! Differential Revision: https://developer.blender.org/D1626
Diffstat (limited to 'intern/cycles/render/nodes.h')
-rw-r--r--intern/cycles/render/nodes.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/intern/cycles/render/nodes.h b/intern/cycles/render/nodes.h
index 4f4061286cb..259936c0b7c 100644
--- a/intern/cycles/render/nodes.h
+++ b/intern/cycles/render/nodes.h
@@ -311,7 +311,7 @@ class GlossyBsdfNode : public BsdfNode {
public:
SHADER_NODE_CLASS(GlossyBsdfNode)
- void optimize(Scene *scene);
+ void simplify_settings(Scene *scene);
bool has_integrator_dependency();
ustring distribution, distribution_orig;
@@ -322,7 +322,7 @@ class GlassBsdfNode : public BsdfNode {
public:
SHADER_NODE_CLASS(GlassBsdfNode)
- void optimize(Scene *scene);
+ void simplify_settings(Scene *scene);
bool has_integrator_dependency();
ustring distribution, distribution_orig;
@@ -333,7 +333,7 @@ class RefractionBsdfNode : public BsdfNode {
public:
SHADER_NODE_CLASS(RefractionBsdfNode)
- void optimize(Scene *scene);
+ void simplify_settings(Scene *scene);
bool has_integrator_dependency();
ustring distribution, distribution_orig;
@@ -636,6 +636,7 @@ public:
class BlackbodyNode : public ShaderNode {
public:
SHADER_NODE_CLASS(BlackbodyNode)
+ bool constant_fold(ShaderOutput *socket, float3 *optimized_value);
virtual int get_group() { return NODE_GROUP_LEVEL_3; }
};
@@ -644,6 +645,7 @@ class MathNode : public ShaderNode {
public:
SHADER_NODE_CLASS(MathNode)
virtual int get_group() { return NODE_GROUP_LEVEL_1; }
+ bool constant_fold(ShaderOutput *socket, float3 *optimized_value);
bool use_clamp;
@@ -663,6 +665,7 @@ class VectorMathNode : public ShaderNode {
public:
SHADER_NODE_CLASS(VectorMathNode)
virtual int get_group() { return NODE_GROUP_LEVEL_1; }
+ bool constant_fold(ShaderOutput *socket, float3 *optimized_value);
ustring type;
static ShaderEnum type_enum;