Cycles: fix AO pass not rendering with AO enabled for world, and make mask
[blender.git] / intern / cycles / render / scene.cpp
index 85a0cc3a7c477064f05fe43da6cda36973baaa5d..079f2744e730d621218e6acba0eefb08c2ac9e5f 100644 (file)
@@ -57,31 +57,31 @@ Scene::Scene(const SceneParams& params_)
 
 Scene::~Scene()
 {
-       camera->device_free(device, &dscene);
+       if(device) camera->device_free(device, &dscene);
        delete camera;
 
-       filter->device_free(device, &dscene);
+       if(device) filter->device_free(device, &dscene);
        delete filter;
 
-       film->device_free(device, &dscene);
+       if(device) film->device_free(device, &dscene);
        delete film;
 
-       background->device_free(device, &dscene);
+       if(device) background->device_free(device, &dscene);
        delete background;
 
-       mesh_manager->device_free(device, &dscene);
+       if(device) mesh_manager->device_free(device, &dscene);
        delete mesh_manager;
 
-       object_manager->device_free(device, &dscene);
+       if(device) object_manager->device_free(device, &dscene);
        delete object_manager;
 
-       integrator->device_free(device, &dscene);
+       if(device) integrator->device_free(device, &dscene);
        delete integrator;
 
-       shader_manager->device_free(device, &dscene);
+       if(device) shader_manager->device_free(device, &dscene);
        delete shader_manager;
 
-       light_manager->device_free(device, &dscene);
+       if(device) light_manager->device_free(device, &dscene);
        delete light_manager;
 
        foreach(Shader *s, shaders)
@@ -93,7 +93,7 @@ Scene::~Scene()
        foreach(Light *l, lights)
                delete l;
 
-       image_manager->device_free(device, &dscene);
+       if(device) image_manager->device_free(device, &dscene);
        delete image_manager;
 }
 
@@ -152,13 +152,13 @@ void Scene::device_update(Device *device_, Progress& progress)
 
        if(progress.get_cancel()) return;
 
-       progress.set_status("Updating Integrator");
-       integrator->device_update(device, &dscene);
+       progress.set_status("Updating Film");
+       film->device_update(device, &dscene);
 
        if(progress.get_cancel()) return;
 
-       progress.set_status("Updating Film");
-       film->device_update(device, &dscene);
+       progress.set_status("Updating Integrator");
+       integrator->device_update(device, &dscene);
 
        if(progress.get_cancel()) return;