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
This commit is contained in:
@@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user