< Previous | Contents | Next >
DCTL Kernel Source Code
The Kernel is the image processing code that will be executed when called. The Kernel source code is a user-defined string, and is typically contained in the raw string delimiters of double square brackets.
KernelSource = [[ …Source Code… ]]
Kernel functions that can be called from the fuse using a compute node are defined by the KERNEL prefix, with double underscores.
GradientSource = [[
KERNEL void GradientKernel( CONSTANTREF GradientParams *params,
TEXTURE2D_WRITE dst)
{
DEFINE_KERNEL_ITERATORS_XY(x, y)
if (x < params->dstsize[0] && y < params->dstsize[1])
{
float2 pos = to_float2(x, y) / to_float2(params->dstsize[0] - 1, params->dstsize[1] - 1);
float4 col = to_float4_v(params->col); col *= to_float4(pos.x, pos.y, 0.0f, 1.0f);
_tex2DVec4Write(dst, x, y, col); // image, x, y, float4 colour
}
}
]]