Sign in to follow this  

opencl samplers,colors and interpolation

This topic is 1875 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hello.
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?
thanks.

Share this post


Link to post
Share on other sites
hi,

you can either create a on the client side, or in the cl shader, on the gpu side.
specs: http://www.khronos.org/registry/cl/specs/opencl-1.2.pdf
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.

Share this post


Link to post
Share on other sites

This topic is 1875 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this