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-09 13:51:42 +0300
committerThomas Dinges <blender@dingto.org>2016-05-11 22:58:34 +0300
commit4a4f043bc4235c046d2b58e00f2b80665ded11bf (patch)
tree58f68254573aece49f2b6ab67ffcb8ba1fc9c08f /intern/cycles/render/image.h
parent544b76ac9cf79bcc64b9f8248984f1d408d32eb8 (diff)
Cycles: Add support for single channel float textures on CPU.
Until now, single channel textures were packed into a float4, wasting 3 floats per pixel. Memory usage of such textures is now reduced by 3/4. Voxel Attributes such as density, flame and heat benefit from this, but also Bumpmaps with one channel. This commit also includes some cleanup and code deduplication for image loading. Example Smoke render from Cosmos Laundromat: http://www.pasteall.org/pic/show.php?id=102972 Memory here went down from ~600MB to ~300MB. Reviewers: #cycles, brecht Differential Revision: https://developer.blender.org/D1981
Diffstat (limited to 'intern/cycles/render/image.h')
-rw-r--r--intern/cycles/render/image.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/intern/cycles/render/image.h b/intern/cycles/render/image.h
index 02dc189b5ec..cf5a6e9523f 100644
--- a/intern/cycles/render/image.h
+++ b/intern/cycles/render/image.h
@@ -20,6 +20,7 @@
#include "device.h"
#include "device_memory.h"
+#include "util_image.h"
#include "util_string.h"
#include "util_thread.h"
#include "util_vector.h"
@@ -38,6 +39,7 @@ public:
enum ImageDataType {
IMAGE_DATA_TYPE_FLOAT4 = 0,
IMAGE_DATA_TYPE_BYTE4 = 1,
+ IMAGE_DATA_TYPE_FLOAT = 2,
IMAGE_DATA_NUM_TYPES
};
@@ -60,7 +62,7 @@ public:
void *builtin_data,
InterpolationType interpolation,
ExtensionType extension);
- bool is_float_image(const string& filename, void *builtin_data, bool& is_linear);
+ 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);
@@ -94,6 +96,7 @@ public:
private:
int tex_num_images[IMAGE_DATA_NUM_TYPES];
int tex_image_byte4_start;
+ int tex_image_float_start;
thread_mutex device_mutex;
int animation_frame;
@@ -101,8 +104,10 @@ private:
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);
+ bool file_load_image_generic(Image *img, ImageInput **in, int &width, int &height, int &depth, int &components);
+ bool file_load_byte4_image(Image *img, device_vector<uchar4>& tex_img);
+ bool file_load_float4_image(Image *img, device_vector<float4>& tex_img);
+ bool file_load_float_image(Image *img, device_vector<float>& tex_img);
int type_index_to_flattened_slot(int slot, ImageDataType type);
int flattened_slot_to_type_index(int flat_slot, ImageDataType *type);