diff options
Diffstat (limited to 'intern/cycles/render/image.h')
-rw-r--r-- | intern/cycles/render/image.h | 53 |
1 files changed, 44 insertions, 9 deletions
diff --git a/intern/cycles/render/image.h b/intern/cycles/render/image.h index 1dc4bf180f8..47bbd92347c 100644 --- a/intern/cycles/render/image.h +++ b/intern/cycles/render/image.h @@ -30,6 +30,7 @@ CCL_NAMESPACE_BEGIN class Device; class DeviceScene; class Progress; +class Scene; class ImageManager { public: @@ -67,8 +68,15 @@ public: ExtensionType extension); ImageDataType get_image_metadata(const string& filename, void *builtin_data, bool& is_linear); - void device_update(Device *device, DeviceScene *dscene, Progress& progress); - void device_update_slot(Device *device, DeviceScene *dscene, int flat_slot, Progress *progress); + void device_update(Device *device, + DeviceScene *dscene, + Scene *scene, + Progress& progress); + void device_update_slot(Device *device, + DeviceScene *dscene, + Scene *scene, + int flat_slot, + Progress *progress); void device_free(Device *device, DeviceScene *dscene); void device_free_builtin(Device *device, DeviceScene *dscene); @@ -78,9 +86,25 @@ public: bool need_update; - function<void(const string &filename, void *data, bool &is_float, int &width, int &height, int &depth, int &channels)> builtin_image_info_cb; - function<bool(const string &filename, void *data, unsigned char *pixels)> builtin_image_pixels_cb; - function<bool(const string &filename, void *data, float *pixels)> builtin_image_float_pixels_cb; + /* NOTE: Here pixels_size is a size of storage, which equals to + * width * height * depth. + * Use this to avoid some nasty memory corruptions. + */ + function<void(const string &filename, + void *data, + bool &is_float, + int &width, + int &height, + int &depth, + int &channels)> builtin_image_info_cb; + function<bool(const string &filename, + void *data, + unsigned char *pixels, + const size_t pixels_size)> builtin_image_pixels_cb; + function<bool(const string &filename, + void *data, + float *pixels, + const size_t pixels_size)> builtin_image_float_pixels_cb; struct Image { string filename; @@ -114,6 +138,7 @@ private: typename DeviceType> bool file_load_image(Image *img, ImageDataType type, + int texture_limit, device_vector<DeviceType>& tex_img); int type_index_to_flattened_slot(int slot, ImageDataType type); @@ -122,10 +147,20 @@ private: uint8_t pack_image_options(ImageDataType type, size_t slot); - void device_load_image(Device *device, DeviceScene *dscene, ImageDataType type, int slot, Progress *progess); - void device_free_image(Device *device, DeviceScene *dscene, ImageDataType type, int slot); - - void device_pack_images(Device *device, DeviceScene *dscene, Progress& progess); + void device_load_image(Device *device, + DeviceScene *dscene, + Scene *scene, + ImageDataType type, + int slot, + Progress *progess); + void device_free_image(Device *device, + DeviceScene *dscene, + ImageDataType type, + int slot); + + void device_pack_images(Device *device, + DeviceScene *dscene, + Progress& progess); }; CCL_NAMESPACE_END |