blob: 58b6449f9b4e98d561ee9a6f8b3daa6caede9f44 [file] [log] [blame]
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001/**********************************************************************************
Anthony Barbier8b2fdc92018-08-09 11:42:38 +01002 * Copyright (c) 2008-2018 The Khronos Group Inc.
Anthony Barbier6ff3b192017-09-04 18:44:23 +01003 *
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 *
Pablo Telloe86a09f2018-01-11 15:44:48 +000015 * MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
16 * KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
17 * SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
18 * https://www.khronos.org/registry/
19 *
Anthony Barbier6ff3b192017-09-04 18:44:23 +010020 * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
24 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26 * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
27 **********************************************************************************/
28
29#ifndef __OPENCL_CL_GL_H
30#define __OPENCL_CL_GL_H
31
32#ifdef __APPLE__
33#include <OpenCL/cl.h>
34#else
35#include <CL/cl.h>
36#endif
37
38#ifdef __cplusplus
39extern "C" {
40#endif
41
42typedef cl_uint cl_gl_object_type;
43typedef cl_uint cl_gl_texture_info;
44typedef cl_uint cl_gl_platform_info;
45typedef struct __GLsync *cl_GLsync;
46
47/* cl_gl_object_type = 0x2000 - 0x200F enum values are currently taken */
48#define CL_GL_OBJECT_BUFFER 0x2000
49#define CL_GL_OBJECT_TEXTURE2D 0x2001
50#define CL_GL_OBJECT_TEXTURE3D 0x2002
51#define CL_GL_OBJECT_RENDERBUFFER 0x2003
Anthony Barbier8b2fdc92018-08-09 11:42:38 +010052#ifdef CL_VERSION_1_2
Anthony Barbier6ff3b192017-09-04 18:44:23 +010053#define CL_GL_OBJECT_TEXTURE2D_ARRAY 0x200E
54#define CL_GL_OBJECT_TEXTURE1D 0x200F
55#define CL_GL_OBJECT_TEXTURE1D_ARRAY 0x2010
56#define CL_GL_OBJECT_TEXTURE_BUFFER 0x2011
Anthony Barbier8b2fdc92018-08-09 11:42:38 +010057#endif
Anthony Barbier6ff3b192017-09-04 18:44:23 +010058
59/* cl_gl_texture_info */
60#define CL_GL_TEXTURE_TARGET 0x2004
61#define CL_GL_MIPMAP_LEVEL 0x2005
Anthony Barbier8b2fdc92018-08-09 11:42:38 +010062#ifdef CL_VERSION_1_2
Anthony Barbier6ff3b192017-09-04 18:44:23 +010063#define CL_GL_NUM_SAMPLES 0x2012
Anthony Barbier8b2fdc92018-08-09 11:42:38 +010064#endif
Anthony Barbier6ff3b192017-09-04 18:44:23 +010065
66
67extern CL_API_ENTRY cl_mem CL_API_CALL
68clCreateFromGLBuffer(cl_context /* context */,
69 cl_mem_flags /* flags */,
70 cl_GLuint /* bufobj */,
71 int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
72
Anthony Barbier8b2fdc92018-08-09 11:42:38 +010073#ifdef CL_VERSION_1_2
74
Anthony Barbier6ff3b192017-09-04 18:44:23 +010075extern CL_API_ENTRY cl_mem CL_API_CALL
76clCreateFromGLTexture(cl_context /* context */,
77 cl_mem_flags /* flags */,
78 cl_GLenum /* target */,
79 cl_GLint /* miplevel */,
80 cl_GLuint /* texture */,
81 cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_2;
82
Anthony Barbier8b2fdc92018-08-09 11:42:38 +010083#endif
84
Anthony Barbier6ff3b192017-09-04 18:44:23 +010085extern CL_API_ENTRY cl_mem CL_API_CALL
86clCreateFromGLRenderbuffer(cl_context /* context */,
87 cl_mem_flags /* flags */,
88 cl_GLuint /* renderbuffer */,
89 cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
90
91extern CL_API_ENTRY cl_int CL_API_CALL
92clGetGLObjectInfo(cl_mem /* memobj */,
93 cl_gl_object_type * /* gl_object_type */,
94 cl_GLuint * /* gl_object_name */) CL_API_SUFFIX__VERSION_1_0;
95
96extern CL_API_ENTRY cl_int CL_API_CALL
97clGetGLTextureInfo(cl_mem /* memobj */,
98 cl_gl_texture_info /* param_name */,
99 size_t /* param_value_size */,
100 void * /* param_value */,
101 size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
102
103extern CL_API_ENTRY cl_int CL_API_CALL
104clEnqueueAcquireGLObjects(cl_command_queue /* command_queue */,
105 cl_uint /* num_objects */,
106 const cl_mem * /* mem_objects */,
107 cl_uint /* num_events_in_wait_list */,
108 const cl_event * /* event_wait_list */,
109 cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
110
111extern CL_API_ENTRY cl_int CL_API_CALL
112clEnqueueReleaseGLObjects(cl_command_queue /* command_queue */,
113 cl_uint /* num_objects */,
114 const cl_mem * /* mem_objects */,
115 cl_uint /* num_events_in_wait_list */,
116 const cl_event * /* event_wait_list */,
117 cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
118
119
Pablo Telloe86a09f2018-01-11 15:44:48 +0000120/* Deprecated OpenCL 1.1 APIs */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100121extern CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem CL_API_CALL
122clCreateFromGLTexture2D(cl_context /* context */,
123 cl_mem_flags /* flags */,
124 cl_GLenum /* target */,
125 cl_GLint /* miplevel */,
126 cl_GLuint /* texture */,
127 cl_int * /* errcode_ret */) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED;
128
129extern CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem CL_API_CALL
130clCreateFromGLTexture3D(cl_context /* context */,
131 cl_mem_flags /* flags */,
132 cl_GLenum /* target */,
133 cl_GLint /* miplevel */,
134 cl_GLuint /* texture */,
135 cl_int * /* errcode_ret */) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED;
136
137/* cl_khr_gl_sharing extension */
138
139#define cl_khr_gl_sharing 1
140
141typedef cl_uint cl_gl_context_info;
142
143/* Additional Error Codes */
144#define CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR -1000
145
146/* cl_gl_context_info */
147#define CL_CURRENT_DEVICE_FOR_GL_CONTEXT_KHR 0x2006
148#define CL_DEVICES_FOR_GL_CONTEXT_KHR 0x2007
149
150/* Additional cl_context_properties */
151#define CL_GL_CONTEXT_KHR 0x2008
152#define CL_EGL_DISPLAY_KHR 0x2009
153#define CL_GLX_DISPLAY_KHR 0x200A
154#define CL_WGL_HDC_KHR 0x200B
155#define CL_CGL_SHAREGROUP_KHR 0x200C
156
157extern CL_API_ENTRY cl_int CL_API_CALL
158clGetGLContextInfoKHR(const cl_context_properties * /* properties */,
159 cl_gl_context_info /* param_name */,
160 size_t /* param_value_size */,
161 void * /* param_value */,
162 size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
163
164typedef CL_API_ENTRY cl_int (CL_API_CALL *clGetGLContextInfoKHR_fn)(
165 const cl_context_properties * properties,
166 cl_gl_context_info param_name,
167 size_t param_value_size,
168 void * param_value,
169 size_t * param_value_size_ret);
170
171#ifdef __cplusplus
172}
173#endif
174
175#endif /* __OPENCL_CL_GL_H */