xref: /OK3568_Linux_fs/external/libmali/include/CL/cl_gl.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /**********************************************************************************
2*4882a593Smuzhiyun  * Copyright (c) 2008-2015 The Khronos Group Inc.
3*4882a593Smuzhiyun  *
4*4882a593Smuzhiyun  * Permission is hereby granted, free of charge, to any person obtaining a
5*4882a593Smuzhiyun  * copy of this software and/or associated documentation files (the
6*4882a593Smuzhiyun  * "Materials"), to deal in the Materials without restriction, including
7*4882a593Smuzhiyun  * without limitation the rights to use, copy, modify, merge, publish,
8*4882a593Smuzhiyun  * distribute, sublicense, and/or sell copies of the Materials, and to
9*4882a593Smuzhiyun  * permit persons to whom the Materials are furnished to do so, subject to
10*4882a593Smuzhiyun  * the following conditions:
11*4882a593Smuzhiyun  *
12*4882a593Smuzhiyun  * The above copyright notice and this permission notice shall be included
13*4882a593Smuzhiyun  * in all copies or substantial portions of the Materials.
14*4882a593Smuzhiyun  *
15*4882a593Smuzhiyun  * MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
16*4882a593Smuzhiyun  * KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
17*4882a593Smuzhiyun  * SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
18*4882a593Smuzhiyun  *    https://www.khronos.org/registry/
19*4882a593Smuzhiyun  *
20*4882a593Smuzhiyun  * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21*4882a593Smuzhiyun  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22*4882a593Smuzhiyun  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23*4882a593Smuzhiyun  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
24*4882a593Smuzhiyun  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25*4882a593Smuzhiyun  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26*4882a593Smuzhiyun  * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
27*4882a593Smuzhiyun  **********************************************************************************/
28*4882a593Smuzhiyun 
29*4882a593Smuzhiyun #ifndef __OPENCL_CL_GL_H
30*4882a593Smuzhiyun #define __OPENCL_CL_GL_H
31*4882a593Smuzhiyun 
32*4882a593Smuzhiyun #ifdef __APPLE__
33*4882a593Smuzhiyun #include <OpenCL/cl.h>
34*4882a593Smuzhiyun #else
35*4882a593Smuzhiyun #include <CL/cl.h>
36*4882a593Smuzhiyun #endif
37*4882a593Smuzhiyun 
38*4882a593Smuzhiyun #ifdef __cplusplus
39*4882a593Smuzhiyun extern "C" {
40*4882a593Smuzhiyun #endif
41*4882a593Smuzhiyun 
42*4882a593Smuzhiyun typedef cl_uint     cl_gl_object_type;
43*4882a593Smuzhiyun typedef cl_uint     cl_gl_texture_info;
44*4882a593Smuzhiyun typedef cl_uint     cl_gl_platform_info;
45*4882a593Smuzhiyun typedef struct __GLsync *cl_GLsync;
46*4882a593Smuzhiyun 
47*4882a593Smuzhiyun /* cl_gl_object_type = 0x2000 - 0x200F enum values are currently taken           */
48*4882a593Smuzhiyun #define CL_GL_OBJECT_BUFFER                     0x2000
49*4882a593Smuzhiyun #define CL_GL_OBJECT_TEXTURE2D                  0x2001
50*4882a593Smuzhiyun #define CL_GL_OBJECT_TEXTURE3D                  0x2002
51*4882a593Smuzhiyun #define CL_GL_OBJECT_RENDERBUFFER               0x2003
52*4882a593Smuzhiyun #define CL_GL_OBJECT_TEXTURE2D_ARRAY            0x200E
53*4882a593Smuzhiyun #define CL_GL_OBJECT_TEXTURE1D                  0x200F
54*4882a593Smuzhiyun #define CL_GL_OBJECT_TEXTURE1D_ARRAY            0x2010
55*4882a593Smuzhiyun #define CL_GL_OBJECT_TEXTURE_BUFFER             0x2011
56*4882a593Smuzhiyun 
57*4882a593Smuzhiyun /* cl_gl_texture_info           */
58*4882a593Smuzhiyun #define CL_GL_TEXTURE_TARGET                    0x2004
59*4882a593Smuzhiyun #define CL_GL_MIPMAP_LEVEL                      0x2005
60*4882a593Smuzhiyun #define CL_GL_NUM_SAMPLES                       0x2012
61*4882a593Smuzhiyun 
62*4882a593Smuzhiyun 
63*4882a593Smuzhiyun extern CL_API_ENTRY cl_mem CL_API_CALL
64*4882a593Smuzhiyun clCreateFromGLBuffer(cl_context     /* context */,
65*4882a593Smuzhiyun                      cl_mem_flags   /* flags */,
66*4882a593Smuzhiyun                      cl_GLuint      /* bufobj */,
67*4882a593Smuzhiyun                      int *          /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
68*4882a593Smuzhiyun 
69*4882a593Smuzhiyun extern CL_API_ENTRY cl_mem CL_API_CALL
70*4882a593Smuzhiyun clCreateFromGLTexture(cl_context      /* context */,
71*4882a593Smuzhiyun                       cl_mem_flags    /* flags */,
72*4882a593Smuzhiyun                       cl_GLenum       /* target */,
73*4882a593Smuzhiyun                       cl_GLint        /* miplevel */,
74*4882a593Smuzhiyun                       cl_GLuint       /* texture */,
75*4882a593Smuzhiyun                       cl_int *        /* errcode_ret */) CL_API_SUFFIX__VERSION_1_2;
76*4882a593Smuzhiyun 
77*4882a593Smuzhiyun extern CL_API_ENTRY cl_mem CL_API_CALL
78*4882a593Smuzhiyun clCreateFromGLRenderbuffer(cl_context   /* context */,
79*4882a593Smuzhiyun                            cl_mem_flags /* flags */,
80*4882a593Smuzhiyun                            cl_GLuint    /* renderbuffer */,
81*4882a593Smuzhiyun                            cl_int *     /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
82*4882a593Smuzhiyun 
83*4882a593Smuzhiyun extern CL_API_ENTRY cl_int CL_API_CALL
84*4882a593Smuzhiyun clGetGLObjectInfo(cl_mem                /* memobj */,
85*4882a593Smuzhiyun                   cl_gl_object_type *   /* gl_object_type */,
86*4882a593Smuzhiyun                   cl_GLuint *           /* gl_object_name */) CL_API_SUFFIX__VERSION_1_0;
87*4882a593Smuzhiyun 
88*4882a593Smuzhiyun extern CL_API_ENTRY cl_int CL_API_CALL
89*4882a593Smuzhiyun clGetGLTextureInfo(cl_mem               /* memobj */,
90*4882a593Smuzhiyun                    cl_gl_texture_info   /* param_name */,
91*4882a593Smuzhiyun                    size_t               /* param_value_size */,
92*4882a593Smuzhiyun                    void *               /* param_value */,
93*4882a593Smuzhiyun                    size_t *             /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
94*4882a593Smuzhiyun 
95*4882a593Smuzhiyun extern CL_API_ENTRY cl_int CL_API_CALL
96*4882a593Smuzhiyun clEnqueueAcquireGLObjects(cl_command_queue      /* command_queue */,
97*4882a593Smuzhiyun                           cl_uint               /* num_objects */,
98*4882a593Smuzhiyun                           const cl_mem *        /* mem_objects */,
99*4882a593Smuzhiyun                           cl_uint               /* num_events_in_wait_list */,
100*4882a593Smuzhiyun                           const cl_event *      /* event_wait_list */,
101*4882a593Smuzhiyun                           cl_event *            /* event */) CL_API_SUFFIX__VERSION_1_0;
102*4882a593Smuzhiyun 
103*4882a593Smuzhiyun extern CL_API_ENTRY cl_int CL_API_CALL
104*4882a593Smuzhiyun clEnqueueReleaseGLObjects(cl_command_queue      /* command_queue */,
105*4882a593Smuzhiyun                           cl_uint               /* num_objects */,
106*4882a593Smuzhiyun                           const cl_mem *        /* mem_objects */,
107*4882a593Smuzhiyun                           cl_uint               /* num_events_in_wait_list */,
108*4882a593Smuzhiyun                           const cl_event *      /* event_wait_list */,
109*4882a593Smuzhiyun                           cl_event *            /* event */) CL_API_SUFFIX__VERSION_1_0;
110*4882a593Smuzhiyun 
111*4882a593Smuzhiyun 
112*4882a593Smuzhiyun /* Deprecated OpenCL 1.1 APIs */
113*4882a593Smuzhiyun extern CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem CL_API_CALL
114*4882a593Smuzhiyun clCreateFromGLTexture2D(cl_context      /* context */,
115*4882a593Smuzhiyun                         cl_mem_flags    /* flags */,
116*4882a593Smuzhiyun                         cl_GLenum       /* target */,
117*4882a593Smuzhiyun                         cl_GLint        /* miplevel */,
118*4882a593Smuzhiyun                         cl_GLuint       /* texture */,
119*4882a593Smuzhiyun                         cl_int *        /* errcode_ret */) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED;
120*4882a593Smuzhiyun 
121*4882a593Smuzhiyun extern CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem CL_API_CALL
122*4882a593Smuzhiyun clCreateFromGLTexture3D(cl_context      /* context */,
123*4882a593Smuzhiyun                         cl_mem_flags    /* flags */,
124*4882a593Smuzhiyun                         cl_GLenum       /* target */,
125*4882a593Smuzhiyun                         cl_GLint        /* miplevel */,
126*4882a593Smuzhiyun                         cl_GLuint       /* texture */,
127*4882a593Smuzhiyun                         cl_int *        /* errcode_ret */) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED;
128*4882a593Smuzhiyun 
129*4882a593Smuzhiyun /* cl_khr_gl_sharing extension  */
130*4882a593Smuzhiyun 
131*4882a593Smuzhiyun #define cl_khr_gl_sharing 1
132*4882a593Smuzhiyun 
133*4882a593Smuzhiyun typedef cl_uint     cl_gl_context_info;
134*4882a593Smuzhiyun 
135*4882a593Smuzhiyun /* Additional Error Codes  */
136*4882a593Smuzhiyun #define CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR  -1000
137*4882a593Smuzhiyun 
138*4882a593Smuzhiyun /* cl_gl_context_info  */
139*4882a593Smuzhiyun #define CL_CURRENT_DEVICE_FOR_GL_CONTEXT_KHR    0x2006
140*4882a593Smuzhiyun #define CL_DEVICES_FOR_GL_CONTEXT_KHR           0x2007
141*4882a593Smuzhiyun 
142*4882a593Smuzhiyun /* Additional cl_context_properties  */
143*4882a593Smuzhiyun #define CL_GL_CONTEXT_KHR                       0x2008
144*4882a593Smuzhiyun #define CL_EGL_DISPLAY_KHR                      0x2009
145*4882a593Smuzhiyun #define CL_GLX_DISPLAY_KHR                      0x200A
146*4882a593Smuzhiyun #define CL_WGL_HDC_KHR                          0x200B
147*4882a593Smuzhiyun #define CL_CGL_SHAREGROUP_KHR                   0x200C
148*4882a593Smuzhiyun 
149*4882a593Smuzhiyun extern CL_API_ENTRY cl_int CL_API_CALL
150*4882a593Smuzhiyun clGetGLContextInfoKHR(const cl_context_properties * /* properties */,
151*4882a593Smuzhiyun                       cl_gl_context_info            /* param_name */,
152*4882a593Smuzhiyun                       size_t                        /* param_value_size */,
153*4882a593Smuzhiyun                       void *                        /* param_value */,
154*4882a593Smuzhiyun                       size_t *                      /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
155*4882a593Smuzhiyun 
156*4882a593Smuzhiyun typedef CL_API_ENTRY cl_int (CL_API_CALL *clGetGLContextInfoKHR_fn)(
157*4882a593Smuzhiyun     const cl_context_properties * properties,
158*4882a593Smuzhiyun     cl_gl_context_info            param_name,
159*4882a593Smuzhiyun     size_t                        param_value_size,
160*4882a593Smuzhiyun     void *                        param_value,
161*4882a593Smuzhiyun     size_t *                      param_value_size_ret);
162*4882a593Smuzhiyun 
163*4882a593Smuzhiyun #ifdef __cplusplus
164*4882a593Smuzhiyun }
165*4882a593Smuzhiyun #endif
166*4882a593Smuzhiyun 
167*4882a593Smuzhiyun #endif  /* __OPENCL_CL_GL_H */
168