xref: /third_party/opencl-headers/CL/cl_egl.h (revision 80d59932)
1/*******************************************************************************
2 * Copyright (c) 2008-2020 The Khronos Group Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *    http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 ******************************************************************************/
16
17#ifndef __OPENCL_CL_EGL_H
18#define __OPENCL_CL_EGL_H
19
20#include <CL/cl.h>
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
26
27/* Command type for events created with clEnqueueAcquireEGLObjectsKHR */
28#define CL_COMMAND_EGL_FENCE_SYNC_OBJECT_KHR  0x202F
29#define CL_COMMAND_ACQUIRE_EGL_OBJECTS_KHR    0x202D
30#define CL_COMMAND_RELEASE_EGL_OBJECTS_KHR    0x202E
31
32/* Error type for clCreateFromEGLImageKHR */
33#define CL_INVALID_EGL_OBJECT_KHR             -1093
34#define CL_EGL_RESOURCE_NOT_ACQUIRED_KHR      -1092
35
36/* CLeglImageKHR is an opaque handle to an EGLImage */
37typedef void* CLeglImageKHR;
38
39/* CLeglDisplayKHR is an opaque handle to an EGLDisplay */
40typedef void* CLeglDisplayKHR;
41
42/* CLeglSyncKHR is an opaque handle to an EGLSync object */
43typedef void* CLeglSyncKHR;
44
45/* properties passed to clCreateFromEGLImageKHR */
46typedef intptr_t cl_egl_image_properties_khr;
47
48
49#define cl_khr_egl_image 1
50
51extern CL_API_ENTRY cl_mem CL_API_CALL
52clCreateFromEGLImageKHR(cl_context                  context,
53                        CLeglDisplayKHR             egldisplay,
54                        CLeglImageKHR               eglimage,
55                        cl_mem_flags                flags,
56                        const cl_egl_image_properties_khr * properties,
57                        cl_int *                    errcode_ret) CL_API_SUFFIX__VERSION_1_0;
58
59typedef cl_mem (CL_API_CALL *clCreateFromEGLImageKHR_fn)(
60    cl_context                  context,
61    CLeglDisplayKHR             egldisplay,
62    CLeglImageKHR               eglimage,
63    cl_mem_flags                flags,
64    const cl_egl_image_properties_khr * properties,
65    cl_int *                    errcode_ret);
66
67
68extern CL_API_ENTRY cl_int CL_API_CALL
69clEnqueueAcquireEGLObjectsKHR(cl_command_queue command_queue,
70                              cl_uint          num_objects,
71                              const cl_mem *   mem_objects,
72                              cl_uint          num_events_in_wait_list,
73                              const cl_event * event_wait_list,
74                              cl_event *       event) CL_API_SUFFIX__VERSION_1_0;
75
76typedef cl_int (CL_API_CALL *clEnqueueAcquireEGLObjectsKHR_fn)(
77    cl_command_queue command_queue,
78    cl_uint          num_objects,
79    const cl_mem *   mem_objects,
80    cl_uint          num_events_in_wait_list,
81    const cl_event * event_wait_list,
82    cl_event *       event);
83
84
85extern CL_API_ENTRY cl_int CL_API_CALL
86clEnqueueReleaseEGLObjectsKHR(cl_command_queue command_queue,
87                              cl_uint          num_objects,
88                              const cl_mem *   mem_objects,
89                              cl_uint          num_events_in_wait_list,
90                              const cl_event * event_wait_list,
91                              cl_event *       event) CL_API_SUFFIX__VERSION_1_0;
92
93typedef cl_int (CL_API_CALL *clEnqueueReleaseEGLObjectsKHR_fn)(
94    cl_command_queue command_queue,
95    cl_uint          num_objects,
96    const cl_mem *   mem_objects,
97    cl_uint          num_events_in_wait_list,
98    const cl_event * event_wait_list,
99    cl_event *       event);
100
101
102#define cl_khr_egl_event 1
103
104extern CL_API_ENTRY cl_event CL_API_CALL
105clCreateEventFromEGLSyncKHR(cl_context      context,
106                            CLeglSyncKHR    sync,
107                            CLeglDisplayKHR display,
108                            cl_int *        errcode_ret) CL_API_SUFFIX__VERSION_1_0;
109
110typedef cl_event (CL_API_CALL *clCreateEventFromEGLSyncKHR_fn)(
111    cl_context      context,
112    CLeglSyncKHR    sync,
113    CLeglDisplayKHR display,
114    cl_int *        errcode_ret);
115
116#ifdef __cplusplus
117}
118#endif
119
120#endif /* __OPENCL_CL_EGL_H */
121