471 lines
9.6 KiB
C
471 lines
9.6 KiB
C
/****************************************************************************
|
|
*
|
|
* Copyright (c) 2005 - 2010 by Vivante Corp. All rights reserved.
|
|
*
|
|
* The material in this file is confidential and contains trade secrets
|
|
* of Vivante Corporation. This is proprietary information owned by
|
|
* Vivante Corporation. No part of this work may be disclosed,
|
|
* reproduced, copied, transmitted, or used in any way for any purpose,
|
|
* without the express written permission of Vivante Corporation.
|
|
*
|
|
*****************************************************************************
|
|
*
|
|
* Auto-generated file on 4/22/2010. Do not edit!!!
|
|
*
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#ifndef __vdk_h_
|
|
#define __vdk_h_
|
|
|
|
/* Include VDK types. */
|
|
#include "vdkTypes.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/*******************************************************************************
|
|
** Define VDKAPI and VDKLANG macros. *******************************************
|
|
**
|
|
** VDKAPI Import or export function scope.
|
|
** VDKLANG Language defintion of function.
|
|
*/
|
|
#ifdef WIN32
|
|
# ifdef __VDK_EXPORT
|
|
# define VDKAPI __declspec(dllexport)
|
|
# else
|
|
# define VDKAPI __declspec(dllimport)
|
|
# endif
|
|
# define VDKLANG __cdecl
|
|
#else
|
|
# define VDKAPI
|
|
# define VDKLANG
|
|
#endif
|
|
|
|
/*******************************************************************************
|
|
** Initialization. *************************************************************
|
|
*/
|
|
|
|
VDKAPI vdkPrivate VDKLANG
|
|
vdkInitialize(
|
|
void
|
|
);
|
|
|
|
VDKAPI void VDKLANG
|
|
vdkExit(
|
|
vdkPrivate Private
|
|
);
|
|
|
|
/*******************************************************************************
|
|
** Display. ********************************************************************
|
|
*/
|
|
|
|
VDKAPI vdkDisplay VDKLANG
|
|
vdkGetDisplay(
|
|
vdkPrivate Private
|
|
);
|
|
|
|
VDKAPI int VDKLANG
|
|
vdkGetDisplayInfo(
|
|
vdkDisplay Display,
|
|
int * Width,
|
|
int * Height,
|
|
unsigned long * Physical,
|
|
int * Stride,
|
|
int * BitsPerPixel
|
|
);
|
|
|
|
#if USE_FB_DOUBLE_BUFFER
|
|
VDKAPI int VDKLANG
|
|
vdkDisplayBuffer(
|
|
vdkDisplay Display,
|
|
int Buffer
|
|
);
|
|
#endif
|
|
|
|
/* VFK_DISPLAY_INFO structure defining information returned by
|
|
vdkGetDisplayInfoEx. */
|
|
typedef struct _vdkDISPLAY_INFO
|
|
{
|
|
/* The size of the display in pixels. */
|
|
int width;
|
|
int height;
|
|
|
|
/* The stride of the dispay. -1 is returned if the stride is not known
|
|
for the specified display.*/
|
|
int stride;
|
|
|
|
/* The color depth of the display in bits per pixel. */
|
|
int bitsPerPixel;
|
|
|
|
/* The logical pointer to the display memory buffer. NULL is returned
|
|
if the pointer is not known for the specified display. */
|
|
void * logical;
|
|
|
|
/* The physical address of the display memory buffer. ~0 is returned
|
|
if the address is not known for the specified display. */
|
|
unsigned long physical;
|
|
}
|
|
vdkDISPLAY_INFO;
|
|
|
|
VDKAPI int VDKLANG
|
|
vdkGetDisplayInfoEx(
|
|
vdkDisplay Display,
|
|
unsigned int DisplayInfoSize,
|
|
vdkDISPLAY_INFO * DisplayInfo
|
|
);
|
|
|
|
VDKAPI void VDKLANG
|
|
vdkDestroyDisplay(
|
|
vdkDisplay Display
|
|
);
|
|
|
|
/*******************************************************************************
|
|
** Windows. ********************************************************************
|
|
*/
|
|
|
|
VDKAPI vdkWindow VDKLANG
|
|
vdkCreateWindow(
|
|
vdkDisplay Display,
|
|
int X,
|
|
int Y,
|
|
int Width,
|
|
int Height
|
|
);
|
|
|
|
VDKAPI int VDKLANG
|
|
vdkGetWindowInfo(
|
|
vdkWindow Window,
|
|
int * X,
|
|
int * Y,
|
|
int * Width,
|
|
int * Height,
|
|
int * BitsPerPixel,
|
|
unsigned int * Offset
|
|
);
|
|
|
|
VDKAPI void VDKLANG
|
|
vdkDestroyWindow(
|
|
vdkWindow Window
|
|
);
|
|
|
|
VDKAPI void VDKLANG
|
|
vdkSetWindowTitle(
|
|
vdkWindow Window,
|
|
const char * Title
|
|
);
|
|
|
|
VDKAPI int VDKLANG
|
|
vdkShowWindow(
|
|
vdkWindow Window
|
|
);
|
|
|
|
VDKAPI int VDKLANG
|
|
vdkHideWindow(
|
|
vdkWindow Window
|
|
);
|
|
|
|
VDKAPI int VDKLANG
|
|
vdkDrawImage(
|
|
vdkWindow Window,
|
|
int Left,
|
|
int Top,
|
|
int Right,
|
|
int Bottom,
|
|
int Width,
|
|
int Height,
|
|
int BitsPerPixel,
|
|
void * Bits
|
|
);
|
|
|
|
VDKAPI int VDKLANG
|
|
vdkGetImage(
|
|
vdkWindow Window,
|
|
int Left,
|
|
int Top,
|
|
int Right,
|
|
int Bottom,
|
|
int * BitsPerPixel,
|
|
void ** Bits
|
|
);
|
|
|
|
VDKAPI void VDKLANG
|
|
vdkCapturePointer(
|
|
vdkWindow Window
|
|
);
|
|
|
|
/*******************************************************************************
|
|
** Pixmaps. ********************************************************************
|
|
*/
|
|
|
|
VDKAPI vdkPixmap VDKLANG
|
|
vdkCreatePixmap(
|
|
vdkDisplay Display,
|
|
int Width,
|
|
int Height,
|
|
int BitsPerPixel
|
|
);
|
|
|
|
VDKAPI int VDKLANG
|
|
vdkGetPixmapInfo(
|
|
vdkPixmap Pixmap,
|
|
int * Width,
|
|
int * Height,
|
|
int * BitsPerPixel,
|
|
int * Stride,
|
|
void ** Bits
|
|
);
|
|
|
|
VDKAPI int VDKLANG
|
|
vdkDrawPixmap(
|
|
vdkPixmap Pixmap,
|
|
int Left,
|
|
int Top,
|
|
int Right,
|
|
int Bottom,
|
|
int Width,
|
|
int Height,
|
|
int BitsPerPixel,
|
|
void * Bits
|
|
);
|
|
|
|
VDKAPI void VDKLANG
|
|
vdkDestroyPixmap(
|
|
vdkPixmap Pixmap
|
|
);
|
|
|
|
/*******************************************************************************
|
|
** Events. *********************************************************************
|
|
*/
|
|
|
|
VDKAPI int VDKLANG
|
|
vdkGetEvent(
|
|
vdkWindow Window,
|
|
vdkEvent * Event
|
|
);
|
|
|
|
/*******************************************************************************
|
|
** Time. ***********************************************************************
|
|
*/
|
|
|
|
VDKAPI unsigned int VDKLANG
|
|
vdkGetTicks(
|
|
void
|
|
);
|
|
|
|
/*******************************************************************************
|
|
** EGL support. ****************************************************************
|
|
*/
|
|
|
|
#include <EGL/egl.h>
|
|
|
|
/* EGL prototypes. */
|
|
typedef EGLDisplay (EGLAPIENTRY * EGL_GET_DISPLAY)(
|
|
EGLNativeDisplayType display_id
|
|
);
|
|
|
|
typedef EGLBoolean (EGLAPIENTRY * EGL_INITIALIZE)(
|
|
EGLDisplay dpy,
|
|
EGLint *major,
|
|
EGLint *minor
|
|
);
|
|
|
|
typedef EGLBoolean (EGLAPIENTRY * EGL_TERMINATE)(
|
|
EGLDisplay dpy
|
|
);
|
|
|
|
typedef EGLBoolean (EGLAPIENTRY * EGL_CHOOSE_CONFIG)(
|
|
EGLDisplay dpy,
|
|
const EGLint *attrib_list,
|
|
EGLConfig *configs,
|
|
EGLint config_size,
|
|
EGLint *num_config
|
|
);
|
|
|
|
typedef EGLSurface (EGLAPIENTRY * EGL_CREATE_WINDOW_SURFACE)(
|
|
EGLDisplay dpy,
|
|
EGLConfig config,
|
|
EGLNativeWindowType win,
|
|
const EGLint *attrib_list
|
|
);
|
|
|
|
typedef EGLBoolean (EGLAPIENTRY * EGL_DESTROY_SURFACE)(
|
|
EGLDisplay dpy,
|
|
EGLSurface surface
|
|
);
|
|
|
|
typedef EGLContext (EGLAPIENTRY * EGL_CREATE_CONTEXT)(
|
|
EGLDisplay dpy,
|
|
EGLConfig config,
|
|
EGLContext share_context,
|
|
const EGLint *attrib_list
|
|
);
|
|
|
|
typedef EGLBoolean (EGLAPIENTRY * EGL_DESTROY_CONTEXT)(
|
|
EGLDisplay dpy,
|
|
EGLContext ctx
|
|
);
|
|
|
|
typedef EGLBoolean (EGLAPIENTRY * EGL_MAKE_CURRENT)(
|
|
EGLDisplay dpy,
|
|
EGLSurface draw,
|
|
EGLSurface read,
|
|
EGLContext ctx
|
|
);
|
|
|
|
typedef EGLBoolean (EGLAPIENTRY * EGL_SWAP_BUFFERS)(
|
|
EGLDisplay dpy,
|
|
EGLSurface surface
|
|
);
|
|
|
|
typedef void (* EGL_PROC)(void);
|
|
|
|
typedef EGL_PROC (EGLAPIENTRY * EGL_GET_PROC_ADDRESS)(
|
|
const char *procname
|
|
);
|
|
|
|
typedef EGLBoolean (EGLAPIENTRY * EGL_BIND_API)(
|
|
EGLenum api
|
|
);
|
|
|
|
/* VDK_EGL structure defining the stuff required for EGL support. */
|
|
typedef struct _vdkEGL
|
|
{
|
|
/* Pointer to VDK private data. */
|
|
vdkPrivate vdk;
|
|
|
|
/* Pointer to vdkDisplay structure. */
|
|
vdkDisplay display;
|
|
|
|
/* Pointer to vdkWindow structure. */
|
|
vdkWindow window;
|
|
|
|
/* EGL pointers. */
|
|
EGLDisplay eglDisplay;
|
|
EGLConfig eglConfig;
|
|
EGLSurface eglSurface;
|
|
EGLContext eglContext;
|
|
|
|
/* EGL function pointers. */
|
|
EGL_GET_DISPLAY eglGetDisplay;
|
|
EGL_INITIALIZE eglInitialize;
|
|
EGL_TERMINATE eglTerminate;
|
|
EGL_CHOOSE_CONFIG eglChooseConfig;
|
|
EGL_CREATE_WINDOW_SURFACE eglCreateWindowSurface;
|
|
EGL_DESTROY_SURFACE eglDestroySurface;
|
|
EGL_CREATE_CONTEXT eglCreateContext;
|
|
EGL_DESTROY_CONTEXT eglDestroyContext;
|
|
EGL_MAKE_CURRENT eglMakeCurrent;
|
|
EGL_SWAP_BUFFERS eglSwapBuffers;
|
|
EGL_GET_PROC_ADDRESS eglGetProcAddress;
|
|
EGL_BIND_API eglBindAPI;
|
|
}
|
|
vdkEGL;
|
|
|
|
typedef void (EGLAPIENTRY * EGL_ADDRESS)(
|
|
void);
|
|
|
|
EGL_ADDRESS
|
|
vdkGetAddress(
|
|
vdkPrivate Private,
|
|
const char * Function
|
|
);
|
|
|
|
#define VDK_CONFIG_RGB565_D16 ((const EGLint *) 1)
|
|
#define VDK_CONFIG_RGB565_D24 ((const EGLint *) 3)
|
|
#define VDK_CONFIG_RGB888_D16 ((const EGLint *) 5)
|
|
#define VDK_CONFIG_RGB888_D24 ((const EGLint *) 7)
|
|
#define VDK_CONFIG_RGB565_D16_AA ((const EGLint *) 9)
|
|
#define VDK_CONFIG_RGB565_D24_AA ((const EGLint *) 11)
|
|
#define VDK_CONFIG_RGB888_D16_AA ((const EGLint *) 13)
|
|
#define VDK_CONFIG_RGB888_D24_AA ((const EGLint *) 15)
|
|
|
|
/* OpenVG Configurations. */
|
|
#define VDK_CONFIG_RGB565_VG ((const EGLint *) 500)
|
|
#define VDK_CONFIG_RGB888_VG ((const EGLint *) 501)
|
|
|
|
#define VDK_CONTEXT_ES11 ((const EGLint *) 0)
|
|
#define VDK_CONTEXT_ES20 ((const EGLint *) 2)
|
|
|
|
VDKAPI int VDKLANG
|
|
vdkSetupEGL(
|
|
int X,
|
|
int Y,
|
|
int Width,
|
|
int Height,
|
|
const EGLint * ConfigurationAttributes,
|
|
const EGLint * SurfaceAttributes,
|
|
const EGLint * ContextAttributes,
|
|
vdkEGL * Egl
|
|
);
|
|
|
|
VDKAPI int VDKLANG
|
|
vdkSwapEGL(
|
|
vdkEGL * Egl
|
|
);
|
|
|
|
VDKAPI void VDKLANG
|
|
vdkFinishEGL(
|
|
vdkEGL * Egl
|
|
);
|
|
|
|
/*******************************************************************************
|
|
** GL Textures. ****************************************************************
|
|
*/
|
|
|
|
typedef enum _vdkTextureType
|
|
{
|
|
VDK_TGA,
|
|
VDK_PNG,
|
|
VDK_PKM,
|
|
}
|
|
vdkTextureType;
|
|
|
|
typedef enum _vdkTextureFace
|
|
{
|
|
VDK_2D,
|
|
VDK_POSITIVE_X,
|
|
VDK_NEGATIVE_X,
|
|
VDK_POSITIVE_Y,
|
|
VDK_NEGATIVE_Y,
|
|
VDK_POSITIVE_Z,
|
|
VDK_NEGATIVE_Z,
|
|
}
|
|
vdkTextureFace;
|
|
|
|
VDKAPI unsigned int VDKLANG
|
|
vdkLoadTexture(
|
|
vdkEGL * Egl,
|
|
const char * FileName,
|
|
vdkTextureType Type,
|
|
vdkTextureFace Face
|
|
);
|
|
|
|
/*******************************************************************************
|
|
** GL Shaders. *****************************************************************
|
|
*/
|
|
|
|
VDKAPI unsigned int VDKLANG
|
|
vdkMakeProgram(
|
|
vdkEGL * Egl,
|
|
const char * VertexShader,
|
|
const char * FragmentShader,
|
|
char ** Log
|
|
);
|
|
|
|
VDKAPI int VDKLANG
|
|
vdkDeleteProgram(
|
|
vdkEGL * Egl,
|
|
unsigned int Program
|
|
);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* __vdk_h_ */
|
|
|