dispatch_sanity test: add version to function list
[mesa.git] / src / mesa / main / tests / dispatch_sanity.cpp
1 /*
2 * Copyright © 2012 Intel Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
22 */
23
24 /**
25 * \name dispatch_sanity.cpp
26 *
27 * Verify that only set of functions that should be available in a particular
28 * API are available in that API.
29 *
30 * The list of expected functions originally came from the functions set by
31 * api_exec_es2.c. This file no longer exists in Mesa (but api_exec_es1.c was
32 * still generated at the time this test was written). It was the generated
33 * file that configured the dispatch table for ES2 contexts. This test
34 * verifies that all of the functions set by the old api_exec_es2.c (with the
35 * recent addition of VAO functions) are set in the dispatch table and
36 * everything else is a NOP.
37 *
38 * When adding extensions that add new functions, this test will need to be
39 * modified to expect dispatch functions for the new extension functions.
40 */
41
42 extern "C" {
43 #include "main/mfeatures.h"
44 }
45
46 #include <gtest/gtest.h>
47
48 extern "C" {
49 #include "GL/gl.h"
50 #include "GL/glext.h"
51 #include "main/compiler.h"
52 #include "main/api_exec.h"
53 #include "main/context.h"
54 #include "main/remap.h"
55 #include "glapi/glapi.h"
56 #include "drivers/common/driverfuncs.h"
57
58 #include "swrast/swrast.h"
59 #include "vbo/vbo.h"
60 #include "tnl/tnl.h"
61 #include "swrast_setup/swrast_setup.h"
62
63 #ifndef GLAPIENTRYP
64 #define GLAPIENTRYP GL_APIENTRYP
65 #endif
66
67 #include "main/dispatch.h"
68 }
69
70 struct function {
71 const char *name;
72 unsigned int Version;
73 int offset;
74 };
75
76 extern const struct function gles2_functions_possible[];
77 extern const struct function gles3_functions_possible[];
78
79 #if FEATURE_ES1
80 extern const struct function gles11_functions_possible[];
81 #endif /* FEATURE_ES1 */
82
83 class DispatchSanity_test : public ::testing::Test {
84 public:
85 virtual void SetUp();
86
87 struct gl_config visual;
88 struct dd_function_table driver_functions;
89 struct gl_context share_list;
90 struct gl_context ctx;
91 };
92
93 void
94 DispatchSanity_test::SetUp()
95 {
96 memset(&visual, 0, sizeof(visual));
97 memset(&driver_functions, 0, sizeof(driver_functions));
98 memset(&share_list, 0, sizeof(share_list));
99 memset(&ctx, 0, sizeof(ctx));
100
101 _mesa_init_driver_functions(&driver_functions);
102 }
103
104 static const char *
105 offset_to_proc_name_safe(unsigned offset)
106 {
107 const char *name = _glapi_get_proc_name(offset);
108 return name ? name : "???";
109 }
110
111 /* Scan through the dispatch table and check that all the functions in
112 * _glapi_proc *table exist. When found, set their pointers in the table
113 * to _mesa_generic_nop. */
114 static void
115 validate_functions(_glapi_proc *table, const struct function *function_table)
116 {
117 for (unsigned i = 0; function_table[i].name != NULL; i++) {
118 const int offset = (function_table[i].offset != -1)
119 ? function_table[i].offset
120 : _glapi_get_proc_offset(function_table[i].name);
121
122 ASSERT_NE(-1, offset)
123 << "Function: " << function_table[i].name;
124 ASSERT_EQ(offset,
125 _glapi_get_proc_offset(function_table[i].name))
126 << "Function: " << function_table[i].name;
127 EXPECT_NE((_glapi_proc) _mesa_generic_nop, table[offset])
128 << "Function: " << function_table[i].name
129 << " at offset " << offset;
130
131 table[offset] = (_glapi_proc) _mesa_generic_nop;
132 }
133 }
134
135 /* Scan through the table and ensure that there is nothing except
136 * _mesa_generic_nop (as set by validate_functions(). */
137 static void
138 validate_nops(const _glapi_proc *table)
139 {
140 const unsigned size = _glapi_get_dispatch_table_size();
141 for (unsigned i = 0; i < size; i++) {
142 EXPECT_EQ((_glapi_proc) _mesa_generic_nop, table[i])
143 << "i = " << i << " (" << offset_to_proc_name_safe(i) << ")";
144 }
145 }
146
147 #if FEATURE_ES1
148 TEST_F(DispatchSanity_test, GLES11)
149 {
150 ctx.Version = 11;
151 _mesa_initialize_context(&ctx,
152 API_OPENGLES,
153 &visual,
154 NULL /* share_list */,
155 &driver_functions);
156
157 _swrast_CreateContext(&ctx);
158 _vbo_CreateContext(&ctx);
159 _tnl_CreateContext(&ctx);
160 _swsetup_CreateContext(&ctx);
161
162 validate_functions((_glapi_proc *) ctx.Exec, gles11_functions_possible);
163 validate_nops((_glapi_proc *) ctx.Exec);
164 }
165 #endif /* FEATURE_ES1 */
166
167 TEST_F(DispatchSanity_test, GLES2)
168 {
169 ctx.Version = 20;
170 _mesa_initialize_context(&ctx,
171 API_OPENGLES2, //api,
172 &visual,
173 NULL, //&share_list,
174 &driver_functions);
175
176 _swrast_CreateContext(&ctx);
177 _vbo_CreateContext(&ctx);
178 _tnl_CreateContext(&ctx);
179 _swsetup_CreateContext(&ctx);
180
181 validate_functions((_glapi_proc *) ctx.Exec, gles2_functions_possible);
182 validate_nops((_glapi_proc *) ctx.Exec);
183 }
184
185 TEST_F(DispatchSanity_test, GLES3)
186 {
187 ctx.Version = 30;
188 _mesa_initialize_context(&ctx,
189 API_OPENGLES2, //api,
190 &visual,
191 NULL, //&share_list,
192 &driver_functions);
193
194 _swrast_CreateContext(&ctx);
195 _vbo_CreateContext(&ctx);
196 _tnl_CreateContext(&ctx);
197 _swsetup_CreateContext(&ctx);
198
199 validate_functions((_glapi_proc *) ctx.Exec, gles2_functions_possible);
200 validate_functions((_glapi_proc *) ctx.Exec, gles3_functions_possible);
201 validate_nops((_glapi_proc *) ctx.Exec);
202 }
203
204 #if FEATURE_ES1
205 const struct function gles11_functions_possible[] = {
206 { "glActiveTexture", 11, _gloffset_ActiveTextureARB },
207 { "glAlphaFunc", 11, _gloffset_AlphaFunc },
208 { "glAlphaFuncx", 11, -1 },
209 { "glBindBuffer", 11, -1 },
210 { "glBindFramebufferOES", 11, -1 },
211 { "glBindRenderbufferOES", 11, -1 },
212 { "glBindTexture", 11, _gloffset_BindTexture },
213 { "glBlendEquationOES", 11, _gloffset_BlendEquation },
214 { "glBlendEquationSeparateOES", 11, -1 },
215 { "glBlendFunc", 11, _gloffset_BlendFunc },
216 { "glBlendFuncSeparateOES", 11, -1 },
217 { "glBufferData", 11, -1 },
218 { "glBufferSubData", 11, -1 },
219 { "glCheckFramebufferStatusOES", 11, -1 },
220 { "glClear", 11, _gloffset_Clear },
221 { "glClearColor", 11, _gloffset_ClearColor },
222 { "glClearColorx", 11, -1 },
223 { "glClearDepthf", 11, -1 },
224 { "glClearDepthx", 11, -1 },
225 { "glClearStencil", 11, _gloffset_ClearStencil },
226 { "glClientActiveTexture", 11, _gloffset_ClientActiveTextureARB },
227 { "glClipPlanef", 11, -1 },
228 { "glClipPlanex", 11, -1 },
229 { "glColor4f", 11, _gloffset_Color4f },
230 { "glColor4ub", 11, _gloffset_Color4ub },
231 { "glColor4x", 11, -1 },
232 { "glColorMask", 11, _gloffset_ColorMask },
233 { "glColorPointer", 11, _gloffset_ColorPointer },
234 { "glCompressedTexImage2D", 11, -1 },
235 { "glCompressedTexSubImage2D", 11, -1 },
236 { "glCopyTexImage2D", 11, _gloffset_CopyTexImage2D },
237 { "glCopyTexSubImage2D", 11, _gloffset_CopyTexSubImage2D },
238 { "glCullFace", 11, _gloffset_CullFace },
239 { "glDeleteBuffers", 11, -1 },
240 { "glDeleteFramebuffersOES", 11, -1 },
241 { "glDeleteRenderbuffersOES", 11, -1 },
242 { "glDeleteTextures", 11, _gloffset_DeleteTextures },
243 { "glDepthFunc", 11, _gloffset_DepthFunc },
244 { "glDepthMask", 11, _gloffset_DepthMask },
245 { "glDepthRangef", 11, -1 },
246 { "glDepthRangex", 11, -1 },
247 { "glDisable", 11, _gloffset_Disable },
248 { "glDisableClientState", 11, _gloffset_DisableClientState },
249 { "glDrawArrays", 11, _gloffset_DrawArrays },
250 { "glDrawElements", 11, _gloffset_DrawElements },
251 { "glDrawTexfOES", 11, -1 },
252 { "glDrawTexfvOES", 11, -1 },
253 { "glDrawTexiOES", 11, -1 },
254 { "glDrawTexivOES", 11, -1 },
255 { "glDrawTexsOES", 11, -1 },
256 { "glDrawTexsvOES", 11, -1 },
257 { "glDrawTexxOES", 11, -1 },
258 { "glDrawTexxvOES", 11, -1 },
259 { "glEGLImageTargetRenderbufferStorageOES", 11, -1 },
260 { "glEGLImageTargetTexture2DOES", 11, -1 },
261 { "glEnable", 11, _gloffset_Enable },
262 { "glEnableClientState", 11, _gloffset_EnableClientState },
263 { "glFinish", 11, _gloffset_Finish },
264 { "glFlush", 11, _gloffset_Flush },
265 { "glFlushMappedBufferRangeEXT", 11, -1 },
266 { "glFogf", 11, _gloffset_Fogf },
267 { "glFogfv", 11, _gloffset_Fogfv },
268 { "glFogx", 11, -1 },
269 { "glFogxv", 11, -1 },
270 { "glFramebufferRenderbufferOES", 11, -1 },
271 { "glFramebufferTexture2DOES", 11, -1 },
272 { "glFrontFace", 11, _gloffset_FrontFace },
273 { "glFrustumf", 11, -1 },
274 { "glFrustumx", 11, -1 },
275 { "glGenBuffers", 11, -1 },
276 { "glGenFramebuffersOES", 11, -1 },
277 { "glGenRenderbuffersOES", 11, -1 },
278 { "glGenTextures", 11, _gloffset_GenTextures },
279 { "glGenerateMipmapOES", 11, -1 },
280 { "glGetBooleanv", 11, _gloffset_GetBooleanv },
281 { "glGetBufferParameteriv", 11, -1 },
282 { "glGetBufferPointervOES", 11, -1 },
283 { "glGetClipPlanef", 11, -1 },
284 { "glGetClipPlanex", 11, -1 },
285 { "glGetError", 11, _gloffset_GetError },
286 { "glGetFixedv", 11, -1 },
287 { "glGetFloatv", 11, _gloffset_GetFloatv },
288 { "glGetFramebufferAttachmentParameterivOES", 11, -1 },
289 { "glGetIntegerv", 11, _gloffset_GetIntegerv },
290 { "glGetLightfv", 11, _gloffset_GetLightfv },
291 { "glGetLightxv", 11, -1 },
292 { "glGetMaterialfv", 11, _gloffset_GetMaterialfv },
293 { "glGetMaterialxv", 11, -1 },
294 { "glGetPointerv", 11, _gloffset_GetPointerv },
295 { "glGetRenderbufferParameterivOES", 11, -1 },
296 { "glGetString", 11, _gloffset_GetString },
297 { "glGetTexEnvfv", 11, _gloffset_GetTexEnvfv },
298 { "glGetTexEnviv", 11, _gloffset_GetTexEnviv },
299 { "glGetTexEnvxv", 11, -1 },
300 { "glGetTexGenfvOES", 11, _gloffset_GetTexGenfv },
301 { "glGetTexGenivOES", 11, _gloffset_GetTexGeniv },
302 { "glGetTexGenxvOES", 11, -1 },
303 { "glGetTexParameterfv", 11, _gloffset_GetTexParameterfv },
304 { "glGetTexParameteriv", 11, _gloffset_GetTexParameteriv },
305 { "glGetTexParameterxv", 11, -1 },
306 { "glHint", 11, _gloffset_Hint },
307 { "glIsBuffer", 11, -1 },
308 { "glIsEnabled", 11, _gloffset_IsEnabled },
309 { "glIsFramebufferOES", 11, -1 },
310 { "glIsRenderbufferOES", 11, -1 },
311 { "glIsTexture", 11, _gloffset_IsTexture },
312 { "glLightModelf", 11, _gloffset_LightModelf },
313 { "glLightModelfv", 11, _gloffset_LightModelfv },
314 { "glLightModelx", 11, -1 },
315 { "glLightModelxv", 11, -1 },
316 { "glLightf", 11, _gloffset_Lightf },
317 { "glLightfv", 11, _gloffset_Lightfv },
318 { "glLightx", 11, -1 },
319 { "glLightxv", 11, -1 },
320 { "glLineWidth", 11, _gloffset_LineWidth },
321 { "glLineWidthx", 11, -1 },
322 { "glLoadIdentity", 11, _gloffset_LoadIdentity },
323 { "glLoadMatrixf", 11, _gloffset_LoadMatrixf },
324 { "glLoadMatrixx", 11, -1 },
325 { "glLogicOp", 11, _gloffset_LogicOp },
326 { "glMapBufferOES", 11, -1 },
327 { "glMapBufferRangeEXT", 11, -1 },
328 { "glMaterialf", 11, _gloffset_Materialf },
329 { "glMaterialfv", 11, _gloffset_Materialfv },
330 { "glMaterialx", 11, -1 },
331 { "glMaterialxv", 11, -1 },
332 { "glMatrixMode", 11, _gloffset_MatrixMode },
333 { "glMultMatrixf", 11, _gloffset_MultMatrixf },
334 { "glMultMatrixx", 11, -1 },
335 { "glMultiDrawArraysEXT", 11, -1 },
336 { "glMultiDrawElementsEXT", 11, -1 },
337 { "glMultiTexCoord4f", 11, _gloffset_MultiTexCoord4fARB },
338 { "glMultiTexCoord4x", 11, -1 },
339 { "glNormal3f", 11, _gloffset_Normal3f },
340 { "glNormal3x", 11, -1 },
341 { "glNormalPointer", 11, _gloffset_NormalPointer },
342 { "glOrthof", 11, -1 },
343 { "glOrthox", 11, -1 },
344 { "glPixelStorei", 11, _gloffset_PixelStorei },
345 { "glPointParameterf", 11, -1 },
346 { "glPointParameterfv", 11, -1 },
347 { "glPointParameterx", 11, -1 },
348 { "glPointParameterxv", 11, -1 },
349 { "glPointSize", 11, _gloffset_PointSize },
350 { "glPointSizePointerOES", 11, -1 },
351 { "glPointSizex", 11, -1 },
352 { "glPolygonOffset", 11, _gloffset_PolygonOffset },
353 { "glPolygonOffsetx", 11, -1 },
354 { "glPopMatrix", 11, _gloffset_PopMatrix },
355 { "glPushMatrix", 11, _gloffset_PushMatrix },
356 { "glQueryMatrixxOES", 11, -1 },
357 { "glReadPixels", 11, _gloffset_ReadPixels },
358 { "glRenderbufferStorageOES", 11, -1 },
359 { "glRotatef", 11, _gloffset_Rotatef },
360 { "glRotatex", 11, -1 },
361 { "glSampleCoverage", 11, -1 },
362 { "glSampleCoveragex", 11, -1 },
363 { "glScalef", 11, _gloffset_Scalef },
364 { "glScalex", 11, -1 },
365 { "glScissor", 11, _gloffset_Scissor },
366 { "glShadeModel", 11, _gloffset_ShadeModel },
367 { "glStencilFunc", 11, _gloffset_StencilFunc },
368 { "glStencilMask", 11, _gloffset_StencilMask },
369 { "glStencilOp", 11, _gloffset_StencilOp },
370 { "glTexCoordPointer", 11, _gloffset_TexCoordPointer },
371 { "glTexEnvf", 11, _gloffset_TexEnvf },
372 { "glTexEnvfv", 11, _gloffset_TexEnvfv },
373 { "glTexEnvi", 11, _gloffset_TexEnvi },
374 { "glTexEnviv", 11, _gloffset_TexEnviv },
375 { "glTexEnvx", 11, -1 },
376 { "glTexEnvxv", 11, -1 },
377 { "glTexGenfOES", 11, _gloffset_TexGenf },
378 { "glTexGenfvOES", 11, _gloffset_TexGenfv },
379 { "glTexGeniOES", 11, _gloffset_TexGeni },
380 { "glTexGenivOES", 11, _gloffset_TexGeniv },
381 { "glTexGenxOES", 11, -1 },
382 { "glTexGenxvOES", 11, -1 },
383 { "glTexImage2D", 11, _gloffset_TexImage2D },
384 { "glTexParameterf", 11, _gloffset_TexParameterf },
385 { "glTexParameterfv", 11, _gloffset_TexParameterfv },
386 { "glTexParameteri", 11, _gloffset_TexParameteri },
387 { "glTexParameteriv", 11, _gloffset_TexParameteriv },
388 { "glTexParameterx", 11, -1 },
389 { "glTexParameterxv", 11, -1 },
390 { "glTexSubImage2D", 11, _gloffset_TexSubImage2D },
391 { "glTranslatef", 11, _gloffset_Translatef },
392 { "glTranslatex", 11, -1 },
393 { "glUnmapBufferOES", 11, -1 },
394 { "glVertexPointer", 11, _gloffset_VertexPointer },
395 { "glViewport", 11, _gloffset_Viewport },
396 { NULL, 0, -1 }
397 };
398 #endif /* FEATURE_ES1 */
399
400 const struct function gles2_functions_possible[] = {
401 { "glActiveTexture", 20, _gloffset_ActiveTextureARB },
402 { "glAttachShader", 20, -1 },
403 { "glBindAttribLocation", 20, -1 },
404 { "glBindBuffer", 20, -1 },
405 { "glBindFramebuffer", 20, -1 },
406 { "glBindRenderbuffer", 20, -1 },
407 { "glBindTexture", 20, _gloffset_BindTexture },
408 { "glBindVertexArrayOES", 20, -1 },
409 { "glBlendColor", 20, _gloffset_BlendColor },
410 { "glBlendEquation", 20, _gloffset_BlendEquation },
411 { "glBlendEquationSeparate", 20, -1 },
412 { "glBlendFunc", 20, _gloffset_BlendFunc },
413 { "glBlendFuncSeparate", 20, -1 },
414 { "glBufferData", 20, -1 },
415 { "glBufferSubData", 20, -1 },
416 { "glCheckFramebufferStatus", 20, -1 },
417 { "glClear", 20, _gloffset_Clear },
418 { "glClearColor", 20, _gloffset_ClearColor },
419 { "glClearDepthf", 20, -1 },
420 { "glClearStencil", 20, _gloffset_ClearStencil },
421 { "glColorMask", 20, _gloffset_ColorMask },
422 { "glCompileShader", 20, -1 },
423 { "glCompressedTexImage2D", 20, -1 },
424 { "glCompressedTexImage3DOES", 20, -1 },
425 { "glCompressedTexSubImage2D", 20, -1 },
426 { "glCompressedTexSubImage3DOES", 20, -1 },
427 { "glCopyTexImage2D", 20, _gloffset_CopyTexImage2D },
428 { "glCopyTexSubImage2D", 20, _gloffset_CopyTexSubImage2D },
429 { "glCopyTexSubImage3DOES", 20, _gloffset_CopyTexSubImage3D },
430 { "glCreateProgram", 20, -1 },
431 { "glCreateShader", 20, -1 },
432 { "glCullFace", 20, _gloffset_CullFace },
433 { "glDeleteBuffers", 20, -1 },
434 { "glDeleteFramebuffers", 20, -1 },
435 { "glDeleteProgram", 20, -1 },
436 { "glDeleteRenderbuffers", 20, -1 },
437 { "glDeleteShader", 20, -1 },
438 { "glDeleteTextures", 20, _gloffset_DeleteTextures },
439 { "glDeleteVertexArraysOES", 20, -1 },
440 { "glDepthFunc", 20, _gloffset_DepthFunc },
441 { "glDepthMask", 20, _gloffset_DepthMask },
442 { "glDepthRangef", 20, -1 },
443 { "glDetachShader", 20, -1 },
444 { "glDisable", 20, _gloffset_Disable },
445 { "glDisableVertexAttribArray", 20, -1 },
446 { "glDrawArrays", 20, _gloffset_DrawArrays },
447 { "glDrawBuffersNV", 20, -1 },
448 { "glDrawElements", 20, _gloffset_DrawElements },
449 { "glEGLImageTargetRenderbufferStorageOES", 20, -1 },
450 { "glEGLImageTargetTexture2DOES", 20, -1 },
451 { "glEnable", 20, _gloffset_Enable },
452 { "glEnableVertexAttribArray", 20, -1 },
453 { "glFinish", 20, _gloffset_Finish },
454 { "glFlush", 20, _gloffset_Flush },
455 { "glFlushMappedBufferRangeEXT", 20, -1 },
456 { "glFramebufferRenderbuffer", 20, -1 },
457 { "glFramebufferTexture2D", 20, -1 },
458 { "glFramebufferTexture3DOES", 20, -1 },
459 { "glFrontFace", 20, _gloffset_FrontFace },
460 { "glGenBuffers", 20, -1 },
461 { "glGenFramebuffers", 20, -1 },
462 { "glGenRenderbuffers", 20, -1 },
463 { "glGenTextures", 20, _gloffset_GenTextures },
464 { "glGenVertexArraysOES", 20, -1 },
465 { "glGenerateMipmap", 20, -1 },
466 { "glGetActiveAttrib", 20, -1 },
467 { "glGetActiveUniform", 20, -1 },
468 { "glGetAttachedShaders", 20, -1 },
469 { "glGetAttribLocation", 20, -1 },
470 { "glGetBooleanv", 20, _gloffset_GetBooleanv },
471 { "glGetBufferParameteriv", 20, -1 },
472 { "glGetBufferPointervOES", 20, -1 },
473 { "glGetError", 20, _gloffset_GetError },
474 { "glGetFloatv", 20, _gloffset_GetFloatv },
475 { "glGetFramebufferAttachmentParameteriv", 20, -1 },
476 { "glGetIntegerv", 20, _gloffset_GetIntegerv },
477 { "glGetProgramInfoLog", 20, -1 },
478 { "glGetProgramiv", 20, -1 },
479 { "glGetRenderbufferParameteriv", 20, -1 },
480 { "glGetShaderInfoLog", 20, -1 },
481 { "glGetShaderPrecisionFormat", 20, -1 },
482 { "glGetShaderSource", 20, -1 },
483 { "glGetShaderiv", 20, -1 },
484 { "glGetString", 20, _gloffset_GetString },
485 { "glGetTexParameterfv", 20, _gloffset_GetTexParameterfv },
486 { "glGetTexParameteriv", 20, _gloffset_GetTexParameteriv },
487 { "glGetUniformLocation", 20, -1 },
488 { "glGetUniformfv", 20, -1 },
489 { "glGetUniformiv", 20, -1 },
490 { "glGetVertexAttribPointerv", 20, -1 },
491 { "glGetVertexAttribfv", 20, -1 },
492 { "glGetVertexAttribiv", 20, -1 },
493 { "glHint", 20, _gloffset_Hint },
494 { "glIsBuffer", 20, -1 },
495 { "glIsEnabled", 20, _gloffset_IsEnabled },
496 { "glIsFramebuffer", 20, -1 },
497 { "glIsProgram", 20, -1 },
498 { "glIsRenderbuffer", 20, -1 },
499 { "glIsShader", 20, -1 },
500 { "glIsTexture", 20, _gloffset_IsTexture },
501 { "glIsVertexArrayOES", 20, -1 },
502 { "glLineWidth", 20, _gloffset_LineWidth },
503 { "glLinkProgram", 20, -1 },
504 { "glMapBufferOES", 20, -1 },
505 { "glMapBufferRangeEXT", 20, -1 },
506 { "glMultiDrawArraysEXT", 20, -1 },
507 { "glMultiDrawElementsEXT", 20, -1 },
508 { "glPixelStorei", 20, _gloffset_PixelStorei },
509 { "glPolygonOffset", 20, _gloffset_PolygonOffset },
510 { "glReadBufferNV", 20, _gloffset_ReadBuffer },
511 { "glReadPixels", 20, _gloffset_ReadPixels },
512 { "glReleaseShaderCompiler", 20, -1 },
513 { "glRenderbufferStorage", 20, -1 },
514 { "glSampleCoverage", 20, -1 },
515 { "glScissor", 20, _gloffset_Scissor },
516 { "glShaderBinary", 20, -1 },
517 { "glShaderSource", 20, -1 },
518 { "glStencilFunc", 20, _gloffset_StencilFunc },
519 { "glStencilFuncSeparate", 20, -1 },
520 { "glStencilMask", 20, _gloffset_StencilMask },
521 { "glStencilMaskSeparate", 20, -1 },
522 { "glStencilOp", 20, _gloffset_StencilOp },
523 { "glStencilOpSeparate", 20, -1 },
524 { "glTexImage2D", 20, _gloffset_TexImage2D },
525 { "glTexImage3DOES", 20, _gloffset_TexImage3D },
526 { "glTexParameterf", 20, _gloffset_TexParameterf },
527 { "glTexParameterfv", 20, _gloffset_TexParameterfv },
528 { "glTexParameteri", 20, _gloffset_TexParameteri },
529 { "glTexParameteriv", 20, _gloffset_TexParameteriv },
530 { "glTexSubImage2D", 20, _gloffset_TexSubImage2D },
531 { "glTexSubImage3DOES", 20, _gloffset_TexSubImage3D },
532 { "glUniform1f", 20, -1 },
533 { "glUniform1fv", 20, -1 },
534 { "glUniform1i", 20, -1 },
535 { "glUniform1iv", 20, -1 },
536 { "glUniform2f", 20, -1 },
537 { "glUniform2fv", 20, -1 },
538 { "glUniform2i", 20, -1 },
539 { "glUniform2iv", 20, -1 },
540 { "glUniform3f", 20, -1 },
541 { "glUniform3fv", 20, -1 },
542 { "glUniform3i", 20, -1 },
543 { "glUniform3iv", 20, -1 },
544 { "glUniform4f", 20, -1 },
545 { "glUniform4fv", 20, -1 },
546 { "glUniform4i", 20, -1 },
547 { "glUniform4iv", 20, -1 },
548 { "glUniformMatrix2fv", 20, -1 },
549 { "glUniformMatrix3fv", 20, -1 },
550 { "glUniformMatrix4fv", 20, -1 },
551 { "glUnmapBufferOES", 20, -1 },
552 { "glUseProgram", 20, -1 },
553 { "glValidateProgram", 20, -1 },
554 { "glVertexAttrib1f", 20, -1 },
555 { "glVertexAttrib1fv", 20, -1 },
556 { "glVertexAttrib2f", 20, -1 },
557 { "glVertexAttrib2fv", 20, -1 },
558 { "glVertexAttrib3f", 20, -1 },
559 { "glVertexAttrib3fv", 20, -1 },
560 { "glVertexAttrib4f", 20, -1 },
561 { "glVertexAttrib4fv", 20, -1 },
562 { "glVertexAttribPointer", 20, -1 },
563 { "glViewport", 20, _gloffset_Viewport },
564 { NULL, 0, -1 }
565 };
566
567 const struct function gles3_functions_possible[] = {
568 { "glBeginQuery", 30, -1 },
569 { "glBeginTransformFeedback", 30, -1 },
570 { "glBindBufferBase", 30, -1 },
571 { "glBindBufferRange", 30, -1 },
572 { "glBindSampler", 30, -1 },
573 { "glBindTransformFeedback", 30, -1 },
574 // We check for the aliased -OES version in GLES 2
575 // { "glBindVertexArray", 30, -1 },
576 { "glBlitFramebuffer", 30, -1 },
577 { "glClearBufferfi", 30, -1 },
578 { "glClearBufferfv", 30, -1 },
579 { "glClearBufferiv", 30, -1 },
580 { "glClearBufferuiv", 30, -1 },
581 { "glClientWaitSync", 30, -1 },
582 // We check for the aliased -OES version in GLES 2
583 // { "glCompressedTexImage3D", 30, -1 },
584 // We check for the aliased -OES version in GLES 2
585 // { "glCompressedTexSubImage3D", 30, -1 },
586 { "glCopyBufferSubData", 30, -1 },
587 // We check for the aliased -OES version in GLES 2
588 // { "glCopyTexSubImage3D", 30, -1 },
589 { "glDeleteQueries", 30, -1 },
590 { "glDeleteSamplers", 30, -1 },
591 { "glDeleteSync", 30, -1 },
592 { "glDeleteTransformFeedbacks", 30, -1 },
593 // We check for the aliased -OES version in GLES 2
594 // { "glDeleteVertexArrays", 30, -1 },
595 { "glDrawArraysInstanced", 30, -1 },
596 // We check for the aliased -NV version in GLES 2
597 // { "glDrawBuffers", 30, -1 },
598 { "glDrawElementsInstanced", 30, -1 },
599 { "glDrawRangeElements", 30, -1 },
600 { "glEndQuery", 30, -1 },
601 { "glEndTransformFeedback", 30, -1 },
602 { "glFenceSync", 30, -1 },
603 // We check for the aliased -EXT version in GLES 2
604 // { "glFlushMappedBufferRange", 30, -1 },
605 { "glFramebufferTextureLayer", 30, -1 },
606 { "glGenQueries", 30, -1 },
607 { "glGenSamplers", 30, -1 },
608 { "glGenTransformFeedbacks", 30, -1 },
609 // We check for the aliased -OES version in GLES 2
610 // { "glGenVertexArrays", 30, -1 },
611 { "glGetActiveUniformBlockiv", 30, -1 },
612 { "glGetActiveUniformBlockName", 30, -1 },
613 { "glGetActiveUniformsiv", 30, -1 },
614 // We have an implementation (added Jan 1 2010, 1fbc7193) but never tested...
615 // { "glGetBufferParameteri64v", 30, -1 },
616 // We check for the aliased -OES version in GLES 2
617 // { "glGetBufferPointerv", 30, -1 },
618 { "glGetFragDataLocation", 30, -1 },
619 /// XXX: Missing implementation of glGetInteger64i_v
620 // { "glGetInteger64i_v", 30, -1 },
621 { "glGetInteger64v", 30, -1 },
622 { "glGetIntegeri_v", 30, -1 },
623 // XXX: Missing implementation of ARB_internalformat_query
624 // { "glGetInternalformativ", 30, -1 },
625 // XXX: Missing implementation of ARB_get_program_binary
626 /// { "glGetProgramBinary", 30, -1 },
627 { "glGetQueryiv", 30, -1 },
628 { "glGetQueryObjectuiv", 30, -1 },
629 { "glGetSamplerParameterfv", 30, -1 },
630 { "glGetSamplerParameteriv", 30, -1 },
631 { "glGetStringi", 30, -1 },
632 { "glGetSynciv", 30, -1 },
633 { "glGetTransformFeedbackVarying", 30, -1 },
634 { "glGetUniformBlockIndex", 30, -1 },
635 { "glGetUniformIndices", 30, -1 },
636 { "glGetUniformuiv", 30, -1 },
637 { "glGetVertexAttribIiv", 30, -1 },
638 { "glGetVertexAttribIuiv", 30, -1 },
639 { "glInvalidateFramebuffer", 30, -1 },
640 { "glInvalidateSubFramebuffer", 30, -1 },
641 { "glIsQuery", 30, -1 },
642 { "glIsSampler", 30, -1 },
643 { "glIsSync", 30, -1 },
644 { "glIsTransformFeedback", 30, -1 },
645 // We check for the aliased -OES version in GLES 2
646 // { "glIsVertexArray", 30, -1 },
647 // We check for the aliased -EXT version in GLES 2
648 // { "glMapBufferRange", 30, -1 },
649 { "glPauseTransformFeedback", 30, -1 },
650 // XXX: Missing implementation of ARB_get_program_binary
651 // { "glProgramBinary", 30, -1 },
652 // XXX: Missing implementation of ARB_get_program_binary
653 // { "glProgramParameteri", 30, -1 },
654 // We check for the aliased -NV version in GLES 2
655 // { "glReadBuffer", 30, -1 },
656 { "glRenderbufferStorageMultisample", 30, -1 },
657 { "glResumeTransformFeedback", 30, -1 },
658 { "glSamplerParameterf", 30, -1 },
659 { "glSamplerParameterfv", 30, -1 },
660 { "glSamplerParameteri", 30, -1 },
661 { "glSamplerParameteriv", 30, -1 },
662 // We check for the aliased -OES version in GLES 2
663 // { "glTexImage3D", 30, -1 },
664 { "glTexStorage2D", 30, -1 },
665 { "glTexStorage3D", 30, -1 },
666 // We check for the aliased -OES version in GLES 2
667 // { "glTexSubImage3D", 30, -1 },
668 { "glTransformFeedbackVaryings", 30, -1 },
669 { "glUniform1ui", 30, -1 },
670 { "glUniform1uiv", 30, -1 },
671 { "glUniform2ui", 30, -1 },
672 { "glUniform2uiv", 30, -1 },
673 { "glUniform3ui", 30, -1 },
674 { "glUniform3uiv", 30, -1 },
675 { "glUniform4ui", 30, -1 },
676 { "glUniform4uiv", 30, -1 },
677 { "glUniformBlockBinding", 30, -1 },
678 { "glUniformMatrix2x3fv", 30, -1 },
679 { "glUniformMatrix2x4fv", 30, -1 },
680 { "glUniformMatrix3x2fv", 30, -1 },
681 { "glUniformMatrix3x4fv", 30, -1 },
682 { "glUniformMatrix4x2fv", 30, -1 },
683 { "glUniformMatrix4x3fv", 30, -1 },
684 // We check for the aliased -OES version in GLES 2
685 // { "glUnmapBuffer", 30, -1 },
686 { "glVertexAttribDivisor", 30, -1 },
687 { "glVertexAttribI4i", 30, -1 },
688 { "glVertexAttribI4iv", 30, -1 },
689 { "glVertexAttribI4ui", 30, -1 },
690 { "glVertexAttribI4uiv", 30, -1 },
691 { "glVertexAttribIPointer", 30, -1 },
692 { "glWaitSync", 30, -1 },
693 { NULL, 0, -1 }
694 };