xref: /aosp_15_r20/external/angle/include/CL/cl_egl.h (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
1 /*******************************************************************************
2  * Copyright (c) 2008-2023 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 /*
21 ** This header is generated from the Khronos OpenCL XML API Registry.
22 */
23 
24 #include <CL/cl.h>
25 
26 /* CL_NO_PROTOTYPES implies CL_NO_EXTENSION_PROTOTYPES: */
27 #if defined(CL_NO_PROTOTYPES) && !defined(CL_NO_EXTENSION_PROTOTYPES)
28 #define CL_NO_EXTENSION_PROTOTYPES
29 #endif
30 
31 /* CL_NO_EXTENSION_PROTOTYPES implies
32    CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES and
33    CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES: */
34 #if defined(CL_NO_EXTENSION_PROTOTYPES) && \
35     !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES)
36 #define CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES
37 #endif
38 #if defined(CL_NO_EXTENSION_PROTOTYPES) && \
39     !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
40 #define CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES
41 #endif
42 
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46 
47 /***************************************************************
48 * cl_khr_egl_image
49 ***************************************************************/
50 #define cl_khr_egl_image 1
51 #define CL_KHR_EGL_IMAGE_EXTENSION_NAME \
52     "cl_khr_egl_image"
53 
54 /* Command type for events created with clEnqueueAcquireEGLObjectsKHR */
55 #define CL_COMMAND_EGL_FENCE_SYNC_OBJECT_KHR                0x202F
56 #define CL_COMMAND_ACQUIRE_EGL_OBJECTS_KHR                  0x202D
57 #define CL_COMMAND_RELEASE_EGL_OBJECTS_KHR                  0x202E
58 
59 /* Error type for clCreateFromEGLImageKHR */
60 #define CL_INVALID_EGL_OBJECT_KHR                           -1093
61 #define CL_EGL_RESOURCE_NOT_ACQUIRED_KHR                    -1092
62 
63 /* CLeglImageKHR is an opaque handle to an EGLImage */
64 typedef void*               CLeglImageKHR;
65 
66 /* CLeglDisplayKHR is an opaque handle to an EGLDisplay */
67 typedef void*               CLeglDisplayKHR;
68 
69 /* properties passed to clCreateFromEGLImageKHR */
70 typedef intptr_t            cl_egl_image_properties_khr;
71 
72 
73 typedef cl_mem CL_API_CALL
74 clCreateFromEGLImageKHR_t(
75     cl_context context,
76     CLeglDisplayKHR egldisplay,
77     CLeglImageKHR eglimage,
78     cl_mem_flags flags,
79     const cl_egl_image_properties_khr* properties,
80     cl_int* errcode_ret);
81 
82 typedef clCreateFromEGLImageKHR_t *
83 clCreateFromEGLImageKHR_fn CL_API_SUFFIX__VERSION_1_0;
84 
85 typedef cl_int CL_API_CALL
86 clEnqueueAcquireEGLObjectsKHR_t(
87     cl_command_queue command_queue,
88     cl_uint num_objects,
89     const cl_mem* mem_objects,
90     cl_uint num_events_in_wait_list,
91     const cl_event* event_wait_list,
92     cl_event* event);
93 
94 typedef clEnqueueAcquireEGLObjectsKHR_t *
95 clEnqueueAcquireEGLObjectsKHR_fn CL_API_SUFFIX__VERSION_1_0;
96 
97 typedef cl_int CL_API_CALL
98 clEnqueueReleaseEGLObjectsKHR_t(
99     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);
105 
106 typedef clEnqueueReleaseEGLObjectsKHR_t *
107 clEnqueueReleaseEGLObjectsKHR_fn CL_API_SUFFIX__VERSION_1_0;
108 
109 #if !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES)
110 
111 extern CL_API_ENTRY cl_mem CL_API_CALL
112 clCreateFromEGLImageKHR(
113     cl_context context,
114     CLeglDisplayKHR egldisplay,
115     CLeglImageKHR eglimage,
116     cl_mem_flags flags,
117     const cl_egl_image_properties_khr* properties,
118     cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_0;
119 
120 extern CL_API_ENTRY cl_int CL_API_CALL
121 clEnqueueAcquireEGLObjectsKHR(
122     cl_command_queue command_queue,
123     cl_uint num_objects,
124     const cl_mem* mem_objects,
125     cl_uint num_events_in_wait_list,
126     const cl_event* event_wait_list,
127     cl_event* event) CL_API_SUFFIX__VERSION_1_0;
128 
129 extern CL_API_ENTRY cl_int CL_API_CALL
130 clEnqueueReleaseEGLObjectsKHR(
131     cl_command_queue command_queue,
132     cl_uint num_objects,
133     const cl_mem* mem_objects,
134     cl_uint num_events_in_wait_list,
135     const cl_event* event_wait_list,
136     cl_event* event) CL_API_SUFFIX__VERSION_1_0;
137 
138 #endif /* !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
139 
140 /***************************************************************
141 * cl_khr_egl_event
142 ***************************************************************/
143 #define cl_khr_egl_event 1
144 #define CL_KHR_EGL_EVENT_EXTENSION_NAME \
145     "cl_khr_egl_event"
146 
147 /* CLeglDisplayKHR is an opaque handle to an EGLDisplay */
148 /* type CLeglDisplayKHR */
149 
150 /* CLeglSyncKHR is an opaque handle to an EGLSync object */
151 typedef void*               CLeglSyncKHR;
152 
153 
154 typedef cl_event CL_API_CALL
155 clCreateEventFromEGLSyncKHR_t(
156     cl_context context,
157     CLeglSyncKHR sync,
158     CLeglDisplayKHR display,
159     cl_int* errcode_ret);
160 
161 typedef clCreateEventFromEGLSyncKHR_t *
162 clCreateEventFromEGLSyncKHR_fn CL_API_SUFFIX__VERSION_1_0;
163 
164 #if !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES)
165 
166 extern CL_API_ENTRY cl_event CL_API_CALL
167 clCreateEventFromEGLSyncKHR(
168     cl_context context,
169     CLeglSyncKHR sync,
170     CLeglDisplayKHR display,
171     cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_0;
172 
173 #endif /* !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
174 
175 #ifdef __cplusplus
176 }
177 #endif
178 
179 #endif /* OPENCL_CL_EGL_H_ */
180