10 # define NANOVDB_USE_INTRINSICS
11 # include "nanovdb/NanoVDB.h"
12 # include "nanovdb/util/SampleFromVoxels.h"
18 return (1.0f / 6.0f) * (
a * (
a * (-
a + 3.0f) - 3.0f) + 1.0f);
22 return (1.0f / 6.0f) * (
a *
a * (3.0f *
a - 6.0f) + 4.0f);
26 return (1.0f / 6.0f) * (
a * (
a * (-3.0f *
a + 3.0f) + 3.0f) + 1.0f);
30 return (1.0f / 6.0f) * (
a *
a *
a);
61 x = (
x * info.width) - 0.5f;
62 y = (
y * info.height) - 0.5f;
72 float x0 = (px +
cubic_h0(fx) + 0.5f) / info.width;
73 float x1 = (px +
cubic_h1(fx) + 0.5f) / info.width;
74 float y0 = (py +
cubic_h0(fy) + 0.5f) / info.height;
75 float y1 = (py +
cubic_h1(fy) + 0.5f) / info.height;
77 return cubic_g0(fy) * (g0x * ccl_gpu_tex_object_read_2D<T>(
tex, x0, y0) +
78 g1x * ccl_gpu_tex_object_read_2D<T>(
tex, x1, y0)) +
79 cubic_g1(fy) * (g0x * ccl_gpu_tex_object_read_2D<T>(
tex, x0,
y1) +
80 g1x * ccl_gpu_tex_object_read_2D<T>(
tex, x1,
y1));
90 x = (
x * info.width) - 0.5f;
91 y = (
y * info.height) - 0.5f;
92 z = (
z * info.depth) - 0.5f;
109 float x0 = (px +
cubic_h0(fx) + 0.5f) / info.width;
110 float x1 = (px +
cubic_h1(fx) + 0.5f) / info.width;
111 float y0 = (py +
cubic_h0(fy) + 0.5f) / info.height;
112 float y1 = (py +
cubic_h1(fy) + 0.5f) / info.height;
113 float z0 = (pz +
cubic_h0(fz) + 0.5f) / info.depth;
114 float z1 = (pz +
cubic_h1(fz) + 0.5f) / info.depth;
116 return g0z * (g0y * (g0x * ccl_gpu_tex_object_read_3D<T>(
tex, x0, y0, z0) +
117 g1x * ccl_gpu_tex_object_read_3D<T>(
tex, x1, y0, z0)) +
118 g1y * (g0x * ccl_gpu_tex_object_read_3D<T>(
tex, x0,
y1, z0) +
119 g1x * ccl_gpu_tex_object_read_3D<T>(
tex, x1,
y1, z0))) +
120 g1z * (g0y * (g0x * ccl_gpu_tex_object_read_3D<T>(
tex, x0, y0, z1) +
121 g1x * ccl_gpu_tex_object_read_3D<T>(
tex, x1, y0, z1)) +
122 g1y * (g0x * ccl_gpu_tex_object_read_3D<T>(
tex, x0,
y1, z1) +
123 g1x * ccl_gpu_tex_object_read_3D<T>(
tex, x1,
y1, z1)));
127 template<
typename T,
typename S>
128 ccl_device typename nanovdb::NanoGrid<T>::ValueType kernel_tex_image_interp_tricubic_nanovdb(
129 S &s,
float x,
float y,
float z)
152 using namespace nanovdb;
154 return g0z * (g0y * (g0x * s(
Vec3f(x0, y0, z0)) + g1x * s(
Vec3f(x1, y0, z0))) +
155 g1y * (g0x * s(
Vec3f(x0,
y1, z0)) + g1x * s(
Vec3f(x1,
y1, z0)))) +
156 g1z * (g0y * (g0x * s(
Vec3f(x0, y0, z1)) + g1x * s(
Vec3f(x1, y0, z1))) +
161 ccl_device_noinline typename nanovdb::NanoGrid<T>::ValueType kernel_tex_image_interp_nanovdb(
164 using namespace nanovdb;
166 NanoGrid<T> *
const grid = (NanoGrid<T> *)info.data;
167 typedef typename nanovdb::NanoGrid<T>::AccessorType AccessorType;
168 AccessorType acc = grid->getAccessor();
170 switch (interpolation) {
172 return SampleFromVoxels<AccessorType, 0, false>(acc)(
Vec3f(
x,
y,
z));
174 return SampleFromVoxels<AccessorType, 1, false>(acc)(
Vec3f(
x - 0.5f,
y - 0.5f,
z - 0.5f));
176 SampleFromVoxels<AccessorType, 1, false> s(acc);
177 return kernel_tex_image_interp_tricubic_nanovdb<T>(s,
x - 0.5f,
y - 0.5f,
z - 0.5f);
187 const int texture_type = info.data_type;
191 return kernel_tex_image_interp_bicubic<float4>(info,
x,
y);
195 return ccl_gpu_tex_object_read_2D<float4>(
tex,
x,
y);
203 f = kernel_tex_image_interp_bicubic<float>(info,
x,
y);
207 f = ccl_gpu_tex_object_read_2D<float>(
tex,
x,
y);
221 if (info.use_transform_3d) {
230 const int texture_type = info.data_type;
234 float f = kernel_tex_image_interp_nanovdb<float>(info,
x,
y,
z, interpolation);
238 nanovdb::Vec3f f = kernel_tex_image_interp_nanovdb<nanovdb::Vec3f>(
239 info,
x,
y,
z, interpolation);
243 float f = kernel_tex_image_interp_nanovdb<nanovdb::FpN>(info,
x,
y,
z, interpolation);
247 float f = kernel_tex_image_interp_nanovdb<nanovdb::Fp16>(info,
x,
y,
z, interpolation);
254 return kernel_tex_image_interp_tricubic<float4>(info,
x,
y,
z);
258 return ccl_gpu_tex_object_read_3D<float4>(
tex,
x,
y,
z);
265 f = kernel_tex_image_interp_tricubic<float>(info,
x,
y,
z);
269 f = ccl_gpu_tex_object_read_3D<float>(
tex,
x,
y,
z);
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble z
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble y1
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
CUtexObject ccl_gpu_tex_object_3D
#define ccl_device_noinline
#define CCL_NAMESPACE_END
CUtexObject ccl_gpu_tex_object_2D
ccl_device float cubic_w2(float a)
ccl_device float cubic_h0(float a)
ccl_device float cubic_g0(float a)
ccl_device float cubic_w3(float a)
CCL_NAMESPACE_BEGIN ccl_device float cubic_w0(float a)
ccl_device float cubic_w1(float a)
ccl_device_noinline T kernel_tex_image_interp_bicubic(ccl_global const TextureInfo &info, float x, float y)
ccl_device float cubic_g1(float a)
ccl_device float cubic_h1(float a)
ccl_device float4 kernel_tex_image_interp_3d(KernelGlobals kg, int id, float3 P, InterpolationType interp)
ccl_device float4 kernel_tex_image_interp(KernelGlobals kg, int id, float x, float y)
ccl_device_noinline T kernel_tex_image_interp_tricubic(ccl_global const TextureInfo &info, float x, float y, float z)
const KernelGlobalsCPU *ccl_restrict KernelGlobals
#define kernel_data_fetch(name, index)
ccl_device_inline float2 interp(const float2 &a, const float2 &b, float t)
@ IMAGE_DATA_TYPE_NANOVDB_FP16
@ IMAGE_DATA_TYPE_USHORT4
@ IMAGE_DATA_TYPE_NANOVDB_FLOAT
@ IMAGE_DATA_TYPE_NANOVDB_FLOAT3
@ IMAGE_DATA_TYPE_NANOVDB_FPN