Fix T59792: Cycles crash rendering motion pass with motion blur enabled.
authorBrecht Van Lommel <brechtvanlommel@gmail.com>
Wed, 2 Jan 2019 16:46:57 +0000 (17:46 +0100)
committerBrecht Van Lommel <brechtvanlommel@gmail.com>
Wed, 2 Jan 2019 16:47:27 +0000 (17:47 +0100)
intern/cycles/render/film.cpp

index d0f1549..355294e 100644 (file)
@@ -328,8 +328,17 @@ void Film::device_update(Device *device, DeviceScene *dscene, Scene *scene)
        for(size_t i = 0; i < passes.size(); i++) {
                Pass& pass = passes[i];
 
-               if(pass.type == PASS_NONE)
+               if(pass.type == PASS_NONE) {
                        continue;
+               }
+
+               /* Can't do motion pass if no motion vectors are available. */
+               if (pass.type == PASS_MOTION || pass.type == PASS_MOTION_WEIGHT) {
+                       if (scene->need_motion() != Scene::MOTION_PASS) {
+                               kfilm->pass_stride += pass.components;
+                               continue;
+                       }
+               }
 
                int pass_flag = (1 << (pass.type % 32));
                if(pass.type <= PASS_CATEGORY_MAIN_END) {