Merge branch 'blender2.7'
authorCampbell Barton <ideasman42@gmail.com>
Fri, 1 Feb 2019 22:37:50 +0000 (09:37 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 1 Feb 2019 22:37:50 +0000 (09:37 +1100)
1  2 
intern/cycles/render/image.cpp
intern/cycles/render/image.h

@@@ -333,6 -333,10 +333,10 @@@ int ImageManager::add_image(const strin
                                img->use_alpha = use_alpha;
                                img->need_load = true;
                        }
+                       if(!(img->metadata == metadata)) {
+                               img->metadata = metadata;
+                               img->need_load = true;
+                       }
                        img->users++;
                        return type_index_to_flattened_slot(slot, type);
                }
@@@ -1016,39 -1020,6 +1020,39 @@@ void ImageManager::device_update_slot(D
        }
  }
  
 +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++) {
@@@ -44,6 -44,18 +44,18 @@@ public
        /* Automatically set. */
        ImageDataType type;
        bool is_linear;
+       bool operator==(const ImageMetaData& other) const
+       {
+               return is_float == other.is_float &&
+                      is_half == other.is_half &&
+                      channels == other.channels &&
+                      width == other.width &&
+                      height == other.height &&
+                      depth == other.depth &&
+                      type == other.type &&
+                      is_linear == other.is_linear;
+       }
  };
  
  class ImageManager {
@@@ -84,10 -96,6 +96,10 @@@ public
                                int flat_slot,
                                Progress *progress);
        void device_free(Device *device);
 +
 +      void device_load_builtin(Device *device,
 +                               Scene *scene,
 +                               Progress& progress);
        void device_free_builtin(Device *device);
  
        void set_osl_texture_system(void *texture_system);