• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*******************************************************************************
2  * Copyright (c) 2008-2010 The Khronos Group Inc.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and/or associated documentation files (the
6  * "Materials"), to deal in the Materials without restriction, including
7  * without limitation the rights to use, copy, modify, merge, publish,
8  * distribute, sublicense, and/or sell copies of the Materials, and to
9  * permit persons to whom the Materials are furnished to do so, subject to
10  * the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included
13  * in all copies or substantial portions of the Materials.
14  *
15  * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
19  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
20  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
21  * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
22  ******************************************************************************/
23 
24 #ifndef __OPENCL_CL_EGL_H
25 #define __OPENCL_CL_EGL_H
26 
27 #ifdef __APPLE__
28 
29 #else
30 #include <CL/cl.h>
31 #include <EGL/egl.h>
32 #include <EGL/eglext.h>
33 #endif
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
39 
40 /* Command type for events created with clEnqueueAcquireEGLObjectsKHR */
41 #define CL_COMMAND_EGL_FENCE_SYNC_OBJECT_KHR  0x202F
42 #define CL_COMMAND_ACQUIRE_EGL_OBJECTS_KHR    0x202D
43 #define CL_COMMAND_RELEASE_EGL_OBJECTS_KHR    0x202E
44 
45 /* Error type for clCreateFromEGLImageKHR */
46 #define CL_INVALID_EGL_OBJECT_KHR             -1093
47 #define CL_EGL_RESOURCE_NOT_ACQUIRED_KHR      -1092
48 
49 /* CLeglImageKHR is an opaque handle to an EGLImage */
50 typedef void* CLeglImageKHR;
51 
52 /* CLeglDisplayKHR is an opaque handle to an EGLDisplay */
53 typedef void* CLeglDisplayKHR;
54 
55 /* CLeglSyncKHR is an opaque handle to an EGLSync object */
56 typedef void* CLeglSyncKHR;
57 
58 /* properties passed to clCreateFromEGLImageKHR */
59 typedef intptr_t cl_egl_image_properties_khr;
60 
61 
62 #define cl_khr_egl_image 1
63 
64 extern CL_API_ENTRY cl_mem CL_API_CALL
65 clCreateFromEGLImageKHR(cl_context                  /* context */,
66                         CLeglDisplayKHR             /* egldisplay */,
67                         CLeglImageKHR               /* eglimage */,
68                         cl_mem_flags                /* flags */,
69                         const cl_egl_image_properties_khr * /* properties */,
70                         cl_int *                    /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
71 
72 typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromEGLImageKHR_fn)(
73 	cl_context                  context,
74 	CLeglDisplayKHR             egldisplay,
75 	CLeglImageKHR               eglimage,
76 	cl_mem_flags                flags,
77 	const cl_egl_image_properties_khr * properties,
78 	cl_int *                    errcode_ret);
79 
80 
81 extern CL_API_ENTRY cl_int CL_API_CALL
82 clEnqueueAcquireEGLObjectsKHR(cl_command_queue /* command_queue */,
83                               cl_uint          /* num_objects */,
84                               const cl_mem *   /* mem_objects */,
85                               cl_uint          /* num_events_in_wait_list */,
86                               const cl_event * /* event_wait_list */,
87                               cl_event *       /* event */) CL_API_SUFFIX__VERSION_1_0;
88 
89 typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueAcquireEGLObjectsKHR_fn)(
90 	cl_command_queue command_queue,
91 	cl_uint          num_objects,
92 	const cl_mem *   mem_objects,
93 	cl_uint          num_events_in_wait_list,
94 	const cl_event * event_wait_list,
95 	cl_event *       event);
96 
97 
98 extern CL_API_ENTRY cl_int CL_API_CALL
99 clEnqueueReleaseEGLObjectsKHR(cl_command_queue /* command_queue */,
100                               cl_uint          /* num_objects */,
101                               const cl_mem *   /* mem_objects */,
102                               cl_uint          /* num_events_in_wait_list */,
103                               const cl_event * /* event_wait_list */,
104                               cl_event *       /* event */) CL_API_SUFFIX__VERSION_1_0;
105 
106 typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueReleaseEGLObjectsKHR_fn)(
107 	cl_command_queue command_queue,
108 	cl_uint          num_objects,
109 	const cl_mem *   mem_objects,
110 	cl_uint          num_events_in_wait_list,
111 	const cl_event * event_wait_list,
112 	cl_event *       event);
113 
114 
115 #define cl_khr_egl_event 1
116 
117 extern CL_API_ENTRY cl_event CL_API_CALL
118 clCreateEventFromEGLSyncKHR(cl_context      /* context */,
119                             CLeglSyncKHR    /* sync */,
120                             CLeglDisplayKHR /* display */,
121                             cl_int *        /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
122 
123 typedef CL_API_ENTRY cl_event (CL_API_CALL *clCreateEventFromEGLSyncKHR_fn)(
124 	cl_context      context,
125 	CLeglSyncKHR    sync,
126 	CLeglDisplayKHR display,
127 	cl_int *        errcode_ret);
128 
129 #ifdef __cplusplus
130 }
131 #endif
132 
133 #endif /* __OPENCL_CL_EGL_H */
134