Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/kernel/device/gpu/image.h
| Show First 20 Lines • Show All 180 Lines • ▼ Show 20 Lines | |||||
| ccl_device float4 kernel_tex_image_interp(KernelGlobals kg, int id, float x, float y) | ccl_device float4 kernel_tex_image_interp(KernelGlobals kg, int id, float x, float y) | ||||
| { | { | ||||
| ccl_global const TextureInfo &info = kernel_tex_fetch(__texture_info, id); | ccl_global const TextureInfo &info = kernel_tex_fetch(__texture_info, id); | ||||
| /* float4, byte4, ushort4 and half4 */ | /* float4, byte4, ushort4 and half4 */ | ||||
| const int texture_type = info.data_type; | const int texture_type = info.data_type; | ||||
| if (texture_type == IMAGE_DATA_TYPE_FLOAT4 || texture_type == IMAGE_DATA_TYPE_BYTE4 || | if (texture_type == IMAGE_DATA_TYPE_FLOAT4 || texture_type == IMAGE_DATA_TYPE_BYTE4 || | ||||
| texture_type == IMAGE_DATA_TYPE_HALF4 || texture_type == IMAGE_DATA_TYPE_USHORT4) { | texture_type == IMAGE_DATA_TYPE_HALF4 || texture_type == IMAGE_DATA_TYPE_USHORT4) { | ||||
| if (info.interpolation == INTERPOLATION_CUBIC) { | if (info.interpolation == INTERPOLATION_CUBIC || info.interpolation == INTERPOLATION_SMART) { | ||||
| return kernel_tex_image_interp_bicubic<float4>(info, x, y); | return kernel_tex_image_interp_bicubic<float4>(info, x, y); | ||||
| } | } | ||||
| else { | else { | ||||
| ccl_gpu_tex_object tex = (ccl_gpu_tex_object)info.data; | ccl_gpu_tex_object tex = (ccl_gpu_tex_object)info.data; | ||||
| return ccl_gpu_tex_object_read_2D<float4>(tex, x, y); | return ccl_gpu_tex_object_read_2D<float4>(tex, x, y); | ||||
| } | } | ||||
| } | } | ||||
| /* float, byte and half */ | /* float, byte and half */ | ||||
| else { | else { | ||||
| float f; | float f; | ||||
| if (info.interpolation == INTERPOLATION_CUBIC) { | if (info.interpolation == INTERPOLATION_CUBIC || info.interpolation == INTERPOLATION_SMART) { | ||||
| f = kernel_tex_image_interp_bicubic<float>(info, x, y); | f = kernel_tex_image_interp_bicubic<float>(info, x, y); | ||||
| } | } | ||||
| else { | else { | ||||
| ccl_gpu_tex_object tex = (ccl_gpu_tex_object)info.data; | ccl_gpu_tex_object tex = (ccl_gpu_tex_object)info.data; | ||||
| f = ccl_gpu_tex_object_read_2D<float>(tex, x, y); | f = ccl_gpu_tex_object_read_2D<float>(tex, x, y); | ||||
| } | } | ||||
| return make_float4(f, f, f, 1.0f); | return make_float4(f, f, f, 1.0f); | ||||
| Show All 26 Lines | #ifdef WITH_NANOVDB | ||||
| if (texture_type == IMAGE_DATA_TYPE_NANOVDB_FLOAT3) { | if (texture_type == IMAGE_DATA_TYPE_NANOVDB_FLOAT3) { | ||||
| nanovdb::Vec3f f = kernel_tex_image_interp_nanovdb<nanovdb::Vec3f>( | nanovdb::Vec3f f = kernel_tex_image_interp_nanovdb<nanovdb::Vec3f>( | ||||
| info, x, y, z, interpolation); | info, x, y, z, interpolation); | ||||
| return make_float4(f[0], f[1], f[2], 1.0f); | return make_float4(f[0], f[1], f[2], 1.0f); | ||||
| } | } | ||||
| #endif | #endif | ||||
| if (texture_type == IMAGE_DATA_TYPE_FLOAT4 || texture_type == IMAGE_DATA_TYPE_BYTE4 || | if (texture_type == IMAGE_DATA_TYPE_FLOAT4 || texture_type == IMAGE_DATA_TYPE_BYTE4 || | ||||
| texture_type == IMAGE_DATA_TYPE_HALF4 || texture_type == IMAGE_DATA_TYPE_USHORT4) { | texture_type == IMAGE_DATA_TYPE_HALF4 || texture_type == IMAGE_DATA_TYPE_USHORT4) { | ||||
| if (interpolation == INTERPOLATION_CUBIC) { | if (interpolation == INTERPOLATION_CUBIC || interpolation == INTERPOLATION_SMART) { | ||||
| return kernel_tex_image_interp_tricubic<float4>(info, x, y, z); | return kernel_tex_image_interp_tricubic<float4>(info, x, y, z); | ||||
| } | } | ||||
| else { | else { | ||||
| ccl_gpu_tex_object tex = (ccl_gpu_tex_object)info.data; | ccl_gpu_tex_object tex = (ccl_gpu_tex_object)info.data; | ||||
| return ccl_gpu_tex_object_read_3D<float4>(tex, x, y, z); | return ccl_gpu_tex_object_read_3D<float4>(tex, x, y, z); | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| float f; | float f; | ||||
| if (interpolation == INTERPOLATION_CUBIC) { | if (interpolation == INTERPOLATION_CUBIC || interpolation == INTERPOLATION_SMART) { | ||||
| f = kernel_tex_image_interp_tricubic<float>(info, x, y, z); | f = kernel_tex_image_interp_tricubic<float>(info, x, y, z); | ||||
| } | } | ||||
| else { | else { | ||||
| ccl_gpu_tex_object tex = (ccl_gpu_tex_object)info.data; | ccl_gpu_tex_object tex = (ccl_gpu_tex_object)info.data; | ||||
| f = ccl_gpu_tex_object_read_3D<float>(tex, x, y, z); | f = ccl_gpu_tex_object_read_3D<float>(tex, x, y, z); | ||||
| } | } | ||||
| return make_float4(f, f, f, 1.0f); | return make_float4(f, f, f, 1.0f); | ||||
| } | } | ||||
| } | } | ||||
| CCL_NAMESPACE_END | CCL_NAMESPACE_END | ||||