cl_gl.h 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. /**********************************************************************************
  2. * Copyright (c) 2008 - 2012 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. #ifndef __OPENCL_CL_GL_H
  24. #define __OPENCL_CL_GL_H
  25. #ifdef __APPLE__
  26. #include <OpenCL/cl.h>
  27. #else
  28. #include <CL/cl.h>
  29. #endif
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33. typedef cl_uint cl_gl_object_type;
  34. typedef cl_uint cl_gl_texture_info;
  35. typedef cl_uint cl_gl_platform_info;
  36. typedef struct __GLsync *cl_GLsync;
  37. /* cl_gl_object_type = 0x2000 - 0x200F enum values are currently taken */
  38. #define CL_GL_OBJECT_BUFFER 0x2000
  39. #define CL_GL_OBJECT_TEXTURE2D 0x2001
  40. #define CL_GL_OBJECT_TEXTURE3D 0x2002
  41. #define CL_GL_OBJECT_RENDERBUFFER 0x2003
  42. #define CL_GL_OBJECT_TEXTURE2D_ARRAY 0x200E
  43. #define CL_GL_OBJECT_TEXTURE1D 0x200F
  44. #define CL_GL_OBJECT_TEXTURE1D_ARRAY 0x2010
  45. #define CL_GL_OBJECT_TEXTURE_BUFFER 0x2011
  46. /* cl_gl_texture_info */
  47. #define CL_GL_TEXTURE_TARGET 0x2004
  48. #define CL_GL_MIPMAP_LEVEL 0x2005
  49. #define CL_GL_NUM_SAMPLES 0x2012
  50. extern CL_API_ENTRY cl_mem CL_API_CALL
  51. clCreateFromGLBuffer(cl_context /* context */,
  52. cl_mem_flags /* flags */,
  53. cl_GLuint /* bufobj */,
  54. int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
  55. extern CL_API_ENTRY cl_mem CL_API_CALL
  56. clCreateFromGLTexture(cl_context /* context */,
  57. cl_mem_flags /* flags */,
  58. cl_GLenum /* target */,
  59. cl_GLint /* miplevel */,
  60. cl_GLuint /* texture */,
  61. cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_2;
  62. extern CL_API_ENTRY cl_mem CL_API_CALL
  63. clCreateFromGLRenderbuffer(cl_context /* context */,
  64. cl_mem_flags /* flags */,
  65. cl_GLuint /* renderbuffer */,
  66. cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
  67. extern CL_API_ENTRY cl_int CL_API_CALL
  68. clGetGLObjectInfo(cl_mem /* memobj */,
  69. cl_gl_object_type * /* gl_object_type */,
  70. cl_GLuint * /* gl_object_name */) CL_API_SUFFIX__VERSION_1_0;
  71. extern CL_API_ENTRY cl_int CL_API_CALL
  72. clGetGLTextureInfo(cl_mem /* memobj */,
  73. cl_gl_texture_info /* param_name */,
  74. size_t /* param_value_size */,
  75. void * /* param_value */,
  76. size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
  77. extern CL_API_ENTRY cl_int CL_API_CALL
  78. clEnqueueAcquireGLObjects(cl_command_queue /* command_queue */,
  79. cl_uint /* num_objects */,
  80. const cl_mem * /* mem_objects */,
  81. cl_uint /* num_events_in_wait_list */,
  82. const cl_event * /* event_wait_list */,
  83. cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
  84. extern CL_API_ENTRY cl_int CL_API_CALL
  85. clEnqueueReleaseGLObjects(cl_command_queue /* command_queue */,
  86. cl_uint /* num_objects */,
  87. const cl_mem * /* mem_objects */,
  88. cl_uint /* num_events_in_wait_list */,
  89. const cl_event * /* event_wait_list */,
  90. cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
  91. // Deprecated OpenCL 1.1 APIs
  92. extern CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem CL_API_CALL
  93. clCreateFromGLTexture2D(cl_context /* context */,
  94. cl_mem_flags /* flags */,
  95. cl_GLenum /* target */,
  96. cl_GLint /* miplevel */,
  97. cl_GLuint /* texture */,
  98. cl_int * /* errcode_ret */) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED;
  99. extern CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem CL_API_CALL
  100. clCreateFromGLTexture3D(cl_context /* context */,
  101. cl_mem_flags /* flags */,
  102. cl_GLenum /* target */,
  103. cl_GLint /* miplevel */,
  104. cl_GLuint /* texture */,
  105. cl_int * /* errcode_ret */) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED;
  106. /* cl_khr_gl_sharing extension */
  107. #define cl_khr_gl_sharing 1
  108. typedef cl_uint cl_gl_context_info;
  109. /* Additional Error Codes */
  110. #define CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR -1000
  111. /* cl_gl_context_info */
  112. #define CL_CURRENT_DEVICE_FOR_GL_CONTEXT_KHR 0x2006
  113. #define CL_DEVICES_FOR_GL_CONTEXT_KHR 0x2007
  114. /* Additional cl_context_properties */
  115. #define CL_GL_CONTEXT_KHR 0x2008
  116. #define CL_EGL_DISPLAY_KHR 0x2009
  117. #define CL_GLX_DISPLAY_KHR 0x200A
  118. #define CL_WGL_HDC_KHR 0x200B
  119. #define CL_CGL_SHAREGROUP_KHR 0x200C
  120. extern CL_API_ENTRY cl_int CL_API_CALL
  121. clGetGLContextInfoKHR(const cl_context_properties * /* properties */,
  122. cl_gl_context_info /* param_name */,
  123. size_t /* param_value_size */,
  124. void * /* param_value */,
  125. size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
  126. typedef CL_API_ENTRY cl_int (CL_API_CALL *clGetGLContextInfoKHR_fn)(
  127. const cl_context_properties * properties,
  128. cl_gl_context_info param_name,
  129. size_t param_value_size,
  130. void * param_value,
  131. size_t * param_value_size_ret);
  132. #ifdef __cplusplus
  133. }
  134. #endif
  135. #endif /* __OPENCL_CL_GL_H */