Merge branch 'master' into blender2.8
[blender.git] / intern / cycles / render / image.cpp
index 27d6ae7828925b81e1a8ead0a5e00aa8feced4da..28ef026135a4eaec53516dea8180b90c625ee0ed 100644 (file)
@@ -1018,6 +1018,39 @@ void ImageManager::device_update_slot(Device *device,
        }
 }
 
+void ImageManager::device_load_builtin(Device *device,
+                                       Scene *scene,
+                                       Progress& progress)
+{
+       /* Load only builtin images, Blender needs this to load evaluated
+        * scene data from depsgraph before it is freed. */
+       if(!need_update) {
+               return;
+       }
+
+       TaskPool pool;
+       for(int type = 0; type < IMAGE_DATA_NUM_TYPES; type++) {
+               for(size_t slot = 0; slot < images[type].size(); slot++) {
+                       if(!images[type][slot])
+                               continue;
+
+                       if(images[type][slot]->need_load) {
+                               if(images[type][slot]->builtin_data) {
+                                       pool.push(function_bind(&ImageManager::device_load_image,
+                                                               this,
+                                                               device,
+                                                               scene,
+                                                               (ImageDataType)type,
+                                                               slot,
+                                                               &progress));
+                               }
+                       }
+               }
+       }
+
+       pool.wait_work();
+}
+
 void ImageManager::device_free_builtin(Device *device)
 {
        for(int type = 0; type < IMAGE_DATA_NUM_TYPES; type++) {