* Graph for testing partial folds of Vector Math with one constant argument. * Includes 2 tests: constant on each side. */
| 1190 | * Includes 2 tests: constant on each side. |
| 1191 | */ |
| 1192 | static void build_vecmath_partial_test_graph(ShaderGraphBuilder &builder, |
| 1193 | NodeVectorMathType type, |
| 1194 | const float3 constval) |
| 1195 | { |
| 1196 | builder |
| 1197 | .add_attribute("Attribute") |
| 1198 | /* constant on the left */ |
| 1199 | .add_node(ShaderNodeBuilder<VectorMathNode>(builder.graph(), "Math_Cx") |
| 1200 | .set_param("math_type", type) |
| 1201 | .set("Vector1", constval)) |
| 1202 | .add_connection("Attribute::Vector", "Math_Cx::Vector2") |
| 1203 | /* constant on the right */ |
| 1204 | .add_node(ShaderNodeBuilder<VectorMathNode>(builder.graph(), "Math_xC") |
| 1205 | .set_param("math_type", type) |
| 1206 | .set("Vector2", constval)) |
| 1207 | .add_connection("Attribute::Vector", "Math_xC::Vector1") |
| 1208 | /* output sum */ |
| 1209 | .add_node(ShaderNodeBuilder<VectorMathNode>(builder.graph(), "Out") |
| 1210 | .set_param("math_type", NODE_VECTOR_MATH_ADD)) |
| 1211 | .add_connection("Math_Cx::Vector", "Out::Vector1") |
| 1212 | .add_connection("Math_xC::Vector", "Out::Vector2") |
| 1213 | .output_color("Out::Vector"); |
| 1214 | } |
| 1215 | |
| 1216 | /* |
| 1217 | * Tests: partial folding for Vector Math Add with known 0. |