Cycles: Fix wrong looking voronoi of second 2nd closest
authorSergey Sharybin <sergey.vfx@gmail.com>
Fri, 24 Aug 2018 10:29:13 +0000 (12:29 +0200)
committerSergey Sharybin <sergey.vfx@gmail.com>
Fri, 24 Aug 2018 10:29:13 +0000 (12:29 +0200)
Was only happening for release builds made with GCC-8. Probably some
optimization strtegy was confused by uninitialized variable.

intern/cycles/kernel/svm/svm_voronoi.h

index 75af910d940719bb546e4656b37bfb9f45617a6f..4e66e87611fca6194ecdada17a7b75cbd7350dcc 100644 (file)
@@ -32,6 +32,11 @@ ccl_device void voronoi_neighbors(float3 p, NodeVoronoiDistanceMetric distance,
        da[2] = 1e10f;
        da[3] = 1e10f;
 
+       pa[0] = make_float3(0.0f, 0.0f, 0.0f);
+       pa[1] = make_float3(0.0f, 0.0f, 0.0f);
+       pa[2] = make_float3(0.0f, 0.0f, 0.0f);
+       pa[3] = make_float3(0.0f, 0.0f, 0.0f);
+
        int3 xyzi = quick_floor_to_int3(p);
 
        for(int xx = -1; xx <= 1; xx++) {