src/3rdparty/powervr/wsegl.h
changeset 0 1918ee327afb
equal deleted inserted replaced
-1:000000000000 0:1918ee327afb
       
     1 /******************************************************************************
       
     2  Name         : wsegl.h
       
     3  Copyright    :	Copyright (c) Imagination Technologies Limited.
       
     4 				This specification is protected by copyright laws and contains
       
     5 				material proprietary to Imagination Technologies Limited.
       
     6 				You may use and distribute this specification free of charge for implementing
       
     7 				the functionality therein, without altering or removing any trademark, copyright,
       
     8 				or other notice from the specification.
       
     9  Platform     : ANSI
       
    10 *****************************************************************************/
       
    11 
       
    12 
       
    13 #if !defined(__WSEGL_H__)
       
    14 #define __WSEGL_H__
       
    15 
       
    16 #ifdef __cplusplus
       
    17 extern "C" {
       
    18 #endif 
       
    19 
       
    20 /*
       
    21 // WSEGL Platform-specific definitions
       
    22 */
       
    23 #define WSEGL_EXPORT
       
    24 #define WSEGL_IMPORT
       
    25 
       
    26 /*
       
    27 // WSEGL API Version Number
       
    28 */
       
    29 
       
    30 #define WSEGL_VERSION 1
       
    31 #define WSEGL_DEFAULT_DISPLAY 0
       
    32 #define WSEGL_DEFAULT_NATIVE_ENGINE 0
       
    33 
       
    34 #define WSEGL_FALSE		0
       
    35 #define WSEGL_TRUE		1
       
    36 #define WSEGL_NULL		0
       
    37 
       
    38 #define	WSEGL_UNREFERENCED_PARAMETER(param) (param) = (param)
       
    39 
       
    40 /*
       
    41 // WSEGL handles
       
    42 */
       
    43 typedef void *WSEGLDisplayHandle;
       
    44 typedef void *WSEGLDrawableHandle;
       
    45 
       
    46 /*
       
    47 // Display capability type
       
    48 */
       
    49 typedef enum WSEGLCapsType_TAG
       
    50 {
       
    51 	WSEGL_NO_CAPS = 0,
       
    52 	WSEGL_CAP_MIN_SWAP_INTERVAL = 1, /* System default value = 1 */
       
    53 	WSEGL_CAP_MAX_SWAP_INTERVAL = 2, /* System default value = 1 */
       
    54 	WSEGL_CAP_WINDOWS_USE_HW_SYNC = 3, /* System default value = 0 (FALSE) */
       
    55 	WSEGL_CAP_PIXMAPS_USE_HW_SYNC = 4, /* System default value = 0 (FALSE) */
       
    56 
       
    57 } WSEGLCapsType;
       
    58 
       
    59 /*
       
    60 // Display capability
       
    61 */
       
    62 typedef struct WSEGLCaps_TAG
       
    63 {
       
    64 	WSEGLCapsType eCapsType;
       
    65 	unsigned long ui32CapsValue;
       
    66 
       
    67 } WSEGLCaps;
       
    68 
       
    69 /*
       
    70 // Drawable type
       
    71 */
       
    72 #define WSEGL_NO_DRAWABLE			0x0
       
    73 #define WSEGL_DRAWABLE_WINDOW		0x1
       
    74 #define WSEGL_DRAWABLE_PIXMAP		0x2
       
    75 
       
    76 
       
    77 /*
       
    78 // Pixel format of display/drawable
       
    79 */
       
    80 typedef enum WSEGLPixelFormat_TAG
       
    81 {
       
    82 	WSEGL_PIXELFORMAT_565 = 0,
       
    83 	WSEGL_PIXELFORMAT_4444 = 1,
       
    84 	WSEGL_PIXELFORMAT_8888 = 2,
       
    85 	WSEGL_PIXELFORMAT_1555 = 3
       
    86 
       
    87 } WSEGLPixelFormat;
       
    88 
       
    89 /*
       
    90 // Transparent of display/drawable
       
    91 */
       
    92 typedef enum WSEGLTransparentType_TAG
       
    93 {
       
    94 	WSEGL_OPAQUE = 0,
       
    95 	WSEGL_COLOR_KEY = 1,
       
    96 
       
    97 } WSEGLTransparentType;
       
    98 
       
    99 /*
       
   100 // Display/drawable configuration
       
   101 */
       
   102 typedef struct WSEGLConfig_TAG
       
   103 {
       
   104 	/*
       
   105 	// Type of drawables this configuration applies to -
       
   106 	// OR'd values of drawable types. 
       
   107 	*/
       
   108 	unsigned long ui32DrawableType;
       
   109 
       
   110 	/* Pixel format */
       
   111 	WSEGLPixelFormat ePixelFormat;
       
   112 
       
   113 	/* Native Renderable  - set to WSEGL_TRUE if native renderable */
       
   114 	unsigned long ulNativeRenderable;
       
   115 
       
   116 	/* FrameBuffer Level Parameter */
       
   117 	unsigned long ulFrameBufferLevel;
       
   118 
       
   119 	/* Native Visual ID */
       
   120 	unsigned long ulNativeVisualID;
       
   121 
       
   122 	/* Native Visual */
       
   123 	void *hNativeVisual;
       
   124 
       
   125 	/* Transparent Type */
       
   126 	WSEGLTransparentType eTransparentType;
       
   127 
       
   128 	/* Transparent Color - only used if transparent type is COLOR_KEY */
       
   129 	unsigned long ulTransparentColor; /* packed as 0x00RRGGBB */
       
   130 
       
   131 
       
   132 } WSEGLConfig;
       
   133 
       
   134 /*
       
   135 // WSEGL errors
       
   136 */
       
   137 typedef enum WSEGLError_TAG
       
   138 {
       
   139 	WSEGL_SUCCESS = 0,
       
   140 	WSEGL_CANNOT_INITIALISE = 1,
       
   141 	WSEGL_BAD_NATIVE_DISPLAY = 2,
       
   142 	WSEGL_BAD_NATIVE_WINDOW = 3,
       
   143 	WSEGL_BAD_NATIVE_PIXMAP = 4,
       
   144 	WSEGL_BAD_NATIVE_ENGINE = 5,
       
   145 	WSEGL_BAD_DRAWABLE = 6,
       
   146 	WSEGL_BAD_CONFIG = 7,
       
   147 	WSEGL_OUT_OF_MEMORY = 8
       
   148 
       
   149 } WSEGLError; 
       
   150 
       
   151 /*
       
   152 // Drawable orientation (in degrees anti-clockwise)
       
   153 */
       
   154 typedef enum WSEGLRotationAngle_TAG
       
   155 {
       
   156 	WSEGL_ROTATE_0 = 0,
       
   157 	WSEGL_ROTATE_90 = 1,
       
   158 	WSEGL_ROTATE_180 = 2,
       
   159 	WSEGL_ROTATE_270 = 3
       
   160 
       
   161 } WSEGLRotationAngle; 
       
   162 
       
   163 /*
       
   164 // Drawable information required by OpenGL-ES driver
       
   165 */
       
   166 typedef struct WSEGLDrawableParams_TAG
       
   167 {
       
   168 	/* Width in pixels of the drawable */
       
   169 	unsigned long	ui32Width;
       
   170 
       
   171 	/* Height in pixels of the drawable */
       
   172 	unsigned long	ui32Height;
       
   173 
       
   174 	/* Stride in pixels of the drawable */
       
   175 	unsigned long	ui32Stride;
       
   176 
       
   177 	/* Pixel format of the drawable */
       
   178 	WSEGLPixelFormat	ePixelFormat;
       
   179 
       
   180 	/* User space cpu virtual address of the drawable */
       
   181 	void   			*pvLinearAddress;
       
   182 
       
   183 	/* HW address of the drawable */
       
   184 	unsigned long	ui32HWAddress;
       
   185 
       
   186 	/* Private data for the drawable */
       
   187 	void			*hPrivateData;
       
   188 
       
   189 } WSEGLDrawableParams;
       
   190 
       
   191 
       
   192 /*
       
   193 // Table of function pointers that is returned by WSEGL_GetFunctionTablePointer()
       
   194 //
       
   195 // The first entry in the table is the version number of the wsegl.h header file that
       
   196 // the module has been written against, and should therefore be set to WSEGL_VERSION
       
   197 */
       
   198 typedef struct WSEGL_FunctionTable_TAG
       
   199 {
       
   200 	unsigned long ui32WSEGLVersion;
       
   201 
       
   202 	WSEGLError (*pfnWSEGL_IsDisplayValid)(NativeDisplayType);
       
   203 
       
   204 	WSEGLError (*pfnWSEGL_InitialiseDisplay)(NativeDisplayType, WSEGLDisplayHandle *, const WSEGLCaps **, WSEGLConfig **);
       
   205 
       
   206 	WSEGLError (*pfnWSEGL_CloseDisplay)(WSEGLDisplayHandle);
       
   207 
       
   208 	WSEGLError (*pfnWSEGL_CreateWindowDrawable)(WSEGLDisplayHandle, WSEGLConfig *, WSEGLDrawableHandle *, NativeWindowType, WSEGLRotationAngle *);
       
   209 
       
   210 	WSEGLError (*pfnWSEGL_CreatePixmapDrawable)(WSEGLDisplayHandle, WSEGLConfig *, WSEGLDrawableHandle *, NativePixmapType, WSEGLRotationAngle *);
       
   211 
       
   212 	WSEGLError (*pfnWSEGL_DeleteDrawable)(WSEGLDrawableHandle);
       
   213 
       
   214 	WSEGLError (*pfnWSEGL_SwapDrawable)(WSEGLDrawableHandle, unsigned long);
       
   215 
       
   216 	WSEGLError (*pfnWSEGL_SwapControlInterval)(WSEGLDrawableHandle, unsigned long);
       
   217 
       
   218 	WSEGLError (*pfnWSEGL_WaitNative)(WSEGLDrawableHandle, unsigned long);
       
   219 
       
   220 	WSEGLError (*pfnWSEGL_CopyFromDrawable)(WSEGLDrawableHandle, NativePixmapType);
       
   221 
       
   222 	WSEGLError (*pfnWSEGL_CopyFromPBuffer)(void *, unsigned long, unsigned long, unsigned long, WSEGLPixelFormat, NativePixmapType);
       
   223 
       
   224 	WSEGLError (*pfnWSEGL_GetDrawableParameters)(WSEGLDrawableHandle, WSEGLDrawableParams *, WSEGLDrawableParams *);
       
   225 
       
   226 
       
   227 } WSEGL_FunctionTable;
       
   228 
       
   229 
       
   230 WSEGL_IMPORT const WSEGL_FunctionTable *WSEGL_GetFunctionTablePointer(void);
       
   231 
       
   232 #ifdef __cplusplus
       
   233 }
       
   234 #endif 
       
   235 
       
   236 #endif /* __WSEGL_H__ */
       
   237 
       
   238 /******************************************************************************
       
   239  End of file (wsegl.h)
       
   240 ******************************************************************************/