Results 1 to 2 of 2

Thread: what is the difference between the sampler objects creation

  1. #1
    Junior Member
    Join Date
    Oct 2010
    Posts
    2

    what is the difference between the sampler objects creation

    cl_sampler clCreateSampler ( cl_context context,
    cl_bool normalized_coords,
    cl_addressing_mode addressing_mode,
    cl_filter_mode filter_mode,
    cl_int *errcode_ret) ,
    in the above function what is the object
    please explain the dufference between these two.

    onst sampler_t imgSamplerInt2 = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_NONE | CLK_FILTER_NEAREST;

  2. #2
    Senior Member
    Join Date
    May 2010
    Location
    Toronto, Canada
    Posts
    845

    Re: what is the difference between the sampler objects creat

    I'll try to explain it in simple terms.

    Code :
    clCreateSampler()

    This function is executed in the host (CPU). It returns a new sampler object. You can pass this sampler object to the device (GPU, etc) as a kernel argument using clSetKernelArg().

    On the other hand,

    Code :
    const sampler_t imgSamplerInt2 = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_NONE | CLK_FILTER_NEAREST;

    is source code written in OpenCL C. It is not executed by the host (CPU). Instead, it is executed by the device (GPU, etc).

    Both are valid ways to initialize a sampler. The first method allows you to pass different sampler objects at different times to the same kernel. With the second method the sampler is constant, so you can't change it.
    Disclaimer: Employee of Qualcomm Canada. Any opinions expressed here are personal and do not necessarily reflect the views of my employer. LinkedIn profile.

Similar Threads

  1. Replies: 1
    Last Post: 10-19-2010, 03:34 PM
  2. Replies: 3
    Last Post: 11-22-2009, 03:52 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •