/packages/univint/src/CVOpenGLBufferPool.pas

https://github.com/slibre/freepascal · Pascal · 275 lines · 16 code · 28 blank · 231 comment · 0 complexity · a088c314551bb22ce544ecf756618ba4 MD5 · raw file

  1. {
  2. * CVOpenGLBufferPool.h
  3. * CoreVideo
  4. *
  5. * Copyright 2004 Apple Computer, Inc. All rights reserved.
  6. *
  7. }
  8. { Pascal Translation: Gorazd Krosl, <gorazd_1957@yahoo.ca>, 2009 }
  9. { Pascal Translation Update: Jonas Maebe <jonas@freepascal.org>, October 2012 }
  10. {
  11. Modified for use with Free Pascal
  12. Version 308
  13. Please report any bugs to <gpc@microbizz.nl>
  14. }
  15. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  16. {$mode macpas}
  17. {$packenum 1}
  18. {$macro on}
  19. {$inline on}
  20. {$calling mwpascal}
  21. unit CVOpenGLBufferPool;
  22. interface
  23. {$setc UNIVERSAL_INTERFACES_VERSION := $0400}
  24. {$setc GAP_INTERFACES_VERSION := $0308}
  25. {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
  26. {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
  27. {$endc}
  28. {$ifc defined CPUPOWERPC and defined CPUI386}
  29. {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
  30. {$endc}
  31. {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
  32. {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
  33. {$endc}
  34. {$ifc not defined __ppc__ and defined CPUPOWERPC32}
  35. {$setc __ppc__ := 1}
  36. {$elsec}
  37. {$setc __ppc__ := 0}
  38. {$endc}
  39. {$ifc not defined __ppc64__ and defined CPUPOWERPC64}
  40. {$setc __ppc64__ := 1}
  41. {$elsec}
  42. {$setc __ppc64__ := 0}
  43. {$endc}
  44. {$ifc not defined __i386__ and defined CPUI386}
  45. {$setc __i386__ := 1}
  46. {$elsec}
  47. {$setc __i386__ := 0}
  48. {$endc}
  49. {$ifc not defined __x86_64__ and defined CPUX86_64}
  50. {$setc __x86_64__ := 1}
  51. {$elsec}
  52. {$setc __x86_64__ := 0}
  53. {$endc}
  54. {$ifc not defined __arm__ and defined CPUARM}
  55. {$setc __arm__ := 1}
  56. {$elsec}
  57. {$setc __arm__ := 0}
  58. {$endc}
  59. {$ifc defined cpu64}
  60. {$setc __LP64__ := 1}
  61. {$elsec}
  62. {$setc __LP64__ := 0}
  63. {$endc}
  64. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  65. {$error Conflicting definitions for __ppc__ and __i386__}
  66. {$endc}
  67. {$ifc defined __ppc__ and __ppc__}
  68. {$setc TARGET_CPU_PPC := TRUE}
  69. {$setc TARGET_CPU_PPC64 := FALSE}
  70. {$setc TARGET_CPU_X86 := FALSE}
  71. {$setc TARGET_CPU_X86_64 := FALSE}
  72. {$setc TARGET_CPU_ARM := FALSE}
  73. {$setc TARGET_OS_MAC := TRUE}
  74. {$setc TARGET_OS_IPHONE := FALSE}
  75. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  76. {$setc TARGET_OS_EMBEDDED := FALSE}
  77. {$elifc defined __ppc64__ and __ppc64__}
  78. {$setc TARGET_CPU_PPC := FALSE}
  79. {$setc TARGET_CPU_PPC64 := TRUE}
  80. {$setc TARGET_CPU_X86 := FALSE}
  81. {$setc TARGET_CPU_X86_64 := FALSE}
  82. {$setc TARGET_CPU_ARM := FALSE}
  83. {$setc TARGET_OS_MAC := TRUE}
  84. {$setc TARGET_OS_IPHONE := FALSE}
  85. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  86. {$setc TARGET_OS_EMBEDDED := FALSE}
  87. {$elifc defined __i386__ and __i386__}
  88. {$setc TARGET_CPU_PPC := FALSE}
  89. {$setc TARGET_CPU_PPC64 := FALSE}
  90. {$setc TARGET_CPU_X86 := TRUE}
  91. {$setc TARGET_CPU_X86_64 := FALSE}
  92. {$setc TARGET_CPU_ARM := FALSE}
  93. {$ifc defined(iphonesim)}
  94. {$setc TARGET_OS_MAC := FALSE}
  95. {$setc TARGET_OS_IPHONE := TRUE}
  96. {$setc TARGET_IPHONE_SIMULATOR := TRUE}
  97. {$elsec}
  98. {$setc TARGET_OS_MAC := TRUE}
  99. {$setc TARGET_OS_IPHONE := FALSE}
  100. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  101. {$endc}
  102. {$setc TARGET_OS_EMBEDDED := FALSE}
  103. {$elifc defined __x86_64__ and __x86_64__}
  104. {$setc TARGET_CPU_PPC := FALSE}
  105. {$setc TARGET_CPU_PPC64 := FALSE}
  106. {$setc TARGET_CPU_X86 := FALSE}
  107. {$setc TARGET_CPU_X86_64 := TRUE}
  108. {$setc TARGET_CPU_ARM := FALSE}
  109. {$setc TARGET_OS_MAC := TRUE}
  110. {$setc TARGET_OS_IPHONE := FALSE}
  111. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  112. {$setc TARGET_OS_EMBEDDED := FALSE}
  113. {$elifc defined __arm__ and __arm__}
  114. {$setc TARGET_CPU_PPC := FALSE}
  115. {$setc TARGET_CPU_PPC64 := FALSE}
  116. {$setc TARGET_CPU_X86 := FALSE}
  117. {$setc TARGET_CPU_X86_64 := FALSE}
  118. {$setc TARGET_CPU_ARM := TRUE}
  119. { will require compiler define when/if other Apple devices with ARM cpus ship }
  120. {$setc TARGET_OS_MAC := FALSE}
  121. {$setc TARGET_OS_IPHONE := TRUE}
  122. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  123. {$setc TARGET_OS_EMBEDDED := TRUE}
  124. {$elsec}
  125. {$error __ppc__ nor __ppc64__ nor __i386__ nor __x86_64__ nor __arm__ is defined.}
  126. {$endc}
  127. {$ifc defined __LP64__ and __LP64__ }
  128. {$setc TARGET_CPU_64 := TRUE}
  129. {$elsec}
  130. {$setc TARGET_CPU_64 := FALSE}
  131. {$endc}
  132. {$ifc defined FPC_BIG_ENDIAN}
  133. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  134. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  135. {$elifc defined FPC_LITTLE_ENDIAN}
  136. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  137. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  138. {$elsec}
  139. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  140. {$endc}
  141. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  142. {$setc CALL_NOT_IN_CARBON := FALSE}
  143. {$setc OLDROUTINENAMES := FALSE}
  144. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  145. {$setc OPAQUE_UPP_TYPES := TRUE}
  146. {$setc OTCARBONAPPLICATION := TRUE}
  147. {$setc OTKERNEL := FALSE}
  148. {$setc PM_USE_SESSION_APIS := TRUE}
  149. {$setc TARGET_API_MAC_CARBON := TRUE}
  150. {$setc TARGET_API_MAC_OS8 := FALSE}
  151. {$setc TARGET_API_MAC_OSX := TRUE}
  152. {$setc TARGET_CARBON := TRUE}
  153. {$setc TARGET_CPU_68K := FALSE}
  154. {$setc TARGET_CPU_MIPS := FALSE}
  155. {$setc TARGET_CPU_SPARC := FALSE}
  156. {$setc TARGET_OS_UNIX := FALSE}
  157. {$setc TARGET_OS_WIN32 := FALSE}
  158. {$setc TARGET_RT_MAC_68881 := FALSE}
  159. {$setc TARGET_RT_MAC_CFM := FALSE}
  160. {$setc TARGET_RT_MAC_MACHO := TRUE}
  161. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  162. {$setc TYPE_BOOL := FALSE}
  163. {$setc TYPE_EXTENDED := FALSE}
  164. {$setc TYPE_LONGLONG := TRUE}
  165. uses MacTypes,CFBase,CFString,CFDictionary,CVBase,CVReturns,CVOpenGLBuffer;
  166. {$endc} {not MACOSALLINCLUDE}
  167. {$ifc TARGET_OS_MAC}
  168. {$ALIGN POWER}
  169. {! @header CVOpenGLBufferPool.h
  170. @copyright 2004 Apple Computer, Inc. All rights reserved.
  171. @availability Mac OS X 10.4 or later
  172. @discussion CVOpenGLBufferPool is a utility object for managing a set of CVOpenGLBuffer objects that are going to be recycled.
  173. }
  174. type
  175. CVOpenGLBufferPoolRef = ^__CVOpenGLBufferPool; { an opaque type }
  176. __CVOpenGLBufferPool = record end;
  177. var kCVOpenGLBufferPoolMinimumBufferCountKey: CFStringRef; external name '_kCVOpenGLBufferPoolMinimumBufferCountKey'; (* attribute const *)
  178. (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
  179. // By default, buffers will age out after one second. If required, setting an age of zero will disable
  180. // the age-out mechanism completely.
  181. var kCVOpenGLBufferPoolMaximumBufferAgeKey: CFStringRef; external name '_kCVOpenGLBufferPoolMaximumBufferAgeKey'; (* attribute const *)
  182. (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
  183. function CVOpenGLBufferPoolGetTypeID: CFTypeID; external name '_CVOpenGLBufferPoolGetTypeID';
  184. (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
  185. {!
  186. @function CVOpenGLBufferPoolRetain
  187. @abstract Retains a CVOpenGLBufferPoolRef object
  188. @discussion Equivalent to CFRetain, but NULL safe
  189. @param buffer A CVOpenGLBufferPoolRef object that you want to retain.
  190. @result A CVOpenGLBufferPoolRef object that is the same as the passed in buffer.
  191. }
  192. function CVOpenGLBufferPoolRetain( openGLBufferPool: CVOpenGLBufferPoolRef ): CVOpenGLBufferPoolRef; external name '_CVOpenGLBufferPoolRetain';
  193. (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) // NULL-safe
  194. {!
  195. @function CVOpenGLBufferPoolRelease
  196. @abstract Releases a CVOpenGLBufferPoolRef object
  197. @discussion Equivalent to CFRelease, but NULL safe
  198. @param buffer A CVOpenGLBufferPoolRef object that you want to release.
  199. }
  200. procedure CVOpenGLBufferPoolRelease( openGLBufferPool: CVOpenGLBufferPoolRef ); external name '_CVOpenGLBufferPoolRelease';
  201. (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) // NULL-safe
  202. {!
  203. @function CVOpenGLBufferPoolCreate
  204. @abstract Creates a new OpenGL Buffer pool.
  205. @discussion Equivalent to CFRelease, but NULL safe
  206. @param allocator The CFAllocatorRef to use for allocating this buffer pool. May be NULL.
  207. @param poolAttributes A CFDictionaryRef containing the attributes to be used for the pool itself.
  208. @param openGLBufferAttributes A CFDictionaryRef containing the attributes to be used for creating new OpenGLBuffers within the pool.
  209. @param poolOut The newly created pool will be placed here
  210. @result Returns kCVReturnSuccess on success
  211. }
  212. function CVOpenGLBufferPoolCreate( allocator: CFAllocatorRef; poolAttributes: CFDictionaryRef; openGLBufferAttributes: CFDictionaryRef; var poolOut: CVOpenGLBufferPoolRef ): CVReturn; external name '_CVOpenGLBufferPoolCreate';
  213. (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
  214. {!
  215. @function CVOpenGLBufferPoolGetOpenGLBufferAttributes
  216. @abstract Returns the pool attributes dictionary for a CVOpenGLBufferPool
  217. @param pool The CVOpenGLBufferPoolRef to retrieve the attributes from
  218. @result Returns the pool attributes dictionary, or NULL on failure.
  219. }
  220. function CVOpenGLBufferPoolGetAttributes( pool: CVOpenGLBufferPoolRef ): CFDictionaryRef; external name '_CVOpenGLBufferPoolGetAttributes';
  221. (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
  222. {!
  223. @function CVOpenGLBufferPoolGetOpenGLBufferAttributes
  224. @abstract Returns the attributes of OpenGL buffers that will be created from this pool.
  225. @discussion This function is provided for those cases where you may need to know some information about the buffers that
  226. will be created up front.
  227. @param pool The CVOpenGLBufferPoolRef to retrieve the attributes from
  228. @result Returns the OpenGL buffer attributes dictionary, or NULL on failure.
  229. }
  230. function CVOpenGLBufferPoolGetOpenGLBufferAttributes( pool: CVOpenGLBufferPoolRef ): CFDictionaryRef; external name '_CVOpenGLBufferPoolGetOpenGLBufferAttributes';
  231. (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
  232. {!
  233. @function CVOpenGLBufferPoolCreateOpenGLBuffer
  234. @abstract Creates a new OpenGLBuffer object from the pool.
  235. @discussion The function creates a new CVOpenGLBuffer with the default attachments using the OpenGL buffer attributes specifed during pool creation.
  236. @param allocator The CFAllocatorRef to use for creating the OpenGL buffer. May be NULL.
  237. @param openGLBufferPool The CVOpenGLBufferPool that should create the new CVOpenGLBuffer.
  238. @param openGLBufferOut The newly created OpenGL buffer will be placed here
  239. @result Returns kCVReturnSuccess on success
  240. }
  241. function CVOpenGLBufferPoolCreateOpenGLBuffer( allocator: CFAllocatorRef; openGLBufferPool: CVOpenGLBufferPoolRef; var openGLBufferOut: CVOpenGLBufferRef ): CVReturn; external name '_CVOpenGLBufferPoolCreateOpenGLBuffer';
  242. (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
  243. {$endc} // TARGET_OS_MAC
  244. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  245. end.
  246. {$endc} {not MACOSALLINCLUDE}