diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2017-10-07 03:15:12 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2017-10-07 16:30:57 +0300 |
commit | 2d92988f6bc4ec475d685c5cdfb84ba23c1a95ba (patch) | |
tree | 680d0cef83b624d555f7343f6f6f3dacb7884fe2 /intern/cycles/kernel/kernels/cpu | |
parent | 23098cda9936d785988b689ee69e58e900f17cb2 (diff) |
Cycles: CUDA bicubic and tricubic texture interpolation support.
While cubic interpolation is quite expensive on the CPU compared to linear
interpolation, the difference on the GPU is quite small.
Diffstat (limited to 'intern/cycles/kernel/kernels/cpu')
-rw-r--r-- | intern/cycles/kernel/kernels/cpu/kernel_cpu_image.h | 28 |
1 files changed, 3 insertions, 25 deletions
diff --git a/intern/cycles/kernel/kernels/cpu/kernel_cpu_image.h b/intern/cycles/kernel/kernels/cpu/kernel_cpu_image.h index b2ad60f08c1..37ba0f692be 100644 --- a/intern/cycles/kernel/kernels/cpu/kernel_cpu_image.h +++ b/intern/cycles/kernel/kernels/cpu/kernel_cpu_image.h @@ -430,12 +430,12 @@ template<typename T> struct TextureInterpolator { static ccl_always_inline float4 interp_3d(const TextureInfo& info, float x, float y, float z, - int interpolation = INTERPOLATION_LINEAR) + InterpolationType interp) { if(UNLIKELY(!info.data)) return make_float4(0.0f, 0.0f, 0.0f, 0.0f); - switch(interpolation) { + switch((interp == INTERPOLATION_NONE)? info.interpolation: interp) { case INTERPOLATION_CLOSEST: return interp_3d_closest(info, x, y, z); case INTERPOLATION_LINEAR: @@ -468,29 +468,7 @@ ccl_device float4 kernel_tex_image_interp(KernelGlobals *kg, int id, float x, fl } } -ccl_device float4 kernel_tex_image_interp_3d(KernelGlobals *kg, int id, float x, float y, float z) -{ - const TextureInfo& info = kernel_tex_fetch(__texture_info, id); - InterpolationType interp = (InterpolationType)info.interpolation; - - switch(kernel_tex_type(id)) { - case IMAGE_DATA_TYPE_HALF: - return TextureInterpolator<half>::interp_3d(info, x, y, z, interp); - case IMAGE_DATA_TYPE_BYTE: - return TextureInterpolator<uchar>::interp_3d(info, x, y, z, interp); - case IMAGE_DATA_TYPE_FLOAT: - return TextureInterpolator<float>::interp_3d(info, x, y, z, interp); - case IMAGE_DATA_TYPE_HALF4: - return TextureInterpolator<half4>::interp_3d(info, x, y, z, interp); - case IMAGE_DATA_TYPE_BYTE4: - return TextureInterpolator<uchar4>::interp_3d(info, x, y, z, interp); - case IMAGE_DATA_TYPE_FLOAT4: - default: - return TextureInterpolator<float4>::interp_3d(info, x, y, z, interp); - } -} - -ccl_device float4 kernel_tex_image_interp_3d_ex(KernelGlobals *kg, int id, float x, float y, float z, int interp) +ccl_device float4 kernel_tex_image_interp_3d(KernelGlobals *kg, int id, float x, float y, float z, InterpolationType interp) { const TextureInfo& info = kernel_tex_fetch(__texture_info, id); |