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:
authorAlexander Gavrilov <angavrilov@gmail.com>2016-08-22 11:11:45 +0300
committerAlexander Gavrilov <angavrilov@gmail.com>2016-08-22 11:11:45 +0300
commiteb2ee7212e16547e2a79b967d2ed37d88b0f2565 (patch)
tree06c1aed2bd016a61deaa47b2908f6be6825504d2 /intern/cycles/test
parent28cf9cfd15acad4c8eb2fd8a4d3df3a3905aa71e (diff)
Fix T49136: full constant Curves with zero Fac input crashes in assert.
The if branches were reordered when the original patch was committed, which broke the implicit non-NULL guarantee on link. To prevent re-occurrence, add a couple of unit tests.
Diffstat (limited to 'intern/cycles/test')
-rw-r--r--intern/cycles/test/render_graph_finalize_test.cpp47
1 files changed, 47 insertions, 0 deletions
diff --git a/intern/cycles/test/render_graph_finalize_test.cpp b/intern/cycles/test/render_graph_finalize_test.cpp
index 633e517ce9f..60e41be16aa 100644
--- a/intern/cycles/test/render_graph_finalize_test.cpp
+++ b/intern/cycles/test/render_graph_finalize_test.cpp
@@ -403,6 +403,26 @@ TEST(render_graph, constant_fold_invert_fac_0)
/*
* Tests:
+ * - Folding of Invert with zero Fac and constant input.
+ */
+TEST(render_graph, constant_fold_invert_fac_0_const)
+{
+ DEFINE_COMMON_VARIABLES(builder, log);
+
+ EXPECT_ANY_MESSAGE(log);
+ CORRECT_INFO_MESSAGE(log, "Folding Invert::Color to constant (0.2, 0.5, 0.8).");
+
+ builder
+ .add_node(ShaderNodeBuilder<InvertNode>("Invert")
+ .set("Fac", 0.0f)
+ .set("Color", make_float3(0.2f, 0.5f, 0.8f)))
+ .output_color("Invert::Color");
+
+ graph.finalize(&scene);
+}
+
+/*
+ * Tests:
* - Folding of MixRGB Add with all constant inputs (clamp false).
*/
TEST(render_graph, constant_fold_mix_add)
@@ -1344,6 +1364,33 @@ TEST(render_graph, constant_fold_rgb_curves_fac_0)
graph.finalize(&scene);
}
+
+/*
+ * Tests:
+ * - Folding of RGB Curves with zero Fac and all constant inputs.
+ */
+TEST(render_graph, constant_fold_rgb_curves_fac_0_const)
+{
+ DEFINE_COMMON_VARIABLES(builder, log);
+
+ EXPECT_ANY_MESSAGE(log);
+ CORRECT_INFO_MESSAGE(log, "Folding Curves::Color to constant (0.3, 0.5, 0.7).");
+
+ array<float3> curve;
+ init_test_curve(curve, make_float3(0.0f, 0.25f, 1.0f), make_float3(1.0f, 0.75f, 0.0f), 257);
+
+ builder
+ .add_node(ShaderNodeBuilder<RGBCurvesNode>("Curves")
+ .set(&CurvesNode::curves, curve)
+ .set(&CurvesNode::min_x, 0.1f)
+ .set(&CurvesNode::max_x, 0.9f)
+ .set("Fac", 0.0f)
+ .set("Color", make_float3(0.3f, 0.5f, 0.7f)))
+ .output_color("Curves::Color");
+
+ graph.finalize(&scene);
+}
+
/*
* Tests:
* - Folding of Vector Curves with all constant inputs.