Imported Upstream version 2.81
[platform/upstream/libbullet.git] / src / MiniCL / cl_gl.h
1 /**********************************************************************************
2  * Copyright (c) 2008-2009 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_GL_H
25 #define __OPENCL_CL_GL_H
26
27 #ifdef __APPLE__
28 #include <OpenCL/cl_platform.h>
29 #else
30 #include <MiniCL/cl_platform.h>
31 #endif  
32
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36
37 // NOTE:  Make sure that appropriate GL header file is included separately
38
39 typedef cl_uint     cl_gl_object_type;
40 typedef cl_uint     cl_gl_texture_info;
41 typedef cl_uint     cl_gl_platform_info;
42
43 // cl_gl_object_type
44 #define CL_GL_OBJECT_BUFFER             0x2000
45 #define CL_GL_OBJECT_TEXTURE2D          0x2001
46 #define CL_GL_OBJECT_TEXTURE3D          0x2002
47 #define CL_GL_OBJECT_RENDERBUFFER       0x2003
48
49 // cl_gl_texture_info
50 #define CL_GL_TEXTURE_TARGET            0x2004
51 #define CL_GL_MIPMAP_LEVEL              0x2005
52
53 extern CL_API_ENTRY cl_mem CL_API_CALL
54 clCreateFromGLBuffer(cl_context     /* context */,
55                      cl_mem_flags   /* flags */,
56                      GLuint         /* bufobj */,
57                      int *          /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
58
59 extern CL_API_ENTRY cl_mem CL_API_CALL
60 clCreateFromGLTexture2D(cl_context      /* context */,
61                         cl_mem_flags    /* flags */,
62                         GLenum          /* target */,
63                         GLint           /* miplevel */,
64                         GLuint          /* texture */,
65                         cl_int *        /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
66
67 extern CL_API_ENTRY cl_mem CL_API_CALL
68 clCreateFromGLTexture3D(cl_context      /* context */,
69                         cl_mem_flags    /* flags */,
70                         GLenum          /* target */,
71                         GLint           /* miplevel */,
72                         GLuint          /* texture */,
73                         cl_int *        /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
74
75 extern CL_API_ENTRY cl_mem CL_API_CALL
76 clCreateFromGLRenderbuffer(cl_context   /* context */,
77                            cl_mem_flags /* flags */,
78                            GLuint       /* renderbuffer */,
79                            cl_int *     /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
80
81 extern CL_API_ENTRY cl_int CL_API_CALL
82 clGetGLObjectInfo(cl_mem                /* memobj */,
83                   cl_gl_object_type *   /* gl_object_type */,
84                   GLuint *              /* gl_object_name */) CL_API_SUFFIX__VERSION_1_0;
85                   
86 extern CL_API_ENTRY cl_int CL_API_CALL
87 clGetGLTextureInfo(cl_mem               /* memobj */,
88                    cl_gl_texture_info   /* param_name */,
89                    size_t               /* param_value_size */,
90                    void *               /* param_value */,
91                    size_t *             /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
92
93 extern CL_API_ENTRY cl_int CL_API_CALL
94 clEnqueueAcquireGLObjects(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 */) CL_API_SUFFIX__VERSION_1_0;
100
101 extern CL_API_ENTRY cl_int CL_API_CALL
102 clEnqueueReleaseGLObjects(cl_command_queue      /* command_queue */,
103                           cl_uint               /* num_objects */,
104                           const cl_mem *        /* mem_objects */,
105                           cl_uint               /* num_events_in_wait_list */,
106                           const cl_event *      /* event_wait_list */,
107                           cl_event *            /* event */) CL_API_SUFFIX__VERSION_1_0;
108
109 #ifdef __cplusplus
110 }
111 #endif
112
113 #endif  // __OPENCL_CL_GL_H