Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Dinges <blender@dingto.org>2016-05-06 12:57:30 +0300
committerThomas Dinges <blender@dingto.org>2016-05-06 14:20:09 +0300
commit36d8a70b00c2c0a1bc28ffad4cc2e283a77d7bab (patch)
treee0cbab5ae98b7c5bba8f0a7614604b8f5584567d /intern/cycles/render/image.h
parent8aa3bac7afa3b684125975c9f6e51c76fc563f78 (diff)
Code refactor: Change Cycles ImageManager arrays.
This commit simplifies the code for the image arrays. Instead of having 2 arrays for float and byte textures, we now use an array here. This simplifies the code (avoids code duplication), and makes it possible to easily extend it with float1 and half-float types in the future. Only tested with CPU yet, plus some cleanup / code de-duplication is still possible here. Reviewers: #cycles, sergey Reviewed By: #cycles, sergey Subscribers: jesterking, sergey Differential Revision: https://developer.blender.org/D1969
Diffstat (limited to 'intern/cycles/render/image.h')
-rw-r--r--intern/cycles/render/image.h17
1 files changed, 13 insertions, 4 deletions
diff --git a/intern/cycles/render/image.h b/intern/cycles/render/image.h
index 64798d75638..b28f4536db2 100644
--- a/intern/cycles/render/image.h
+++ b/intern/cycles/render/image.h
@@ -35,6 +35,13 @@ public:
ImageManager(const DeviceInfo& info);
~ImageManager();
+ enum ImageDataType {
+ IMAGE_DATA_TYPE_FLOAT = 0,
+ IMAGE_DATA_TYPE_BYTE = 1,
+
+ IMAGE_DATA_NUM_TYPES
+ };
+
int add_image(const string& filename,
void *builtin_data,
bool animated,
@@ -85,20 +92,22 @@ public:
};
private:
- int tex_num_byte_images;
- int tex_num_float_images;
+ int tex_num_images[IMAGE_DATA_NUM_TYPES];
int tex_image_byte_start;
thread_mutex device_mutex;
int animation_frame;
- vector<Image*> images;
- vector<Image*> float_images;
+ vector<Image*> images[IMAGE_DATA_NUM_TYPES];
void *osl_texture_system;
bool pack_images;
bool file_load_image(Image *img, device_vector<uchar4>& tex_img);
bool file_load_float_image(Image *img, device_vector<float4>& tex_img);
+ int type_index_to_flattened_slot(int slot, ImageDataType type);
+ int flattened_slot_to_type_index(int slot, ImageDataType *type);
+ string name_from_type(int type);
+
void device_load_image(Device *device, DeviceScene *dscene, int slot, Progress *progess);
void device_free_image(Device *device, DeviceScene *dscene, int slot);