vdk.h 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470
  1. /****************************************************************************
  2. *
  3. * Copyright (c) 2005 - 2010 by Vivante Corp. All rights reserved.
  4. *
  5. * The material in this file is confidential and contains trade secrets
  6. * of Vivante Corporation. This is proprietary information owned by
  7. * Vivante Corporation. No part of this work may be disclosed,
  8. * reproduced, copied, transmitted, or used in any way for any purpose,
  9. * without the express written permission of Vivante Corporation.
  10. *
  11. *****************************************************************************
  12. *
  13. * Auto-generated file on 4/22/2010. Do not edit!!!
  14. *
  15. *****************************************************************************/
  16. #ifndef __vdk_h_
  17. #define __vdk_h_
  18. /* Include VDK types. */
  19. #include "vdkTypes.h"
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23. /*******************************************************************************
  24. ** Define VDKAPI and VDKLANG macros. *******************************************
  25. **
  26. ** VDKAPI Import or export function scope.
  27. ** VDKLANG Language defintion of function.
  28. */
  29. #ifdef WIN32
  30. # ifdef __VDK_EXPORT
  31. # define VDKAPI __declspec(dllexport)
  32. # else
  33. # define VDKAPI __declspec(dllimport)
  34. # endif
  35. # define VDKLANG __cdecl
  36. #else
  37. # define VDKAPI
  38. # define VDKLANG
  39. #endif
  40. /*******************************************************************************
  41. ** Initialization. *************************************************************
  42. */
  43. VDKAPI vdkPrivate VDKLANG
  44. vdkInitialize(
  45. void
  46. );
  47. VDKAPI void VDKLANG
  48. vdkExit(
  49. vdkPrivate Private
  50. );
  51. /*******************************************************************************
  52. ** Display. ********************************************************************
  53. */
  54. VDKAPI vdkDisplay VDKLANG
  55. vdkGetDisplay(
  56. vdkPrivate Private
  57. );
  58. VDKAPI int VDKLANG
  59. vdkGetDisplayInfo(
  60. vdkDisplay Display,
  61. int * Width,
  62. int * Height,
  63. unsigned long * Physical,
  64. int * Stride,
  65. int * BitsPerPixel
  66. );
  67. #if USE_FB_DOUBLE_BUFFER
  68. VDKAPI int VDKLANG
  69. vdkDisplayBuffer(
  70. vdkDisplay Display,
  71. int Buffer
  72. );
  73. #endif
  74. /* VFK_DISPLAY_INFO structure defining information returned by
  75. vdkGetDisplayInfoEx. */
  76. typedef struct _vdkDISPLAY_INFO
  77. {
  78. /* The size of the display in pixels. */
  79. int width;
  80. int height;
  81. /* The stride of the dispay. -1 is returned if the stride is not known
  82. for the specified display.*/
  83. int stride;
  84. /* The color depth of the display in bits per pixel. */
  85. int bitsPerPixel;
  86. /* The logical pointer to the display memory buffer. NULL is returned
  87. if the pointer is not known for the specified display. */
  88. void * logical;
  89. /* The physical address of the display memory buffer. ~0 is returned
  90. if the address is not known for the specified display. */
  91. unsigned long physical;
  92. }
  93. vdkDISPLAY_INFO;
  94. VDKAPI int VDKLANG
  95. vdkGetDisplayInfoEx(
  96. vdkDisplay Display,
  97. unsigned int DisplayInfoSize,
  98. vdkDISPLAY_INFO * DisplayInfo
  99. );
  100. VDKAPI void VDKLANG
  101. vdkDestroyDisplay(
  102. vdkDisplay Display
  103. );
  104. /*******************************************************************************
  105. ** Windows. ********************************************************************
  106. */
  107. VDKAPI vdkWindow VDKLANG
  108. vdkCreateWindow(
  109. vdkDisplay Display,
  110. int X,
  111. int Y,
  112. int Width,
  113. int Height
  114. );
  115. VDKAPI int VDKLANG
  116. vdkGetWindowInfo(
  117. vdkWindow Window,
  118. int * X,
  119. int * Y,
  120. int * Width,
  121. int * Height,
  122. int * BitsPerPixel,
  123. unsigned int * Offset
  124. );
  125. VDKAPI void VDKLANG
  126. vdkDestroyWindow(
  127. vdkWindow Window
  128. );
  129. VDKAPI void VDKLANG
  130. vdkSetWindowTitle(
  131. vdkWindow Window,
  132. const char * Title
  133. );
  134. VDKAPI int VDKLANG
  135. vdkShowWindow(
  136. vdkWindow Window
  137. );
  138. VDKAPI int VDKLANG
  139. vdkHideWindow(
  140. vdkWindow Window
  141. );
  142. VDKAPI int VDKLANG
  143. vdkDrawImage(
  144. vdkWindow Window,
  145. int Left,
  146. int Top,
  147. int Right,
  148. int Bottom,
  149. int Width,
  150. int Height,
  151. int BitsPerPixel,
  152. void * Bits
  153. );
  154. VDKAPI int VDKLANG
  155. vdkGetImage(
  156. vdkWindow Window,
  157. int Left,
  158. int Top,
  159. int Right,
  160. int Bottom,
  161. int * BitsPerPixel,
  162. void ** Bits
  163. );
  164. VDKAPI void VDKLANG
  165. vdkCapturePointer(
  166. vdkWindow Window
  167. );
  168. /*******************************************************************************
  169. ** Pixmaps. ********************************************************************
  170. */
  171. VDKAPI vdkPixmap VDKLANG
  172. vdkCreatePixmap(
  173. vdkDisplay Display,
  174. int Width,
  175. int Height,
  176. int BitsPerPixel
  177. );
  178. VDKAPI int VDKLANG
  179. vdkGetPixmapInfo(
  180. vdkPixmap Pixmap,
  181. int * Width,
  182. int * Height,
  183. int * BitsPerPixel,
  184. int * Stride,
  185. void ** Bits
  186. );
  187. VDKAPI int VDKLANG
  188. vdkDrawPixmap(
  189. vdkPixmap Pixmap,
  190. int Left,
  191. int Top,
  192. int Right,
  193. int Bottom,
  194. int Width,
  195. int Height,
  196. int BitsPerPixel,
  197. void * Bits
  198. );
  199. VDKAPI void VDKLANG
  200. vdkDestroyPixmap(
  201. vdkPixmap Pixmap
  202. );
  203. /*******************************************************************************
  204. ** Events. *********************************************************************
  205. */
  206. VDKAPI int VDKLANG
  207. vdkGetEvent(
  208. vdkWindow Window,
  209. vdkEvent * Event
  210. );
  211. /*******************************************************************************
  212. ** Time. ***********************************************************************
  213. */
  214. VDKAPI unsigned int VDKLANG
  215. vdkGetTicks(
  216. void
  217. );
  218. /*******************************************************************************
  219. ** EGL support. ****************************************************************
  220. */
  221. #include <EGL/egl.h>
  222. /* EGL prototypes. */
  223. typedef EGLDisplay (EGLAPIENTRY * EGL_GET_DISPLAY)(
  224. EGLNativeDisplayType display_id
  225. );
  226. typedef EGLBoolean (EGLAPIENTRY * EGL_INITIALIZE)(
  227. EGLDisplay dpy,
  228. EGLint *major,
  229. EGLint *minor
  230. );
  231. typedef EGLBoolean (EGLAPIENTRY * EGL_TERMINATE)(
  232. EGLDisplay dpy
  233. );
  234. typedef EGLBoolean (EGLAPIENTRY * EGL_CHOOSE_CONFIG)(
  235. EGLDisplay dpy,
  236. const EGLint *attrib_list,
  237. EGLConfig *configs,
  238. EGLint config_size,
  239. EGLint *num_config
  240. );
  241. typedef EGLSurface (EGLAPIENTRY * EGL_CREATE_WINDOW_SURFACE)(
  242. EGLDisplay dpy,
  243. EGLConfig config,
  244. EGLNativeWindowType win,
  245. const EGLint *attrib_list
  246. );
  247. typedef EGLBoolean (EGLAPIENTRY * EGL_DESTROY_SURFACE)(
  248. EGLDisplay dpy,
  249. EGLSurface surface
  250. );
  251. typedef EGLContext (EGLAPIENTRY * EGL_CREATE_CONTEXT)(
  252. EGLDisplay dpy,
  253. EGLConfig config,
  254. EGLContext share_context,
  255. const EGLint *attrib_list
  256. );
  257. typedef EGLBoolean (EGLAPIENTRY * EGL_DESTROY_CONTEXT)(
  258. EGLDisplay dpy,
  259. EGLContext ctx
  260. );
  261. typedef EGLBoolean (EGLAPIENTRY * EGL_MAKE_CURRENT)(
  262. EGLDisplay dpy,
  263. EGLSurface draw,
  264. EGLSurface read,
  265. EGLContext ctx
  266. );
  267. typedef EGLBoolean (EGLAPIENTRY * EGL_SWAP_BUFFERS)(
  268. EGLDisplay dpy,
  269. EGLSurface surface
  270. );
  271. typedef void (* EGL_PROC)(void);
  272. typedef EGL_PROC (EGLAPIENTRY * EGL_GET_PROC_ADDRESS)(
  273. const char *procname
  274. );
  275. typedef EGLBoolean (EGLAPIENTRY * EGL_BIND_API)(
  276. EGLenum api
  277. );
  278. /* VDK_EGL structure defining the stuff required for EGL support. */
  279. typedef struct _vdkEGL
  280. {
  281. /* Pointer to VDK private data. */
  282. vdkPrivate vdk;
  283. /* Pointer to vdkDisplay structure. */
  284. vdkDisplay display;
  285. /* Pointer to vdkWindow structure. */
  286. vdkWindow window;
  287. /* EGL pointers. */
  288. EGLDisplay eglDisplay;
  289. EGLConfig eglConfig;
  290. EGLSurface eglSurface;
  291. EGLContext eglContext;
  292. /* EGL function pointers. */
  293. EGL_GET_DISPLAY eglGetDisplay;
  294. EGL_INITIALIZE eglInitialize;
  295. EGL_TERMINATE eglTerminate;
  296. EGL_CHOOSE_CONFIG eglChooseConfig;
  297. EGL_CREATE_WINDOW_SURFACE eglCreateWindowSurface;
  298. EGL_DESTROY_SURFACE eglDestroySurface;
  299. EGL_CREATE_CONTEXT eglCreateContext;
  300. EGL_DESTROY_CONTEXT eglDestroyContext;
  301. EGL_MAKE_CURRENT eglMakeCurrent;
  302. EGL_SWAP_BUFFERS eglSwapBuffers;
  303. EGL_GET_PROC_ADDRESS eglGetProcAddress;
  304. EGL_BIND_API eglBindAPI;
  305. }
  306. vdkEGL;
  307. typedef void (EGLAPIENTRY * EGL_ADDRESS)(
  308. void);
  309. EGL_ADDRESS
  310. vdkGetAddress(
  311. vdkPrivate Private,
  312. const char * Function
  313. );
  314. #define VDK_CONFIG_RGB565_D16 ((const EGLint *) 1)
  315. #define VDK_CONFIG_RGB565_D24 ((const EGLint *) 3)
  316. #define VDK_CONFIG_RGB888_D16 ((const EGLint *) 5)
  317. #define VDK_CONFIG_RGB888_D24 ((const EGLint *) 7)
  318. #define VDK_CONFIG_RGB565_D16_AA ((const EGLint *) 9)
  319. #define VDK_CONFIG_RGB565_D24_AA ((const EGLint *) 11)
  320. #define VDK_CONFIG_RGB888_D16_AA ((const EGLint *) 13)
  321. #define VDK_CONFIG_RGB888_D24_AA ((const EGLint *) 15)
  322. /* OpenVG Configurations. */
  323. #define VDK_CONFIG_RGB565_VG ((const EGLint *) 500)
  324. #define VDK_CONFIG_RGB888_VG ((const EGLint *) 501)
  325. #define VDK_CONTEXT_ES11 ((const EGLint *) 0)
  326. #define VDK_CONTEXT_ES20 ((const EGLint *) 2)
  327. VDKAPI int VDKLANG
  328. vdkSetupEGL(
  329. int X,
  330. int Y,
  331. int Width,
  332. int Height,
  333. const EGLint * ConfigurationAttributes,
  334. const EGLint * SurfaceAttributes,
  335. const EGLint * ContextAttributes,
  336. vdkEGL * Egl
  337. );
  338. VDKAPI int VDKLANG
  339. vdkSwapEGL(
  340. vdkEGL * Egl
  341. );
  342. VDKAPI void VDKLANG
  343. vdkFinishEGL(
  344. vdkEGL * Egl
  345. );
  346. /*******************************************************************************
  347. ** GL Textures. ****************************************************************
  348. */
  349. typedef enum _vdkTextureType
  350. {
  351. VDK_TGA,
  352. VDK_PNG,
  353. VDK_PKM,
  354. }
  355. vdkTextureType;
  356. typedef enum _vdkTextureFace
  357. {
  358. VDK_2D,
  359. VDK_POSITIVE_X,
  360. VDK_NEGATIVE_X,
  361. VDK_POSITIVE_Y,
  362. VDK_NEGATIVE_Y,
  363. VDK_POSITIVE_Z,
  364. VDK_NEGATIVE_Z,
  365. }
  366. vdkTextureFace;
  367. VDKAPI unsigned int VDKLANG
  368. vdkLoadTexture(
  369. vdkEGL * Egl,
  370. const char * FileName,
  371. vdkTextureType Type,
  372. vdkTextureFace Face
  373. );
  374. /*******************************************************************************
  375. ** GL Shaders. *****************************************************************
  376. */
  377. VDKAPI unsigned int VDKLANG
  378. vdkMakeProgram(
  379. vdkEGL * Egl,
  380. const char * VertexShader,
  381. const char * FragmentShader,
  382. char ** Log
  383. );
  384. VDKAPI int VDKLANG
  385. vdkDeleteProgram(
  386. vdkEGL * Egl,
  387. unsigned int Program
  388. );
  389. #ifdef __cplusplus
  390. }
  391. #endif
  392. #endif /* __vdk_h_ */