Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | RSS feed

  1. /**********************************************************************************
  2.  * Copyright (c) 2008-2010 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. /* $Revision: 11708 $ on $Date: 2010-06-13 23:36:24 -0700 (Sun, 13 Jun 2010) $ */
  25.  
  26. /*
  27.  * cl_gl.h contains Khronos-approved (KHR) OpenCL extensions which have
  28.  * OpenGL dependencies. The application is responsible for #including
  29.  * OpenGL or OpenGL ES headers before #including cl_gl.h.
  30.  */
  31.  
  32. #ifndef __OPENCL_CL_GL_H
  33. #define __OPENCL_CL_GL_H
  34.  
  35. #ifdef __APPLE__
  36. #include <OpenCL/cl.h>
  37. #include <OpenGL/CGLDevice.h>
  38. #else
  39. #include <CL/cl.h>
  40. #endif 
  41.  
  42. #ifdef __cplusplus
  43. extern "C" {
  44. #endif
  45.  
  46. typedef cl_uint     cl_gl_object_type;
  47. typedef cl_uint     cl_gl_texture_info;
  48. typedef cl_uint     cl_gl_platform_info;
  49. typedef struct __GLsync *cl_GLsync;
  50.  
  51. /* cl_gl_object_type */
  52. #define CL_GL_OBJECT_BUFFER             0x2000
  53. #define CL_GL_OBJECT_TEXTURE2D          0x2001
  54. #define CL_GL_OBJECT_TEXTURE3D          0x2002
  55. #define CL_GL_OBJECT_RENDERBUFFER       0x2003
  56.  
  57. /* cl_gl_texture_info */
  58. #define CL_GL_TEXTURE_TARGET            0x2004
  59. #define CL_GL_MIPMAP_LEVEL              0x2005
  60.  
  61. extern CL_API_ENTRY cl_mem CL_API_CALL
  62. clCreateFromGLBuffer(cl_context     /* context */,
  63.                      cl_mem_flags   /* flags */,
  64.                      cl_GLuint      /* bufobj */,
  65.                      int *          /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
  66.  
  67. extern CL_API_ENTRY cl_mem CL_API_CALL
  68. clCreateFromGLTexture2D(cl_context      /* context */,
  69.                         cl_mem_flags    /* flags */,
  70.                         cl_GLenum       /* target */,
  71.                         cl_GLint        /* miplevel */,
  72.                         cl_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. clCreateFromGLTexture3D(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_0;
  82.  
  83. extern CL_API_ENTRY cl_mem CL_API_CALL
  84. clCreateFromGLRenderbuffer(cl_context   /* context */,
  85.                            cl_mem_flags /* flags */,
  86.                            cl_GLuint    /* renderbuffer */,
  87.                            cl_int *     /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
  88.  
  89. extern CL_API_ENTRY cl_int CL_API_CALL
  90. clGetGLObjectInfo(cl_mem                /* memobj */,
  91.                   cl_gl_object_type *   /* gl_object_type */,
  92.                   cl_GLuint *              /* gl_object_name */) CL_API_SUFFIX__VERSION_1_0;
  93.                  
  94. extern CL_API_ENTRY cl_int CL_API_CALL
  95. clGetGLTextureInfo(cl_mem               /* memobj */,
  96.                    cl_gl_texture_info   /* param_name */,
  97.                    size_t               /* param_value_size */,
  98.                    void *               /* param_value */,
  99.                    size_t *             /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
  100.  
  101. extern CL_API_ENTRY cl_int CL_API_CALL
  102. clEnqueueAcquireGLObjects(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. extern CL_API_ENTRY cl_int CL_API_CALL
  110. clEnqueueReleaseGLObjects(cl_command_queue      /* command_queue */,
  111.                           cl_uint               /* num_objects */,
  112.                           const cl_mem *        /* mem_objects */,
  113.                           cl_uint               /* num_events_in_wait_list */,
  114.                           const cl_event *      /* event_wait_list */,
  115.                           cl_event *            /* event */) CL_API_SUFFIX__VERSION_1_0;
  116.  
  117. /* cl_khr_gl_sharing extension  */
  118.  
  119. #define cl_khr_gl_sharing 1
  120.  
  121. typedef cl_uint     cl_gl_context_info;
  122.  
  123. /* Additional Error Codes  */
  124. #define CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR  -1000
  125.  
  126. /* cl_gl_context_info  */
  127. #define CL_CURRENT_DEVICE_FOR_GL_CONTEXT_KHR    0x2006
  128. #define CL_DEVICES_FOR_GL_CONTEXT_KHR           0x2007
  129.  
  130. /* Additional cl_context_properties  */
  131. #define CL_GL_CONTEXT_KHR                       0x2008
  132. #define CL_EGL_DISPLAY_KHR                      0x2009
  133. #define CL_GLX_DISPLAY_KHR                      0x200A
  134. #define CL_WGL_HDC_KHR                          0x200B
  135. #define CL_CGL_SHAREGROUP_KHR                   0x200C
  136.  
  137. extern CL_API_ENTRY cl_int CL_API_CALL
  138. clGetGLContextInfoKHR(const cl_context_properties * /* properties */,
  139.                       cl_gl_context_info            /* param_name */,
  140.                       size_t                        /* param_value_size */,
  141.                       void *                        /* param_value */,
  142.                       size_t *                      /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
  143.  
  144. typedef CL_API_ENTRY cl_int (CL_API_CALL *clGetGLContextInfoKHR_fn)(
  145.     const cl_context_properties * properties,
  146.     cl_gl_context_info            param_name,
  147.     size_t                        param_value_size,
  148.     void *                        param_value,
  149.     size_t *                      param_value_size_ret);
  150.  
  151. #ifdef __cplusplus
  152. }
  153. #endif
  154.  
  155. #endif  /* __OPENCL_CL_GL_H  */
  156.