aboutsummaryrefslogtreecommitdiff
path: root/cl_kernel/kernel_demo.cl
blob: 161e6e6d09b6f285824d854f447a7f2f07fa376b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/*
 * function: kernel_demo
 *     sample code of default kernel arguments
 * input:    image2d_t as read only
 * output:   image2d_t as write only
 */

__kernel void kernel_demo (__read_only image2d_t input, __write_only image2d_t output)
{
    int x = get_global_id (0);
    int y = get_global_id (1);
    sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_NONE | CLK_FILTER_NEAREST;

    int2 pos = (int2)(x, y);
    uint4 pixel = read_imageui(input, sampler, pos);
    write_imageui(output, pos, pixel);
}