cl_gl.pp 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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. // ported to FPC by Dmitry 'skalogryz' Boyarintsev: 28th apr 2009
  24. {$IFNDEF FPC_DOTTEDUNITS}
  25. unit cl_gl;
  26. {$ENDIF FPC_DOTTEDUNITS}
  27. interface
  28. {$IFDEF FPC_DOTTEDUNITS}
  29. uses
  30. OpenCLApi.Cl, Api.OpenGL.Gl, System.CTypes;
  31. {$ELSE FPC_DOTTEDUNITS}
  32. uses
  33. cl, gl, ctypes;
  34. {$ENDIF FPC_DOTTEDUNITS}
  35. // NOTE: Make sure that appropriate GL header file is included separately
  36. type
  37. cl_gl_object_type = cl_uint;
  38. cl_gl_texture_info = cl_uint;
  39. cl_gl_platform_info = cl_uint;
  40. const
  41. // cl_gl_object_type
  42. CL_GL_OBJECT_BUFFER = $2000;
  43. CL_GL_OBJECT_TEXTURE2D = $2001;
  44. CL_GL_OBJECT_TEXTURE3D = $2002;
  45. CL_GL_OBJECT_RENDERBUFFER = $2003;
  46. // cl_gl_texture_info
  47. CL_GL_TEXTURE_TARGET = $2004;
  48. CL_GL_MIPMAP_LEVEL = $2005;
  49. CL_GL_CONTEXT_KHR = $2008;
  50. CL_EGL_DISPLAY_KHR = $2009;
  51. CL_GLX_DISPLAY_KHR = $200A;
  52. CL_WGL_HDC_KHR = $200B;
  53. CL_CGL_SHAREGROUP_KHR = $200C;
  54. function clCreateFromGLBuffer(context: cl_context; falgs: cl_mem_flags;
  55. bufobj: GLuint; var errcode_ret: cl_int
  56. ): cl_mem; cdecl; external name 'clCreateFromGLBuffer';
  57. function clCreateFromGLTexture2D(context: cl_context;
  58. flags: cl_mem_flags; target: GLenum; miplevel: GLint;
  59. texture: GLuint; var errcode_ret: cl_int
  60. ): cl_mem; cdecl; external name 'clCreateFromGLTexture2D';
  61. function clCreateFromGLTexture3D(context: cl_context; flags: cl_mem_flags;
  62. target: GLenum; miplevel: GLint; texture: GLuint; var errorcode: cl_int
  63. ): cl_mem; cdecl; external name 'clCreateFromGLTexture3D';
  64. function clCreateFromGLRenderbuffer(context: cl_context;
  65. flags: cl_mem_flags; renderbuffer: GLuint; var errcode: cl_int
  66. ): cl_mem; cdecl; external name 'clCreateFromGLRenderbuffer';
  67. function clGetGLObjectInfo(memobj: cl_mem; gl_object_type: cl_gl_object_type;
  68. object_name: GLuint
  69. ): cl_int; cdecl; external name 'clGetGLObjectInfo';
  70. function clGetGLTextureInfo(memobj: cl_mem; param_name: cl_gl_texture_info;
  71. value_size: csize_t; value: Pointer; var size_ret: pcsize_t
  72. ): cl_int; cdecl; external name 'clGetGLTextureInfo';
  73. function clEnqueueAcquireGLObjects(command_queue: cl_command_queue;
  74. num_objects: cl_uint; mem_objects: Pcl_mem;
  75. num_events: cl_uint; events_list : Pcl_event; event: Pcl_event
  76. ): cl_int; cdecl; external name 'clEnqueueAcquireGLObjects';
  77. function clEnqueueReleaseGLObjects(command_queue: cl_command_queue;
  78. num_objects: cl_uint; mem_objects: Pcl_mem;
  79. num_events: cl_uint; events_list : Pcl_event; event: Pcl_event
  80. ): cl_int; cdecl; external name 'clEnqueueReleaseGLObjects';
  81. implementation
  82. end.