opencl samplers,colors and interpolation,
Members - Reputation: 246
Posted 28 November 2012 - 05:28 AM
I'm studing opencl, in particular image processing.
is possible to create a sampler that interpolates values from two color: start and end color and the normalized coordinates from 0 to 1 in automatic mode?
I wish use bilinear interpolation.
I must create a texture with interpolated colors or is possible to set the bilinear interpolation in the creation of the sampler?
next, is possible use integer coordinates(for ex from 0px to 600px) and interpolation in the same mode?
Members - Reputation: 1527
Posted 28 November 2012 - 01:16 PM
you can either create a on the client side, or in the cl shader, on the gpu side.
Client side: from page 128
gpu side: from page 292 and 326
on the gpu side, you can create the same sampler objects. Some examples:
__constant sampler_t the_sampler = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP_TO_EDGE | CLK_FILTER_NEAREST;
__constant sampler_t the_linear_sampler = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP_TO_EDGE | CLK_FILTER_LINEAR;
__constant sampler_t the_normalized_sampler = CLK_NORMALIZED_COORDS_TRUE | CLK_ADDRESS_CLAMP_TO_EDGE | CLK_FILTER_NEAREST;
__constant sampler_t the_normalized_linear_sampler = CLK_NORMALIZED_COORDS_TRUE | CLK_ADDRESS_CLAMP_TO_EDGE | CLK_FILTER_LINEAR;
normalized means access with texture coordinates, unnormalized is basically textureFetch from glsl. You can do the same clamping as in glsl, however you only have the linear/nearest options (so no mip mapping) as far as I know.
Stuff I wrote:
Follow me on twitter: