diff options
author | Thomas Dinges <blender@dingto.org> | 2016-05-09 13:51:42 +0300 |
---|---|---|
committer | Thomas Dinges <blender@dingto.org> | 2016-05-11 22:58:34 +0300 |
commit | 4a4f043bc4235c046d2b58e00f2b80665ded11bf (patch) | |
tree | 58f68254573aece49f2b6ab67ffcb8ba1fc9c08f /intern/cycles/render/nodes.cpp | |
parent | 544b76ac9cf79bcc64b9f8248984f1d408d32eb8 (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/nodes.cpp')
-rw-r--r-- | intern/cycles/render/nodes.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp index 49d53def7a9..e612a2d36d6 100644 --- a/intern/cycles/render/nodes.cpp +++ b/intern/cycles/render/nodes.cpp @@ -349,7 +349,10 @@ void ImageTextureNode::compile(OSLCompiler& compiler) image_manager = compiler.image_manager; if(is_float == -1) { if(builtin_data == NULL) { - is_float = (int)image_manager->is_float_image(filename, NULL, is_linear); + ImageManager::ImageDataType type; + type = image_manager->get_image_metadata(filename, NULL, is_linear); + if(type == ImageManager::IMAGE_DATA_TYPE_FLOAT || type == ImageManager::IMAGE_DATA_TYPE_FLOAT4) + is_float = 1; } else { bool is_float_bool; @@ -533,7 +536,10 @@ void EnvironmentTextureNode::compile(OSLCompiler& compiler) image_manager = compiler.image_manager; if(is_float == -1) { if(builtin_data == NULL) { - is_float = (int)image_manager->is_float_image(filename, NULL, is_linear); + ImageManager::ImageDataType type; + type = image_manager->get_image_metadata(filename, NULL, is_linear); + if(type == ImageManager::IMAGE_DATA_TYPE_FLOAT || type == ImageManager::IMAGE_DATA_TYPE_FLOAT4) + is_float = 1; } else { bool is_float_bool; |