diff options
author | Stefan Werner <stefan.werner@tangent-animation.com> | 2018-07-05 13:37:52 +0300 |
---|---|---|
committer | Stefan Werner <stefan.werner@tangent-animation.com> | 2018-07-05 14:53:34 +0300 |
commit | 4d00e95ee3ed91f86262bb218f1c5df901da724c (patch) | |
tree | 5d9af704609b38cca76a5786189c126ac7072332 /intern/cycles/kernel/kernels/cuda/kernel_cuda_image.h | |
parent | cd17b3258327522b8c6f56a3ee7239a91f2be149 (diff) |
Cycles: Adding native support for UINT16 textures.
Textures in 16 bit integer format are sometimes used for displacement, bump and normal maps and can be exported by tools like Substance Painter. Without this patch, Cycles would promote those textures to single precision floating point, causing them to take up twice as much memory as needed.
Reviewers: #cycles, brecht, sergey
Reviewed By: #cycles, brecht, sergey
Subscribers: sergey, dingto, #cycles
Tags: #cycles
Differential Revision: https://developer.blender.org/D3523
Diffstat (limited to 'intern/cycles/kernel/kernels/cuda/kernel_cuda_image.h')
-rw-r--r-- | intern/cycles/kernel/kernels/cuda/kernel_cuda_image.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/intern/cycles/kernel/kernels/cuda/kernel_cuda_image.h b/intern/cycles/kernel/kernels/cuda/kernel_cuda_image.h index 91ad289a858..a72fae5e1b1 100644 --- a/intern/cycles/kernel/kernels/cuda/kernel_cuda_image.h +++ b/intern/cycles/kernel/kernels/cuda/kernel_cuda_image.h @@ -127,11 +127,12 @@ ccl_device float4 kernel_tex_image_interp(KernelGlobals *kg, int id, float x, fl const TextureInfo& info = kernel_tex_fetch(__texture_info, id); CUtexObject tex = (CUtexObject)info.data; - /* float4, byte4 and half4 */ + /* float4, byte4, ushort4 and half4 */ const int texture_type = kernel_tex_type(id); if(texture_type == IMAGE_DATA_TYPE_FLOAT4 || texture_type == IMAGE_DATA_TYPE_BYTE4 || - texture_type == IMAGE_DATA_TYPE_HALF4) + texture_type == IMAGE_DATA_TYPE_HALF4 || + texture_type == IMAGE_DATA_TYPE_USHORT4) { if(info.interpolation == INTERPOLATION_CUBIC) { return kernel_tex_image_interp_bicubic<float4>(info, tex, x, y); @@ -164,7 +165,8 @@ ccl_device float4 kernel_tex_image_interp_3d(KernelGlobals *kg, int id, float x, const int texture_type = kernel_tex_type(id); if(texture_type == IMAGE_DATA_TYPE_FLOAT4 || texture_type == IMAGE_DATA_TYPE_BYTE4 || - texture_type == IMAGE_DATA_TYPE_HALF4) + texture_type == IMAGE_DATA_TYPE_HALF4 || + texture_type == IMAGE_DATA_TYPE_USHORT4) { if(interpolation == INTERPOLATION_CUBIC) { return kernel_tex_image_interp_bicubic_3d<float4>(info, tex, x, y, z); |