title: OpenCL image3d linear sampling
body: <p>I'm doing some linear interpolation with OpenCL, but the result is not as expected. So I did a simple test, kernel code shown below: </p>
  
  <pre><code>const sampler_t sampler = CLK_NORMALIZED_COORDS_TRUE | CLK_FILTER_LINEAR | CLK_ADDRESS_CLAMP_TO_EDGE;
  // Kernel block.
  kernel void interpolate(
                     global float4*input,
                     image3d_t image,
                     global float4*output)
  {
      size_t i = get_global_id(0);
      float4 coord = input[i];
      float4 tap = read_imagef(image, sampler, coord);
      output[i] = tap;
  }
  </code></pre>
  
  <p>Pixels (in RGBA) of the 2x2x2 image is as below: </p>
  
  <pre><code>cl_float4 image_data[8] = {
      {0, 0, 0, 0},
      {100, 0, 0, 0},
      {0, 100, 0, 0},
      {100, 100, 0, 0},
      {0, 0, 100, 0},
      {100, 0, 100, 0},
      {0, 100, 100, 0},
      {100, 100, 100, 0},
  };
  </code></pre>
  
  <p>I used 11 coordinates ((0, 0, 0), (0.1, 0.1, 0.1)...(1, 1, 1), from 0 to 1 with step 0.1) to read the image, and I expect the results to be (0, 0, 0), (10, 10, 10)...(100, 100, 100), but I got: </p>
  
  <pre><code>coordinate:0.000000, result: 0.000000
  coordinate:0.100000, result: 0.000000
  coordinate:0.200000, result: 0.000000
  coordinate:0.300000, result: 10.156250
  coordinate:0.400000, result: 30.078125
  coordinate:0.500000, result: 50.000000
  coordinate:0.600000, result: 69.921875
  coordinate:0.700000, result: 89.843750
  coordinate:0.800000, result: 100.000000
  coordinate:0.900000, result: 100.000000
  coordinate:1.000000, result: 100.000000
  </code></pre>
  
  <p>It just returns edge value when the coordinates are smaller than 0.25 or greater than 0.75.</p>
  
  <p>Anyone could explain this? Thanks.</p>