cl_gl.h 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. /**********************************************************************************
  2. * Copyright (c) 2011 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.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. extern CL_API_ENTRY cl_mem CL_API_CALL
  50. clCreateFromGLBuffer(cl_context /* context */,
  51. cl_mem_flags /* flags */,
  52. cl_GLuint /* bufobj */,
  53. int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
  54. extern CL_API_ENTRY cl_mem CL_API_CALL
  55. clCreateFromGLTexture(cl_context /* context */,
  56. cl_mem_flags /* flags */,
  57. cl_GLenum /* target */,
  58. cl_GLint /* miplevel */,
  59. cl_GLuint /* texture */,
  60. cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_2;
  61. extern CL_API_ENTRY cl_mem CL_API_CALL
  62. clCreateFromGLRenderbuffer(cl_context /* context */,
  63. cl_mem_flags /* flags */,
  64. cl_GLuint /* renderbuffer */,
  65. cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
  66. extern CL_API_ENTRY cl_int CL_API_CALL
  67. clGetGLObjectInfo(cl_mem /* memobj */,
  68. cl_gl_object_type * /* gl_object_type */,
  69. cl_GLuint * /* gl_object_name */) CL_API_SUFFIX__VERSION_1_0;
  70. extern CL_API_ENTRY cl_int CL_API_CALL
  71. clGetGLTextureInfo(cl_mem /* memobj */,
  72. cl_gl_texture_info /* param_name */,
  73. size_t /* param_value_size */,
  74. void * /* param_value */,
  75. size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
  76. extern CL_API_ENTRY cl_int CL_API_CALL
  77. clEnqueueAcquireGLObjects(cl_command_queue /* command_queue */,
  78. cl_uint /* num_objects */,
  79. const cl_mem * /* mem_objects */,
  80. cl_uint /* num_events_in_wait_list */,
  81. const cl_event * /* event_wait_list */,
  82. cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
  83. extern CL_API_ENTRY cl_int CL_API_CALL
  84. clEnqueueReleaseGLObjects(cl_command_queue /* command_queue */,
  85. cl_uint /* num_objects */,
  86. const cl_mem * /* mem_objects */,
  87. cl_uint /* num_events_in_wait_list */,
  88. const cl_event * /* event_wait_list */,
  89. cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
  90. #ifdef CL_USE_DEPRECATED_OPENCL_1_1_APIS
  91. #ifndef BUILDING_SOCL
  92. #warning CL_USE_DEPRECATED_OPENCL_1_1_APIS is defined. These APIs are unsupported and untested in OpenCL 1.2!
  93. #endif
  94. extern CL_API_ENTRY cl_mem CL_API_CALL
  95. clCreateFromGLTexture2D(cl_context /* context */,
  96. cl_mem_flags /* flags */,
  97. cl_GLenum /* target */,
  98. cl_GLint /* miplevel */,
  99. cl_GLuint /* texture */,
  100. cl_int * /* errcode_ret */) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED;
  101. extern CL_API_ENTRY cl_mem CL_API_CALL
  102. clCreateFromGLTexture3D(cl_context /* context */,
  103. cl_mem_flags /* flags */,
  104. cl_GLenum /* target */,
  105. cl_GLint /* miplevel */,
  106. cl_GLuint /* texture */,
  107. cl_int * /* errcode_ret */) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED;
  108. #endif /* CL_USE_DEPRECATED_OPENCL_1_2_APIS */
  109. /* cl_khr_gl_sharing extension */
  110. #define cl_khr_gl_sharing 1
  111. typedef cl_uint cl_gl_context_info;
  112. /* Additional Error Codes */
  113. #define CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR -1000
  114. /* cl_gl_context_info */
  115. #define CL_CURRENT_DEVICE_FOR_GL_CONTEXT_KHR 0x2006
  116. #define CL_DEVICES_FOR_GL_CONTEXT_KHR 0x2007
  117. /* Additional cl_context_properties */
  118. #define CL_GL_CONTEXT_KHR 0x2008
  119. #define CL_EGL_DISPLAY_KHR 0x2009
  120. #define CL_GLX_DISPLAY_KHR 0x200A
  121. #define CL_WGL_HDC_KHR 0x200B
  122. #define CL_CGL_SHAREGROUP_KHR 0x200C
  123. extern CL_API_ENTRY cl_int CL_API_CALL
  124. clGetGLContextInfoKHR(const cl_context_properties * /* properties */,
  125. cl_gl_context_info /* param_name */,
  126. size_t /* param_value_size */,
  127. void * /* param_value */,
  128. size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
  129. typedef CL_API_ENTRY cl_int (CL_API_CALL *clGetGLContextInfoKHR_fn)(
  130. const cl_context_properties * properties,
  131. cl_gl_context_info param_name,
  132. size_t param_value_size,
  133. void * param_value,
  134. size_t * param_value_size_ret);
  135. #ifdef __cplusplus
  136. }
  137. #endif
  138. #endif /* __OPENCL_CL_GL_H */