summaryrefslogtreecommitdiff
path: root/kernels
diff options
context:
space:
mode:
authorChuanbo Weng <chuanbo.weng@intel.com>2017-02-10 15:47:18 +0800
committerYang Rong <rong.r.yang@intel.com>2017-02-10 18:18:06 +0800
commitf54b7a2112975404d6d45b8fbf32c4d025524c71 (patch)
tree847eca210cf35ba46ac43db77c455eee66f068ae /kernels
parent1e6d0103aba114f5a424dcdb3143ac95919a4d70 (diff)
Add example of using cl_khr_gl_sharing to do gl buffer sharing.
Signed-off-by: Chuanbo Weng <chuanbo.weng@intel.com> Reviewed-by: Yang Rong <rong.r.yang@intel.com>
Diffstat (limited to 'kernels')
-rw-r--r--kernels/runtime_fill_gl_image.cl15
1 files changed, 15 insertions, 0 deletions
diff --git a/kernels/runtime_fill_gl_image.cl b/kernels/runtime_fill_gl_image.cl
new file mode 100644
index 00000000..79d40543
--- /dev/null
+++ b/kernels/runtime_fill_gl_image.cl
@@ -0,0 +1,15 @@
+__kernel void
+runtime_fill_gl_image(image2d_t img, int color)
+{
+ int2 coord;
+ float4 color_v4;
+ int lgid_x = get_group_id(0);
+ int lgid_y = get_group_id(1);
+ int num_groups_x = get_num_groups(0);
+ int num_groups_y = get_num_groups(1);
+
+ coord.x = get_global_id(0);
+ coord.y = get_global_id(1);
+ color_v4 = (float4)( lgid_x/(float)num_groups_x, lgid_y/(float)num_groups_y, 1.0, 1.0);
+ write_imagef(img, coord, color_v4);
+}