Quantcast
Channel: Intel® Software - OpenCL*
Viewing all articles
Browse latest Browse all 1182

Very basic beginner question using CodeBuilder and a sample shader

$
0
0

I am trying a sample shader that intends to simply copy the pixels form a input texture to an output texture.  My goal is to see it run in Intel CodeBuilder without host code.  I have setup a session to run this small kernel.  (The kernel is from the textbook "OpenCL In Action").

__constant sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP | CLK_FILTER_NEAREST;

__kernel void simple_image(read_only image2d_t src_image, write_only image2d_t dst_image)
{
  int2 coord = (int2) (get_global_id(0), get_global_id(1));
  uint4 pixel = read_imageui(src_image, sampler, coord);

  write_imageui(dst_image, coord, pixel);
}

I've created two image variables.  The input image is 642x482 RGBA.  So I made the output image have the same properties as the input image except it is labeled as an output image.  I assigned the image variables to the input and outputs in the "Code Builder Analysis Input" window.  I selected a global size of X:642 Y:482 Z:0.  The local size is (1, 1, 0).

When I run the kernel in CodeBuilder it builds fine and runs but the output image is always black.  The simple kernel code should copy the image.  I've tried setting "pixel" to a nonzero constant value but still the output image shows up black in the output report.

 

 


Viewing all articles
Browse latest Browse all 1182

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>