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
|
#pragma once
#include "Configuration/UnityConfigure.h"
#include "Runtime/GfxDevice/opengles/ExtensionsGLES.h"
// The reason to have this file is that we use plenty of gles extensions,
// and not all of them are handled in (all) sdk we build with.
// Still we do guard all the usages with runtime ifs, so there is no need to intro addidtional preprocessor magic
// ----------------------------------------------------------------------------
// Texture Formats
//
#ifndef GL_BGRA_EXT
#define GL_BGRA_EXT 0x80E1
#endif
#ifndef GL_ETC1_RGB8_OES
#define GL_ETC1_RGB8_OES 0x8D64
#endif
#ifndef GL_COMPRESSED_RGB_S3TC_DXT1_EXT
#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0
#endif
#ifndef GL_COMPRESSED_RGBA_S3TC_DXT1_EXT
#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1
#endif
#ifndef GL_COMPRESSED_RGBA_S3TC_DXT3_EXT
#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2
#endif
#ifndef GL_COMPRESSED_RGBA_S3TC_DXT5_EXT
#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3
#endif
#ifndef GL_COMPRESSED_SRGB_S3TC_DXT1_NV
#define GL_COMPRESSED_SRGB_S3TC_DXT1_NV 0x8C4C
#endif
#ifndef GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_NV
#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_NV 0x8C4D
#endif
#ifndef GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_NV
#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_NV 0x8C4E
#endif
#ifndef GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_NV
#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_NV 0x8C4F
#endif
#ifndef GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG
#define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00
#endif
#ifndef GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG
#define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01
#endif
#ifndef GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG
#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02
#endif
#ifndef GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG
#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03
#endif
#ifndef GL_ATC_RGB_AMD
#define GL_ATC_RGB_AMD 0x8C92
#endif
#ifndef GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD
#define GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD 0x87EE
#endif
#ifndef GL_HALF_FLOAT_OES
#define GL_HALF_FLOAT_OES 0x8D61
#endif
#ifndef GL_SRGB_EXT
#define GL_SRGB_EXT 0x8C40
#endif
#ifndef GL_SRGB_ALPHA_EXT
#define GL_SRGB_ALPHA_EXT 0x8C42
#endif
// ----------------------------------------------------------------------------
// GL_EXT_blend_minmax
//
#ifndef GL_MIN_EXT
#define GL_MIN_EXT 0x8007
#endif
#ifndef GL_MAX_EXT
#define GL_MAX_EXT 0x8008
#endif
// ----------------------------------------------------------------------------
// GL_EXT_debug_marker
//
typedef void (*glPushGroupMarkerEXTFunc)(int len, const char* name);
typedef void (*glPopGroupMarkerEXTFunc)();
// ----------------------------------------------------------------------------
// GL_EXT_discard_framebuffer
//
#ifndef GL_COLOR_EXT
#define GL_COLOR_EXT 0x1800
#endif
#ifndef GL_DEPTH_EXT
#define GL_DEPTH_EXT 0x1801
#endif
#ifndef GL_STENCIL_EXT
#define GL_STENCIL_EXT 0x1802
#endif
typedef void (*glDiscardFramebufferEXTFunc)(GLenum target, GLsizei numAttachments, const GLenum *attachments);
// ----------------------------------------------------------------------------
// GL_EXT_occlusion_query_boolean
// Note: while we dont use occlusion queries, all queries ext are based on that one
//
#ifndef GL_QUERY_RESULT_EXT
#define GL_QUERY_RESULT_EXT 0x8866
#endif
#ifndef GL_QUERY_RESULT_AVAILABLE_EXT
#define GL_QUERY_RESULT_AVAILABLE_EXT 0x8867
#endif
typedef void (*glGenQueriesEXTFunc)(GLuint n, GLuint *ids);
typedef void (*glDeleteQueriesEXTFunc)(GLuint n, const GLuint *ids);
typedef void (*glBeginQueryEXTFunc)(GLuint target, GLuint id);
typedef void (*glEndQueryEXTFunc)(GLuint target);
typedef void (*glGetQueryObjectuivEXTFunc)(GLuint id, GLuint pname, GLuint *params);
// ----------------------------------------------------------------------------
// GL_EXT_shadow_samplers
//
#ifndef GL_TEXTURE_COMPARE_MODE_EXT
#define GL_TEXTURE_COMPARE_MODE_EXT 0x884C
#endif
#ifndef GL_TEXTURE_COMPARE_FUNC_EXT
#define GL_TEXTURE_COMPARE_FUNC_EXT 0x884D
#endif
#ifndef GL_COMPARE_REF_TO_TEXTURE_EXT
#define GL_COMPARE_REF_TO_TEXTURE_EXT 0x884E
#endif
#ifndef GL_SAMPLER_2D_SHADOW_EXT
#define GL_SAMPLER_2D_SHADOW_EXT 0x8B62
#endif
// ----------------------------------------------------------------------------
// GL_EXT_texture_rg
//
#ifndef GL_RED_EXT
#define GL_RED_EXT 0x1903
#endif
#ifndef GL_RG_EXT
#define GL_RG_EXT 0x8227
#endif
// ----------------------------------------------------------------------------
// GL_OES_get_program_binary
//
#ifndef GL_PROGRAM_BINARY_LENGTH_OES
#define GL_PROGRAM_BINARY_LENGTH_OES 0x8741
#endif
#ifndef GL_NUM_PROGRAM_BINARY_FORMATS_OES
#define GL_NUM_PROGRAM_BINARY_FORMATS_OES 0x87FE
#endif
typedef void (*glGetProgramBinaryOESFunc)(GLuint program, GLsizei bufSize, GLsizei* length, GLenum* binaryFormat, GLvoid* binary);
typedef void (*glProgramBinaryOESFunc)(GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length);
// ----------------------------------------------------------------------------
// GL_OES_mapbuffer
//
#ifndef GL_WRITE_ONLY_OES
#define GL_WRITE_ONLY_OES 0x88B9
#endif
typedef void* (*glMapBufferOESFunc)(GLenum target, GLenum access);
typedef GLboolean (*glUnmapBufferOESFunc)(GLenum target);
// ----------------------------------------------------------------------------
// GL_EXT_map_buffer_range
//
#ifndef GL_MAP_READ_BIT_EXT
#define GL_MAP_READ_BIT_EXT 0x0001
#endif
#ifndef GL_MAP_WRITE_BIT_EXT
#define GL_MAP_WRITE_BIT_EXT 0x0002
#endif
#ifndef GL_MAP_INVALIDATE_RANGE_BIT_EXT
#define GL_MAP_INVALIDATE_RANGE_BIT_EXT 0x0004
#endif
#ifndef GL_MAP_INVALIDATE_BUFFER_BIT_EXT
#define GL_MAP_INVALIDATE_BUFFER_BIT_EXT 0x0008
#endif
#ifndef GL_MAP_FLUSH_EXPLICIT_BIT_EXT
#define GL_MAP_FLUSH_EXPLICIT_BIT_EXT 0x0010
#endif
#ifndef GL_MAP_UNSYNCHRONIZED_BIT_EXT
#define GL_MAP_UNSYNCHRONIZED_BIT_EXT 0x0020
#endif
typedef void* (*glMapBufferRangeEXTFunc)(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
typedef void (*glFlushMappedBufferRangeEXTFunc)(GLenum target, GLintptr offset, GLsizeiptr length);
// ----------------------------------------------------------------------------
// GL_APPLE_framebuffer_multisample
//
#ifndef GL_MAX_SAMPLES_APPLE
#define GL_MAX_SAMPLES_APPLE 0x8D57
#endif
#ifndef GL_READ_FRAMEBUFFER_APPLE
#define GL_READ_FRAMEBUFFER_APPLE 0x8CA8
#endif
#ifndef GL_DRAW_FRAMEBUFFER_APPLE
#define GL_DRAW_FRAMEBUFFER_APPLE 0x8CA9
#endif
typedef void (*glRenderbufferStorageMultisampleAPPLEFunc)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
typedef void (*glResolveMultisampleFramebufferAPPLEFunc)(void);
// ----------------------------------------------------------------------------
// GL_IMG_multisampled_render_to_texture
//
#ifndef GL_MAX_SAMPLES_IMG
#define GL_MAX_SAMPLES_IMG 0x9135
#endif
typedef void (*glRenderbufferStorageMultisampleIMGFunc)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
typedef void (*glFramebufferTexture2DMultisampleIMGFunc)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
// ----------------------------------------------------------------------------
// GL_EXT_multisampled_render_to_texture
//
#ifndef GL_MAX_SAMPLES_EXT
#define GL_MAX_SAMPLES_EXT 0x8D57
#endif
typedef void (*glRenderbufferStorageMultisampleEXTFunc)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
typedef void (*glFramebufferTexture2DMultisampleEXTFunc)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
// ----------------------------------------------------------------------------
// GL_NV_draw_buffers
//
#ifndef GL_MAX_DRAW_BUFFERS_NV
#define GL_MAX_DRAW_BUFFERS_NV 0x8824
#endif
#ifndef GL_COLOR_ATTACHMENT0_NV
#define GL_COLOR_ATTACHMENT0_NV 0x8CE0
#endif
typedef void (*glDrawBuffersNVFunc)(int len, const GLenum* bufs);
// ----------------------------------------------------------------------------
// GL_NV_timer_query
//
#ifndef GL_TIME_ELAPSED_NV
#define GL_TIME_ELAPSED_NV 0x88BF
#endif
#ifndef GL_TIMESTAMP_NV
#define GL_TIMESTAMP_NV 0x8E28
#endif
typedef unsigned long long int EGLuint64NV;
typedef void (*glQueryCounterNVFunc)(GLuint target, GLuint id);
typedef void (*glGetQueryObjectui64vNVFunc)(GLuint id, GLuint pname, EGLuint64NV *params);
// ----------------------------------------------------------------------------
// GL_QCOM_alpha_test
//
#ifndef GL_ALPHA_TEST_QCOM
#define GL_ALPHA_TEST_QCOM 0x0BC0
#endif
typedef void (*glAlphaFuncQCOMFunc)(GLenum func, GLfloat ref);
// ----------------------------------------------------------------------------
// common place to get function pointers
//
struct
GlesExtFunc
{
glPushGroupMarkerEXTFunc glPushGroupMarkerEXT;
glPopGroupMarkerEXTFunc glPopGroupMarkerEXT;
glDiscardFramebufferEXTFunc glDiscardFramebufferEXT;
glGenQueriesEXTFunc glGenQueriesEXT;
glDeleteQueriesEXTFunc glDeleteQueriesEXT;
glGetQueryObjectuivEXTFunc glGetQueryObjectuivEXT;
glGetProgramBinaryOESFunc glGetProgramBinaryOES;
glProgramBinaryOESFunc glProgramBinaryOES;
glMapBufferOESFunc glMapBufferOES;
glUnmapBufferOESFunc glUnmapBufferOES;
glMapBufferRangeEXTFunc glMapBufferRangeEXT;
glFlushMappedBufferRangeEXTFunc glFlushMappedBufferRangeEXT;
glRenderbufferStorageMultisampleAPPLEFunc glRenderbufferStorageMultisampleAPPLE;
glResolveMultisampleFramebufferAPPLEFunc glResolveMultisampleFramebufferAPPLE;
glRenderbufferStorageMultisampleIMGFunc glRenderbufferStorageMultisampleIMG;
glFramebufferTexture2DMultisampleIMGFunc glFramebufferTexture2DMultisampleIMG;
glRenderbufferStorageMultisampleEXTFunc glRenderbufferStorageMultisampleEXT;
glFramebufferTexture2DMultisampleEXTFunc glFramebufferTexture2DMultisampleEXT;
glDrawBuffersNVFunc glDrawBuffersNV;
glQueryCounterNVFunc glQueryCounterNV;
glGetQueryObjectui64vNVFunc glGetQueryObjectui64vNV;
glAlphaFuncQCOMFunc glAlphaFuncQCOM;
void InitExtFunc();
};
extern GlesExtFunc gGlesExtFunc;
|