[Bf-blender-cvs] [ca6f53d] master: Cycles: tweak some folding tests to avoid unnecessary type conversion.

Alexander Gavrilov noreply at git.blender.org
Tue Aug 2 11:10:40 CEST 2016


Commit: ca6f53d15ea9273eb396f7b2c0d1b611ce6b7d0a
Author: Alexander Gavrilov
Date:   Tue Aug 2 12:08:04 2016 +0300
Branches: master
https://developer.blender.org/rBca6f53d15ea9273eb396f7b2c0d1b611ce6b7d0a

Cycles: tweak some folding tests to avoid unnecessary type conversion.

It's easy to connect a simple value to output without forcing
conversion to color by using the Strength socket of Emission.

===================================================================

M	intern/cycles/test/render_graph_finalize_test.cpp

===================================================================

diff --git a/intern/cycles/test/render_graph_finalize_test.cpp b/intern/cycles/test/render_graph_finalize_test.cpp
index e329384..cf4083c 100644
--- a/intern/cycles/test/render_graph_finalize_test.cpp
+++ b/intern/cycles/test/render_graph_finalize_test.cpp
@@ -140,6 +140,14 @@ public:
 			.output_closure("EmissionNode::Emission");
 	}
 
+	ShaderGraphBuilder& output_value(const string& from)
+	{
+		return (*this)
+			.add_node(ShaderNodeBuilder<EmissionNode>("EmissionNode"))
+			.add_connection(from, "EmissionNode::Strength")
+			.output_closure("EmissionNode::Emission");
+	}
+
 protected:
 	ShaderGraph *graph_;
 	map<string, ShaderNode *> node_map_;
@@ -955,7 +963,7 @@ TEST(render_graph, constant_fold_math)
 		          .set(&MathNode::use_clamp, false)
 		          .set("Value1", 0.7f)
 		          .set("Value2", 0.9f))
-		.output_color("Math::Value");
+		.output_value("Math::Value");
 
 	graph.finalize(&scene);
 }
@@ -976,7 +984,7 @@ TEST(render_graph, constant_fold_math_clamp)
 		          .set(&MathNode::use_clamp, true)
 		          .set("Value1", 0.7f)
 		          .set("Value2", 0.9f))
-		.output_color("Math::Value");
+		.output_value("Math::Value");
 
 	graph.finalize(&scene);
 }
@@ -1007,7 +1015,7 @@ static void build_math_partial_test_graph(ShaderGraphBuilder &builder, NodeMath
 		          .set(&MathNode::use_clamp, true))
 		.add_connection("Math_Cx::Value", "Out::Value1")
 		.add_connection("Math_xC::Value", "Out::Value2")
-		.output_color("Out::Value");
+		.output_value("Out::Value");
 }
 
 /*




More information about the Bf-blender-cvs mailing list