Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/kernel/device/cpu/image.h
- This file was moved from intern/cycles/kernel/kernels/cpu/kernel_cpu_image.h.
| /* | /* | ||||
| * Copyright 2011-2016 Blender Foundation | * Copyright 2011-2016 Blender Foundation | ||||
| * | * | ||||
| * Licensed under the Apache License, Version 2.0 (the "License"); | * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| * you may not use this file except in compliance with the License. | * you may not use this file except in compliance with the License. | ||||
| * You may obtain a copy of the License at | * You may obtain a copy of the License at | ||||
| * | * | ||||
| * http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
| * | * | ||||
| * Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
| * distributed under the License is distributed on an "AS IS" BASIS, | * distributed under the License is distributed on an "AS IS" BASIS, | ||||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
| * See the License for the specific language governing permissions and | * See the License for the specific language governing permissions and | ||||
| * limitations under the License. | * limitations under the License. | ||||
| */ | */ | ||||
| #ifndef __KERNEL_CPU_IMAGE_H__ | #pragma once | ||||
| #define __KERNEL_CPU_IMAGE_H__ | |||||
| #ifdef WITH_NANOVDB | #ifdef WITH_NANOVDB | ||||
| # define NANOVDB_USE_INTRINSICS | # define NANOVDB_USE_INTRINSICS | ||||
| # include <nanovdb/NanoVDB.h> | # include <nanovdb/NanoVDB.h> | ||||
| # include <nanovdb/util/SampleFromVoxels.h> | # include <nanovdb/util/SampleFromVoxels.h> | ||||
| #endif | #endif | ||||
| CCL_NAMESPACE_BEGIN | CCL_NAMESPACE_BEGIN | ||||
| ▲ Show 20 Lines • Show All 552 Lines • ▼ Show 20 Lines | switch ((interp == INTERPOLATION_NONE) ? info.interpolation : interp) { | ||||
| return interp_3d_cubic(acc, x, y, z); | return interp_3d_cubic(acc, x, y, z); | ||||
| } | } | ||||
| } | } | ||||
| }; | }; | ||||
| #endif | #endif | ||||
| #undef SET_CUBIC_SPLINE_WEIGHTS | #undef SET_CUBIC_SPLINE_WEIGHTS | ||||
| ccl_device float4 kernel_tex_image_interp(KernelGlobals *kg, int id, float x, float y) | ccl_device float4 kernel_tex_image_interp(const KernelGlobals *kg, int id, float x, float y) | ||||
| { | { | ||||
| const TextureInfo &info = kernel_tex_fetch(__texture_info, id); | const TextureInfo &info = kernel_tex_fetch(__texture_info, id); | ||||
| switch (info.data_type) { | switch (info.data_type) { | ||||
| case IMAGE_DATA_TYPE_HALF: | case IMAGE_DATA_TYPE_HALF: | ||||
| return TextureInterpolator<half>::interp(info, x, y); | return TextureInterpolator<half>::interp(info, x, y); | ||||
| case IMAGE_DATA_TYPE_BYTE: | case IMAGE_DATA_TYPE_BYTE: | ||||
| return TextureInterpolator<uchar>::interp(info, x, y); | return TextureInterpolator<uchar>::interp(info, x, y); | ||||
| Show All 11 Lines | case IMAGE_DATA_TYPE_FLOAT4: | ||||
| return TextureInterpolator<float4>::interp(info, x, y); | return TextureInterpolator<float4>::interp(info, x, y); | ||||
| default: | default: | ||||
| assert(0); | assert(0); | ||||
| return make_float4( | return make_float4( | ||||
| TEX_IMAGE_MISSING_R, TEX_IMAGE_MISSING_G, TEX_IMAGE_MISSING_B, TEX_IMAGE_MISSING_A); | TEX_IMAGE_MISSING_R, TEX_IMAGE_MISSING_G, TEX_IMAGE_MISSING_B, TEX_IMAGE_MISSING_A); | ||||
| } | } | ||||
| } | } | ||||
| ccl_device float4 kernel_tex_image_interp_3d(KernelGlobals *kg, | ccl_device float4 kernel_tex_image_interp_3d(const KernelGlobals *kg, | ||||
| int id, | int id, | ||||
| float3 P, | float3 P, | ||||
| InterpolationType interp) | InterpolationType interp) | ||||
| { | { | ||||
| const TextureInfo &info = kernel_tex_fetch(__texture_info, id); | const TextureInfo &info = kernel_tex_fetch(__texture_info, id); | ||||
| if (info.use_transform_3d) { | if (info.use_transform_3d) { | ||||
| P = transform_point(&info.transform_3d, P); | P = transform_point(&info.transform_3d, P); | ||||
| Show All 27 Lines | default: | ||||
| return make_float4( | return make_float4( | ||||
| TEX_IMAGE_MISSING_R, TEX_IMAGE_MISSING_G, TEX_IMAGE_MISSING_B, TEX_IMAGE_MISSING_A); | TEX_IMAGE_MISSING_R, TEX_IMAGE_MISSING_G, TEX_IMAGE_MISSING_B, TEX_IMAGE_MISSING_A); | ||||
| } | } | ||||
| } | } | ||||
| } /* Namespace. */ | } /* Namespace. */ | ||||
| CCL_NAMESPACE_END | CCL_NAMESPACE_END | ||||
| #endif // __KERNEL_CPU_IMAGE_H__ | |||||