summaryrefslogtreecommitdiff
path: root/es_2_0/es2front.h
blob: 5e340ad441a6343e7456d4f5ae843964d8d000fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
/* 
 * Copyright (C) 2010 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
 * 
 * Contact:
 * DongKyun Yun <dk77.yun@samsung.com>
 * SangJin Kim <sangjin3.kim@samsung.com>
 * HyunGoo Kang <hyungoo1.kang@samsung.com>
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy of
 * this software and associated documentation files (the "Software"), to deal in
 * the Software without restriction, including without limitation the rights to
 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
 * of the Software, and to permit persons to whom the Software is furnished to do
 * so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 * 
 * Contributors:
 * - S-Core Co., Ltd
 *
 */

#ifndef _ES2_FRONT_H_
#define _ES2_FRONT_H_

#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <malloc.h>

#if defined(WIN32)
#include <windows.h>
#include <GLee/GLee.h>
#define	ES2ENTRY(name)	OGL2_gl##name			
#endif

#include <GLES2/gl2.h>


#ifdef	__cplusplus
extern "C" {
#endif

#if ! defined(WIN32)
#define	ES2ENTRY(name)	gl##name			
#endif
#define	ES2INTER(name)	_hazel_es2_##name	

#define	INTERNAL_NUM_BUFFER_OBJECTS		16	
#define	INTERNAL_NUM_SHADER_OBJECTS		16	
#define	INTERNAL_NUM_PROGRAM_OBJECTS	16	

#define fixed_to_float(v)	((float)(v)/(1 << 16))

#ifndef GL_VERSION_2_0
/* GL type for program/shader text */
typedef char GLchar;			/* native character */
typedef double GLclampd;
#endif

struct VertexAttribUnit {
	GLboolean		bEnabled;
	GLint			iSize;
	GLenum			eType;	
	GLboolean		bNormalized;
	GLsizei			uStride;
	const GLvoid*	pData;	
	GLvoid*			pConverted; 
	GLuint			uBufferBinding;
};
GL_APICALL void GL_APIENTRY ES2INTER(VertexAttribInit)(struct VertexAttribUnit* pUnit);
GL_APICALL void GL_APIENTRY ES2INTER(VertexAttribRelease)(struct VertexAttribUnit* pUnit);

struct BufferObjectUnit {
	GLboolean	bGenerated;	
	GLsizei		uSize;		
	GLenum		eUsage;		
	GLvoid*		pData;		
	GLvoid*		pConverted;	
	GLintptr	uOffset;	
};
GL_APICALL void GL_APIENTRY ES2INTER(BufferObjectInit)(struct BufferObjectUnit* pUnit);
GL_APICALL void GL_APIENTRY ES2INTER(BufferObjectRelease)(struct BufferObjectUnit* pUnit);

struct SymbolEntry {
	char*	formal;		
	char*	actual;		
	int		nparams;	
	int		start;		
};
GL_APICALL void GL_APIENTRY ES2INTER(MacroInit)(void);
GL_APICALL void GL_APIENTRY ES2INTER(MacroSetLineFile)(int iLine, int iFile);
GL_APICALL void GL_APIENTRY ES2INTER(MacroRelease)(void);
GL_APICALL struct SymbolEntry* GL_APIENTRY ES2INTER(MacroSearchParam)(char* name, int start, int n);
GL_APICALL struct SymbolEntry* GL_APIENTRY ES2INTER(MacroSearchMacro)(char* name);
GL_APICALL struct SymbolEntry* GL_APIENTRY ES2INTER(MacroAppend)(char* name, char* body);
GL_APICALL GLboolean GL_APIENTRY ES2INTER(MacroUndef)(char* name);
GL_APICALL GLboolean GL_APIENTRY ES2INTER(MacroDefineName)(char* name, char* body);
GL_APICALL GLboolean GL_APIENTRY ES2INTER(MacroDefineFunc)(char* head, char* body);
GL_APICALL char* GL_APIENTRY ES2INTER(MacroExpand)(char* src, int detailed);


#define	T_VOID			0x0010
#define	T_BOOL			0x0021
#define	T_INT			0x0031
#define	T_FLOAT			0x0041
#define	T_BVEC2			0x0022
#define	T_BVEC3			0x0023
#define	T_BVEC4			0x0024
#define	T_IVEC2			0x0032
#define	T_IVEC3			0x0033
#define	T_IVEC4			0x0034
#define	T_VEC2			0x0042
#define	T_VEC3			0x0043
#define	T_VEC4			0x0044
#define	T_MAT2			0x0052
#define	T_MAT3			0x0053
#define	T_MAT4			0x0054
#define	T_SAMPLER2D		0x0062
#define	T_SAMPLER3D		0x0063
#define	T_SAMPLERCUBE	0x0072
#define	T_STRUCT_DCL	0x0081	
#define	T_STRUCT_DEF	0x0082	
#define	T_STRUCT_VAR	0x0083	
#define	T_FUNC_DCL		0x0091	
#define	T_FUNC_DEF		0x0092	
#define	T_FUNC_CALL		0x0093	
#define	T_IDENTIFER		0x00F1
#define	T_KEYWORD		0x00F2
#define	T_OPERATOR		0x00F3
#define GET_TYPE(type)	((type) & 0xFFFF)
#define	S_HIGHP			0x00001000
#define	S_MEDIUMP		0x00002000
#define	S_LOWP			0x00004000
#define	S_IN			0x00010000
#define	S_OUT			0x00020000
#define	S_INOUT			0x00040000
#define	S_CONST			0x00100000
#define	S_ATTRIBUTE		0x00200000
#define	S_VARYING		0x00400000
#define	S_UNIFORM		0x00800000
#define	IS_CONST(type)	(((type) & S_CONST) != 0)
#define	S_INVARIANT		0x10000000

struct TableEntry {
	char*	name;		
	int		type;		
	int		dim;		
	struct TableEntry*	ptr;	
	union {		
		int		nparams;	
		int		ival;
		float	fval;
		void*	data;		
	};
};

int GL_APIENTRY ES2INTER(ProcSwizzler)(int basetype, char* swizzler);

#define MAX_SYMBOL_LEVEL 32
struct ShaderObjectUnit {
	GLenum		eShaderType;	
	GLboolean	bDeleteStatus;	
	GLboolean	bCompileStatus;	
	GLint		nAttached;		
	GLchar**	aStrSource;		
	GLsizei		nSourceAlloc;	
	GLsizei		nSourceUsed;	
	GLsizei		nSourceLength;	
	GLchar*		strInfoLog;		
	GLsizei		nInfoLogAlloc;	
	GLchar*		strPreped;		
	GLsizei		nPrepedAlloc;	
	struct TableEntry* symbolTable[MAX_SYMBOL_LEVEL];
	int			symbolAllocated[MAX_SYMBOL_LEVEL];
	int			symbolUsed[MAX_SYMBOL_LEVEL];
	int			symbolLevel;
};
GL_APICALL void GL_APIENTRY ES2INTER(ShaderObjectInit)(struct ShaderObjectUnit* pUnit);
GL_APICALL void GL_APIENTRY ES2INTER(ShaderObjectRelease)(struct ShaderObjectUnit* pUnit);
GL_APICALL void GL_APIENTRY ES2INTER(ShaderObjectInfoLogReset)(struct ShaderObjectUnit* pUnit);
GL_APICALL void GL_APIENTRY ES2INTER(ShaderObjectInfoLogAppend)(struct ShaderObjectUnit* pUnit,
        const char* format, ...);
GL_APICALL void GL_APIENTRY ES2INTER(ShaderObjectPrepedReset)(struct ShaderObjectUnit* pUnit);
GL_APICALL void GL_APIENTRY ES2INTER(ShaderObjectPrepedAppend)(struct ShaderObjectUnit* pUnit,
        const char* strBuf, int nLenBuf);

GL_APICALL void GL_APIENTRY ES2INTER(LevelInit)(struct ShaderObjectUnit* pUnit, int level);
GL_APICALL void GL_APIENTRY ES2INTER(LevelRelease)(struct ShaderObjectUnit* pUnit, int level);
GL_APICALL void GL_APIENTRY ES2INTER(ScopeBegin)(struct ShaderObjectUnit* pUnit);
GL_APICALL void GL_APIENTRY ES2INTER(ScopeEnd)(struct ShaderObjectUnit* pUnit);
GL_APICALL void GL_APIENTRY ES2INTER(SymbolInit)(struct ShaderObjectUnit* pUnit);
GL_APICALL void GL_APIENTRY ES2INTER(SymbolRelease)(struct ShaderObjectUnit* pUnit);

GL_APICALL struct TableEntry* GL_APIENTRY ES2INTER(SearchSymbol)(struct ShaderObjectUnit* pUnit,
			        char* name, int* pLevelReturn);
GL_APICALL struct TableEntry* GL_APIENTRY ES2INTER(AppendSymbol)(struct ShaderObjectUnit* pUnit,
					char* name, int type);

struct ProgramObjectUnit {
	GLboolean	bLinkStatus;	
	GLchar*		strInfoLog;		
};
GL_APICALL void GL_APIENTRY ES2INTER(ProgramObjectInit)(struct ProgramObjectUnit* pUnit);
GL_APICALL void GL_APIENTRY ES2INTER(ProgramObjectRelease)(struct ProgramObjectUnit* pUnit);
GL_APICALL void GL_APIENTRY ES2INTER(ProgramObjectInfoLogReset)(struct ProgramObjectUnit* pUnit);
GL_APICALL void GL_APIENTRY ES2INTER(ProgramObjectInfoLogAppend)(struct ProgramObjectUnit* pUnit,
        const char* format, ...);

struct es2Context {
	
	GLboolean	bShaderCompiler;
	GLint	nMaxVertexAttribs;
	GLenum	eError;	
	struct VertexAttribUnit*	pVertexAttrib; 
	GLuint		uArrayBufferBinding;
	GLuint		uElementArrayBufferBinding;
	struct BufferObjectUnit*	pBufferObject;
	GLint		nBufferObjectAllocated;
	struct ShaderObjectUnit*	pShaderObject;
	GLint		nShaderObjectAllocated;
	struct ProgramObjectUnit*	pProgramObject;
	GLint		nProgramObjectAllocated;
	GLenum (*fpGetError)(void);
	void (*fpEnable)(GLenum);
	void (*fpDisable)(GLenum);
	GLboolean (*fpIsEnabled)(GLenum);
	void (*fpVertexAttrib1f)(GLuint, GLfloat);
	void (*fpVertexAttrib2f)(GLuint, GLfloat, GLfloat);
	void (*fpVertexAttrib3f)(GLuint, GLfloat, GLfloat, GLfloat);
	void (*fpVertexAttrib4f)(GLuint, GLfloat, GLfloat, GLfloat, GLfloat);
	void (*fpVertexAttrib1fv)(GLuint, const GLfloat*);
	void (*fpVertexAttrib2fv)(GLuint, const GLfloat*);
	void (*fpVertexAttrib3fv)(GLuint, const GLfloat*);
	void (*fpVertexAttrib4fv)(GLuint, const GLfloat*);
	GLuint (*fpCreateShader)(GLenum);
	void (*fpShaderSource)(GLuint, GLsizei, const GLchar**, const GLint*);
	void (*fpCompileShader)(GLuint);
	void (*fpDeleteShader)(GLuint);
	void (*fpGetShaderInfoLog)(GLuint, GLsizei, GLsizei*, GLchar*);
	void (*fpGetShaderSource)(GLuint, GLsizei, GLsizei*, GLchar*);
	void (*fpGetShaderiv)(GLuint, GLenum, GLint*);
	GLboolean (*fpIsShader)(GLuint);
	GLuint (*fpCreateProgram)(void);
	void (*fpAttachShader)(GLuint, GLuint);
	void (*fpDetachShader)(GLuint, GLuint);
	void (*fpLinkProgram)(GLuint);
	void (*fpUseProgram)(GLuint);
	void (*fpDeleteProgram)(GLuint);
	void (*fpValidateProgram)(GLuint);
	void (*fpGetAttachedShaders)(GLuint, GLsizei, GLsizei*, GLuint*);
	void (*fpGetProgramInfoLog)(GLuint, GLsizei, GLsizei*, GLchar*);
	void (*fpGetProgramiv)(GLuint, GLenum, GLint*);
	GLboolean (*fpIsProgram)(GLuint);
	void (*fpGetActiveUniform)(GLuint, GLuint, GLsizei, GLsizei*, GLint*, GLenum*, GLchar*);
	GLint (*fpGetUniformLocation)(GLuint, const GLchar*);
	void (*fpGetUniformfv)(GLuint, GLint, GLfloat*);
	void (*fpGetUniformiv)(GLuint, GLint, GLint*);
	void (*fpUniform1f)(GLint, GLfloat);
	void (*fpUniform2f)(GLint, GLfloat, GLfloat);
	void (*fpUniform3f)(GLint, GLfloat, GLfloat, GLfloat);
	void (*fpUniform4f)(GLint, GLfloat, GLfloat, GLfloat, GLfloat);
	void (*fpUniform1i)(GLint, GLint);
	void (*fpUniform2i)(GLint, GLint, GLint);
	void (*fpUniform3i)(GLint, GLint, GLint, GLint);
	void (*fpUniform4i)(GLint, GLint, GLint, GLint, GLint);
	void (*fpUniform1fv)(GLint, GLsizei, const GLfloat*);
	void (*fpUniform2fv)(GLint, GLsizei, const GLfloat*);
	void (*fpUniform3fv)(GLint, GLsizei, const GLfloat*);
	void (*fpUniform4fv)(GLint, GLsizei, const GLfloat*);
	void (*fpUniform1iv)(GLint, GLsizei, const GLint*);
	void (*fpUniform2iv)(GLint, GLsizei, const GLint*);
	void (*fpUniform3iv)(GLint, GLsizei, const GLint*);
	void (*fpUniform4iv)(GLint, GLsizei, const GLint*);
	void (*fpUniformMatrix2fv)(GLint, GLsizei, GLboolean, const GLfloat*);
	void (*fpUniformMatrix3fv)(GLint, GLsizei, GLboolean, const GLfloat*);
	void (*fpUniformMatrix4fv)(GLint, GLsizei, GLboolean, const GLfloat*);
	void (*fpVertexAttribPointer)(GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid*);
	void (*fpEnableVertexAttribArray)(GLuint);
	void (*fpDisableVertexAttribArray)(GLuint);
	void (*fpGetVertexAttribPointerv)(GLuint, GLenum, void**);
	void (*fpGetVertexAttribfv)(GLuint, GLenum, GLfloat*);
	void (*fpGetVertexAttribiv)(GLuint, GLenum, GLint*);
	void (*fpGetActiveAttrib)(GLuint, GLuint, GLsizei, GLsizei*, GLint*, GLenum*, GLchar*);
	GLint (*fpGetAttribLocation)(GLuint, const GLchar*);
	void (*fpBindAttribLocation)(GLuint, GLuint, const GLchar*);
	void (*fpGenBuffers)(GLsizei, GLuint*);
	void (*fpDeleteBuffers)(GLsizei, const GLuint*);
	GLboolean (*fpIsBuffer)(GLuint);
	void (*fpBindBuffer)(GLenum, GLuint);
	void (*fpBufferData)(GLenum, GLsizeiptr, const GLvoid*, GLenum);
	void (*fpBufferSubData)(GLenum, GLintptr, GLsizeiptr, const GLvoid*);
	void (*fpGetBufferSubData)(GLenum, GLintptr, GLsizeiptr, const GLvoid* data);
	void (*fpDrawArrays)(GLenum, GLint, GLsizei);
	void (*fpDrawElements)(GLenum, GLsizei, GLenum, const void*);
	void (*fpLineWidth)(GLfloat);
	void (*fpDepthRange)(GLclampd, GLclampd);
	void (*fpViewport)(GLint, GLint, GLsizei, GLsizei);
	void (*fpCullFace)(GLenum);
	void (*fpFrontFace)(GLenum);
	void (*fpPolygonOffset)(GLfloat, GLfloat);
	void (*fpGenTextures)(GLsizei, GLuint*);
	void (*fpDeleteTextures)(GLsizei, const GLuint*);
	GLboolean (*fpIsTexture)(GLuint);
	void (*fpBindTexture)(GLenum, GLuint);
	void (*fpPixelStorei)(GLenum, GLint);
	void (*fpActiveTexture)(GLenum);
	void (*fpGenerateMipmap)(GLenum);
	void (*fpTexParameteri)(GLenum, GLenum, GLint);
	void (*fpGetTexParameterfv)(GLenum, GLenum, GLfloat*);
	void (*fpGetTexParameteriv)(GLenum, GLenum, GLint*);
	void (*fpTexImage2D)(GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid*);
	void (*fpTexSubImage2D)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid*);
	void (*fpGetTexLevelParameteriv)(GLenum, GLint, GLenum, GLint*);
	void (*fpCopyTexImage2D)(GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint);
	void (*fpCopyTexSubImage2D)(GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei);
	void (*fpCompressedTexImage2D)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid*);
	void (*fpCompressedTexSubImage2D)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid*);
	void (*fpClear)(GLbitfield);
	void (*fpClearColor)(GLclampf, GLclampf, GLclampf, GLclampf);
	void (*fpClearDepth)(GLclampd);
	void (*fpClearStencil)(GLint);
	void (*fpColorMask)(GLboolean, GLboolean, GLboolean, GLboolean);
	void (*fpDepthMask)(GLboolean);
	void (*fpStencilMask)(GLuint);
	void (*fpStencilMaskSeparate)(GLenum, GLuint);
	void (*fpScissor)(GLint, GLint, GLsizei, GLsizei);
	void (*fpStencilFunc)(GLenum, GLint, GLuint);
	void (*fpStencilFuncSeparate)(GLenum, GLenum, GLint, GLuint);
	void (*fpStencilOp)(GLenum, GLenum, GLenum);
	void (*fpStencilOpSeparate)(GLenum, GLenum, GLenum, GLenum);
	void (*fpDepthFunc)(GLenum);
	void (*fpBlendFunc)(GLenum, GLenum);
	void (*fpBlendFuncSeparate)(GLenum, GLenum, GLenum, GLenum);
	void (*fpBlendColor)(GLclampf, GLclampf, GLclampf, GLclampf);
	void (*fpBlendEquation)(GLenum);
	void (*fpBlendEquationSeparate)(GLenum, GLenum);
	void (*fpSampleCoverage)(GLclampf, GLboolean);
	void (*fpReadPixels)(GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid*);
	void (*fpFlush)(void);
	void (*fpFinish)(void);
	void (*fpHint)(GLenum, GLenum);
	const GLubyte* (*fpGetString)(GLenum);
	void (*fpGetFloatv)(GLenum, GLfloat*);
	void (*fpGetIntegerv)(GLenum, GLint*);
	void (*fpGetBooleanv)(GLenum, GLboolean*);
	void (*fpGenFramebuffers)(GLsizei, GLuint*);
	void (*fpGenRenderbuffers)(GLsizei, GLuint*);
	void (*fpDeleteFramebuffers)(GLsizei, const GLuint*);
	void (*fpDeleteRenderbuffers)(GLsizei, const GLuint*);
	GLboolean (*fpIsFramebuffer)(GLuint);
	GLboolean (*fpIsRenderbuffer)(GLuint);
	void (*fpBindFramebuffer)(GLenum, GLuint);
	void (*fpBindRenderbuffer)(GLenum, GLuint);
	void (*fpRenderbufferStorage)(GLenum, GLenum, GLsizei, GLsizei);
	void (*fpGetRenderbufferParameteriv)(GLenum, GLenum, GLint*);
	void (*fpFramebufferRenderbuffer)(GLenum, GLenum, GLenum, GLuint);
	void (*fpFramebufferTexture2D)(GLenum, GLenum, GLenum, GLuint, GLint);
	void (*fpGetFramebufferAttachmentParameteriv)(GLenum, GLenum, GLenum, GLint*);
	GLenum (*fpCheckFramebufferStatus)(GLenum);
	void (*fpEGLImageTargetTexture2DOES)(GLenum, GLint);
#if defined(PROVIDING_OES_texture_3D)
	void (*fpTexImage3D)(GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid*);
	void (*fpTexSubImage3D)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid*);
	void (*fpCopyTexSubImage3D)(GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei);
	void (*fpCompressedTexImage3D)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid*);
	void (*fpCompressedTexSubImage3D)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid*);
	void (*fpFramebufferTexture3D)(GLenum, GLenum, GLenum, GLuint, GLint, GLint);
#endif
};

extern struct es2Context* ES2INTER(curContext);

#define CCV(name)		(ES2INTER(curContext)->name)
#if defined(WIN32)
#define	FNPTR(name)		gl##name
#else
#define	FNPTR(name)		(ES2INTER(curContext)->fp##name)
#endif

GL_APICALL void GL_APIENTRY ES2INTER(NotBound)(void);
GL_APICALL void GL_APIENTRY ES2INTER(ResetFnptrs)(struct es2Context* pContext);
GL_APICALL void GL_APIENTRY ES2INTER(BindFnptrs)(struct es2Context* pContext);

#define EGLCROSS(name)	__hazel_cross__##name 

GL_APICALL void* GL_APIENTRY EGLCROSS(CreateContext)(void);
GL_APICALL void GL_APIENTRY EGLCROSS(MakeCurrent)(void*);
GL_APICALL void GL_APIENTRY EGLCROSS(ReleaseContext)(void*);

#define	CHECK_ERROR		(void)(0)

GL_APICALL void GL_APIENTRY ES2INTER(SetError)(GLenum eErrorCode);
#define SET_ERROR(code,...)	ES2INTER(SetError)(code)

GL_APICALL int GL_APIENTRY ES2INTER(Log2)(GLint x);

#ifdef	__cplusplus
}
#endif


#endif