aboutsummaryrefslogtreecommitdiff
path: root/cl_kernel/kernel_wire_frame.cl
blob: 5862dd5607bbe9c1492bf0f972ed551723c9d24f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/*
 * function: kernel_wire_frame
 *
 * output_y:              Y channel image2d_t as write only
 * output_uv:             uv channel image2d_t as write only
 * wire_frames_coords:    coordinates of wire frames
 * coords_num:            number of coordinates to be processed
 */

__kernel void kernel_wire_frame (
    __write_only image2d_t output_y, __write_only image2d_t output_uv,
    __global uint2 *wire_frames_coords, uint coords_num,
    float border_y, float border_u, float border_v)
{
    if (coords_num == 0) {
        return;
    }

    int gid = get_global_id (0);
    if (gid >= coords_num) {
        return;
    }

    uint2 coord = wire_frames_coords [gid];

    write_imagef (output_y, (int2)(coord.x / 2, coord.y), (float4)(border_y));
    if (coord.y % 2 == 0) {
        write_imagef (output_uv, (int2)(coord.x / 2, coord.y / 2), (float4)(border_u, border_v, 0.0f, 0.0f));
    }
}