Add ICU message format support
[chromium-blink-merge.git] / ui / gl / generate_bindings.py
bloba3c4824a68df7853afda9ac0002fe2febf6bbcdc
1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
6 """code generator for GL/GLES extension wrangler."""
8 import optparse
9 import os
10 import collections
11 import re
12 import platform
13 import sys
14 from subprocess import call
15 from collections import namedtuple
17 HEADER_PATHS = [
18 '../../third_party/khronos',
19 '../../third_party/mesa/src/include',
20 '.',
21 '../../gpu',
24 UNCONDITIONALLY_BOUND_EXTENSIONS = set([
25 'WGL_ARB_extensions_string',
26 'WGL_EXT_extensions_string',
27 'GL_CHROMIUM_gles_depth_binding_hack', # crbug.com/448206
28 'GL_CHROMIUM_glgetstringi_hack', # crbug.com/470396
29 'GL_CHROMIUM_egl_khr_fence_sync_hack', # crbug.com/504758
32 """Function binding conditions can be specified manually by supplying a versions
33 array instead of the names array. Each version has the following keys:
34 name: Mandatory. Name of the function. Multiple versions can have the same
35 name but different conditions.
36 extensions: Extra Extensions for which the function is bound. Only needed
37 in some cases where the extension cannot be parsed from the
38 headers.
39 is_optional: True if the GetProcAddress can return NULL for the
40 function. This may happen for example when functions
41 are added to a new version of an extension, but the
42 extension string is not modified.
43 By default, the function gets its name from the first name in its names or
44 versions array. This can be overridden by supplying a 'known_as' key.
46 """
47 GL_FUNCTIONS = [
48 { 'return_type': 'void',
49 'names': ['glActiveTexture'],
50 'arguments': 'GLenum texture', },
51 { 'return_type': 'void',
52 'names': ['glAttachShader'],
53 'arguments': 'GLuint program, GLuint shader', },
54 { 'return_type': 'void',
55 'versions': [{ 'name': 'glBeginQuery' },
56 { 'name': 'glBeginQueryARB' },
57 { 'name': 'glBeginQueryEXT',
58 'extensions': ['GL_EXT_occlusion_query_boolean'] }],
59 'arguments': 'GLenum target, GLuint id', },
60 { 'return_type': 'void',
61 'versions': [{ 'name': 'glBeginTransformFeedback' }],
62 'arguments': 'GLenum primitiveMode', },
63 { 'return_type': 'void',
64 'names': ['glBindAttribLocation'],
65 'arguments': 'GLuint program, GLuint index, const char* name', },
66 { 'return_type': 'void',
67 'names': ['glBindBuffer'],
68 'arguments': 'GLenum target, GLuint buffer', },
69 { 'return_type': 'void',
70 'versions': [{ 'name': 'glBindBufferBase' }],
71 'arguments': 'GLenum target, GLuint index, GLuint buffer', },
72 { 'return_type': 'void',
73 'versions': [{ 'name': 'glBindBufferRange' }],
74 'arguments': 'GLenum target, GLuint index, GLuint buffer, GLintptr offset, '
75 'GLsizeiptr size', },
76 { 'return_type': 'void',
77 'names': ['glBindFragDataLocation'],
78 'arguments': 'GLuint program, GLuint colorNumber, const char* name', },
79 { 'return_type': 'void',
80 'names': ['glBindFragDataLocationIndexed'],
81 'arguments':
82 'GLuint program, GLuint colorNumber, GLuint index, const char* name', },
83 { 'return_type': 'void',
84 'names': ['glBindFramebufferEXT', 'glBindFramebuffer'],
85 'arguments': 'GLenum target, GLuint framebuffer', },
86 { 'return_type': 'void',
87 'names': ['glBindRenderbufferEXT', 'glBindRenderbuffer'],
88 'arguments': 'GLenum target, GLuint renderbuffer', },
89 { 'return_type': 'void',
90 'versions': [{ 'name': 'glBindSampler' }],
91 'arguments': 'GLuint unit, GLuint sampler', },
92 { 'return_type': 'void',
93 'names': ['glBindTexture'],
94 'arguments': 'GLenum target, GLuint texture', },
95 { 'return_type': 'void',
96 'versions': [{ 'name': 'glBindTransformFeedback' }],
97 'arguments': 'GLenum target, GLuint id', },
98 { 'return_type': 'void',
99 'known_as': 'glBindVertexArrayOES',
100 'versions': [{ 'name': 'glBindVertexArray',
101 'extensions': ['GL_ARB_vertex_array_object'], },
102 { 'name': 'glBindVertexArrayOES' },
103 { 'name': 'glBindVertexArrayAPPLE',
104 'extensions': ['GL_APPLE_vertex_array_object'] }],
105 'arguments': 'GLuint array' },
106 { 'return_type': 'void',
107 'known_as': 'glBlendBarrierKHR',
108 'versions': [{ 'name': 'glBlendBarrierNV',
109 'extensions': ['GL_NV_blend_equation_advanced'] },
110 { 'name': 'glBlendBarrierKHR',
111 'extensions': ['GL_KHR_blend_equation_advanced'] }],
112 'arguments': 'void' },
113 { 'return_type': 'void',
114 'names': ['glBlendColor'],
115 'arguments': 'GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha', },
116 { 'return_type': 'void',
117 'names': ['glBlendEquation'],
118 'arguments': ' GLenum mode ', },
119 { 'return_type': 'void',
120 'names': ['glBlendEquationSeparate'],
121 'arguments': 'GLenum modeRGB, GLenum modeAlpha', },
122 { 'return_type': 'void',
123 'names': ['glBlendFunc'],
124 'arguments': 'GLenum sfactor, GLenum dfactor', },
125 { 'return_type': 'void',
126 'names': ['glBlendFuncSeparate'],
127 'arguments':
128 'GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha', },
129 { 'return_type': 'void',
130 'names': ['glBlitFramebuffer'],
131 'arguments': 'GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, '
132 'GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, '
133 'GLbitfield mask, GLenum filter', },
134 { 'return_type': 'void',
135 'names': ['glBlitFramebufferANGLE', 'glBlitFramebuffer'],
136 'arguments': 'GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, '
137 'GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, '
138 'GLbitfield mask, GLenum filter', },
139 { 'return_type': 'void',
140 'names': ['glBlitFramebufferEXT', 'glBlitFramebuffer'],
141 'arguments': 'GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, '
142 'GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, '
143 'GLbitfield mask, GLenum filter', },
144 { 'return_type': 'void',
145 'names': ['glBufferData'],
146 'arguments':
147 'GLenum target, GLsizeiptr size, const void* data, GLenum usage', },
148 { 'return_type': 'void',
149 'names': ['glBufferSubData'],
150 'arguments':
151 'GLenum target, GLintptr offset, GLsizeiptr size, const void* data', },
152 { 'return_type': 'GLenum',
153 'names': ['glCheckFramebufferStatusEXT',
154 'glCheckFramebufferStatus'],
155 'arguments': 'GLenum target',
156 'logging_code': """
157 GL_SERVICE_LOG("GL_RESULT: " << GLEnums::GetStringEnum(result));
158 """, },
159 { 'return_type': 'void',
160 'names': ['glClear'],
161 'arguments': 'GLbitfield mask', },
162 { 'return_type': 'void',
163 'versions': [{ 'name': 'glClearBufferfi' }],
164 'arguments': 'GLenum buffer, GLint drawbuffer, const GLfloat depth, '
165 'GLint stencil', },
166 { 'return_type': 'void',
167 'versions': [{ 'name': 'glClearBufferfv' }],
168 'arguments': 'GLenum buffer, GLint drawbuffer, const GLfloat* value', },
169 { 'return_type': 'void',
170 'versions': [{ 'name': 'glClearBufferiv' }],
171 'arguments': 'GLenum buffer, GLint drawbuffer, const GLint* value', },
172 { 'return_type': 'void',
173 'versions': [{ 'name': 'glClearBufferuiv' }],
174 'arguments': 'GLenum buffer, GLint drawbuffer, const GLuint* value', },
175 { 'return_type': 'void',
176 'names': ['glClearColor'],
177 'arguments': 'GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha', },
178 { 'return_type': 'void',
179 'versions': [{ 'name': 'glClearDepth',
180 'extensions': ['GL_CHROMIUM_gles_depth_binding_hack'] }],
181 'arguments': 'GLclampd depth', },
182 { 'return_type': 'void',
183 'names': ['glClearDepthf'],
184 'arguments': 'GLclampf depth', },
185 { 'return_type': 'void',
186 'names': ['glClearStencil'],
187 'arguments': 'GLint s', },
188 { 'return_type': 'GLenum',
189 'versions': [{ 'name': 'glClientWaitSync',
190 'extensions': ['GL_ARB_sync'] }],
191 'arguments': 'GLsync sync, GLbitfield flags, GLuint64 timeout', },
192 { 'return_type': 'void',
193 'names': ['glColorMask'],
194 'arguments':
195 'GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha', },
196 { 'return_type': 'void',
197 'names': ['glCompileShader'],
198 'arguments': 'GLuint shader', },
199 { 'return_type': 'void',
200 'names': ['glCompressedTexImage2D'],
201 'arguments':
202 'GLenum target, GLint level, GLenum internalformat, GLsizei width, '
203 'GLsizei height, GLint border, GLsizei imageSize, const void* data', },
204 { 'return_type': 'void',
205 'versions': [{ 'name': 'glCompressedTexImage3D' }],
206 'arguments':
207 'GLenum target, GLint level, GLenum internalformat, GLsizei width, '
208 'GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, '
209 'const void* data', },
210 { 'return_type': 'void',
211 'names': ['glCompressedTexSubImage2D'],
212 'arguments':
213 'GLenum target, GLint level, GLint xoffset, GLint yoffset, '
214 'GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, '
215 'const void* data', },
216 { 'return_type': 'void',
217 'versions': [{ 'name': 'glCompressedTexSubImage3D' }],
218 'arguments':
219 'GLenum target, GLint level, GLint xoffset, GLint yoffset, '
220 'GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, '
221 'GLenum format, GLsizei imageSize, const void* data', },
222 { 'return_type': 'void',
223 'versions': [{ 'name': 'glCopyBufferSubData' }],
224 'arguments':
225 'GLenum readTarget, GLenum writeTarget, GLintptr readOffset, '
226 'GLintptr writeOffset, GLsizeiptr size', },
227 { 'return_type': 'void',
228 'names': ['glCopyTexImage2D'],
229 'arguments':
230 'GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, '
231 'GLsizei width, GLsizei height, GLint border', },
232 { 'return_type': 'void',
233 'names': ['glCopyTexSubImage2D'],
234 'arguments':
235 'GLenum target, GLint level, GLint xoffset, '
236 'GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height', },
237 { 'return_type': 'void',
238 'versions': [{ 'name': 'glCopyTexSubImage3D' }],
239 'arguments':
240 'GLenum target, GLint level, GLint xoffset, GLint yoffset, '
241 'GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height', },
242 { 'return_type': 'void',
243 'names': ['glCoverFillPathNV'],
244 'arguments': 'GLuint path, GLenum coverMode' },
245 { 'return_type': 'void',
246 'names': ['glCoverStrokePathNV'],
247 'arguments': 'GLuint name, GLenum coverMode' },
248 { 'return_type': 'GLuint',
249 'names': ['glCreateProgram'],
250 'arguments': 'void', },
251 { 'return_type': 'GLuint',
252 'names': ['glCreateShader'],
253 'arguments': 'GLenum type', },
254 { 'return_type': 'void',
255 'names': ['glCullFace'],
256 'arguments': 'GLenum mode', },
257 { 'return_type': 'void',
258 'names': ['glDeleteBuffers'],
259 'known_as': 'glDeleteBuffersARB',
260 'arguments': 'GLsizei n, const GLuint* buffers', },
261 { 'return_type': 'void',
262 'known_as': 'glDeleteFencesAPPLE',
263 'versions': [{ 'name': 'glDeleteFencesAPPLE',
264 'extensions': ['GL_APPLE_fence'] }],
265 'arguments': 'GLsizei n, const GLuint* fences', },
266 { 'return_type': 'void',
267 'names': ['glDeleteFencesNV'],
268 'arguments': 'GLsizei n, const GLuint* fences', },
269 { 'return_type': 'void',
270 'names': ['glDeleteFramebuffersEXT', 'glDeleteFramebuffers'],
271 'arguments': 'GLsizei n, const GLuint* framebuffers', },
272 { 'return_type': 'void',
273 'names': ['glDeletePathsNV'],
274 'arguments': 'GLuint path, GLsizei range' },
275 { 'return_type': 'void',
276 'names': ['glDeleteProgram'],
277 'arguments': 'GLuint program', },
278 { 'return_type': 'void',
279 'versions': [{ 'name': 'glDeleteQueries' },
280 { 'name': 'glDeleteQueriesARB'},
281 { 'name': 'glDeleteQueriesEXT',
282 'extensions': ['GL_EXT_occlusion_query_boolean'] }],
283 'arguments': 'GLsizei n, const GLuint* ids', },
284 { 'return_type': 'void',
285 'names': ['glDeleteRenderbuffersEXT', 'glDeleteRenderbuffers'],
286 'arguments': 'GLsizei n, const GLuint* renderbuffers', },
287 { 'return_type': 'void',
288 'versions': [{ 'name': 'glDeleteSamplers' }],
289 'arguments': 'GLsizei n, const GLuint* samplers', },
290 { 'return_type': 'void',
291 'names': ['glDeleteShader'],
292 'arguments': 'GLuint shader', },
293 { 'return_type': 'void',
294 'versions': [{ 'name': 'glDeleteSync',
295 'extensions': ['GL_ARB_sync'] }],
296 'arguments': 'GLsync sync', },
297 { 'return_type': 'void',
298 'names': ['glDeleteTextures'],
299 'arguments': 'GLsizei n, const GLuint* textures', },
300 { 'return_type': 'void',
301 'versions': [{ 'name': 'glDeleteTransformFeedbacks' }],
302 'arguments': 'GLsizei n, const GLuint* ids', },
303 { 'return_type': 'void',
304 'known_as': 'glDeleteVertexArraysOES',
305 'versions': [{ 'name': 'glDeleteVertexArrays',
306 'extensions': ['GL_ARB_vertex_array_object'], },
307 { 'name': 'glDeleteVertexArraysOES' },
308 { 'name': 'glDeleteVertexArraysAPPLE',
309 'extensions': ['GL_APPLE_vertex_array_object'] }],
310 'arguments': 'GLsizei n, const GLuint* arrays' },
311 { 'return_type': 'void',
312 'names': ['glDepthFunc'],
313 'arguments': 'GLenum func', },
314 { 'return_type': 'void',
315 'names': ['glDepthMask'],
316 'arguments': 'GLboolean flag', },
317 { 'return_type': 'void',
318 'versions': [{ 'name': 'glDepthRange',
319 'extensions': ['GL_CHROMIUM_gles_depth_binding_hack'] }],
320 'arguments': 'GLclampd zNear, GLclampd zFar', },
321 { 'return_type': 'void',
322 'names': ['glDepthRangef'],
323 'arguments': 'GLclampf zNear, GLclampf zFar', },
324 { 'return_type': 'void',
325 'names': ['glDetachShader'],
326 'arguments': 'GLuint program, GLuint shader', },
327 { 'return_type': 'void',
328 'names': ['glDisable'],
329 'arguments': 'GLenum cap', },
330 { 'return_type': 'void',
331 'names': ['glDisableVertexAttribArray'],
332 'arguments': 'GLuint index', },
333 { 'return_type': 'void',
334 'versions': [{ 'name': 'glDiscardFramebufferEXT',
335 'extensions': ['GL_EXT_discard_framebuffer'] }],
336 'arguments': 'GLenum target, GLsizei numAttachments, '
337 'const GLenum* attachments' },
338 { 'return_type': 'void',
339 'names': ['glDrawArrays'],
340 'arguments': 'GLenum mode, GLint first, GLsizei count', },
341 { 'return_type': 'void',
342 'known_as': 'glDrawArraysInstancedANGLE',
343 'names': ['glDrawArraysInstancedARB', 'glDrawArraysInstancedANGLE',
344 'glDrawArraysInstanced'],
345 'arguments': 'GLenum mode, GLint first, GLsizei count, GLsizei primcount', },
346 { 'return_type': 'void',
347 'names': ['glDrawBuffer'],
348 'arguments': 'GLenum mode', },
349 { 'return_type': 'void',
350 'names': ['glDrawBuffersARB', 'glDrawBuffersEXT', 'glDrawBuffers'],
351 'arguments': 'GLsizei n, const GLenum* bufs', },
352 { 'return_type': 'void',
353 'names': ['glDrawElements'],
354 'arguments':
355 'GLenum mode, GLsizei count, GLenum type, const void* indices', },
356 { 'return_type': 'void',
357 'known_as': 'glDrawElementsInstancedANGLE',
358 'names': ['glDrawElementsInstancedARB', 'glDrawElementsInstancedANGLE',
359 'glDrawElementsInstanced'],
360 'arguments':
361 'GLenum mode, GLsizei count, GLenum type, const void* indices, '
362 'GLsizei primcount', },
363 { 'return_type': 'void',
364 'versions': [{ 'name': 'glDrawRangeElements' }],
365 'arguments': 'GLenum mode, GLuint start, GLuint end, GLsizei count, '
366 'GLenum type, const void* indices', },
367 { 'return_type': 'void',
368 'names': ['glEGLImageTargetRenderbufferStorageOES'],
369 'arguments': 'GLenum target, GLeglImageOES image', },
370 { 'return_type': 'void',
371 'names': ['glEGLImageTargetTexture2DOES'],
372 'arguments': 'GLenum target, GLeglImageOES image', },
373 { 'return_type': 'void',
374 'names': ['glEnable'],
375 'arguments': 'GLenum cap', },
376 { 'return_type': 'void',
377 'names': ['glEnableVertexAttribArray'],
378 'arguments': 'GLuint index', },
379 { 'return_type': 'void',
380 'versions': [{ 'name': 'glEndQuery' },
381 { 'name': 'glEndQueryARB' },
382 { 'name': 'glEndQueryEXT',
383 'extensions': ['GL_EXT_occlusion_query_boolean'] }],
384 'arguments': 'GLenum target', },
385 { 'return_type': 'void',
386 'versions': [{ 'name': 'glEndTransformFeedback' }],
387 'arguments': 'void', },
388 { 'return_type': 'GLsync',
389 'versions': [{ 'name': 'glFenceSync',
390 'extensions': ['GL_ARB_sync'] }],
391 'arguments': 'GLenum condition, GLbitfield flags', },
392 { 'return_type': 'void',
393 'names': ['glFinish'],
394 'arguments': 'void', },
395 { 'return_type': 'void',
396 'known_as': 'glFinishFenceAPPLE',
397 'versions': [{ 'name': 'glFinishFenceAPPLE',
398 'extensions': ['GL_APPLE_fence'] }],
399 'arguments': 'GLuint fence', },
400 { 'return_type': 'void',
401 'names': ['glFinishFenceNV'],
402 'arguments': 'GLuint fence', },
403 { 'return_type': 'void',
404 'names': ['glFlush'],
405 'arguments': 'void', },
406 { 'return_type': 'void',
407 'names': ['glFlushMappedBufferRange'],
408 'arguments': 'GLenum target, GLintptr offset, GLsizeiptr length', },
409 { 'return_type': 'void',
410 'names': ['glFramebufferRenderbufferEXT', 'glFramebufferRenderbuffer'],
411 'arguments':
412 'GLenum target, GLenum attachment, GLenum renderbuffertarget, '
413 'GLuint renderbuffer', },
414 { 'return_type': 'void',
415 'names': ['glFramebufferTexture2DEXT', 'glFramebufferTexture2D'],
416 'arguments':
417 'GLenum target, GLenum attachment, GLenum textarget, GLuint texture, '
418 'GLint level', },
419 { 'return_type': 'void',
420 'names': ['glFramebufferTexture2DMultisampleEXT'],
421 'arguments':
422 'GLenum target, GLenum attachment, GLenum textarget, GLuint texture, '
423 'GLint level, GLsizei samples', },
424 { 'return_type': 'void',
425 'names': ['glFramebufferTexture2DMultisampleIMG'],
426 'arguments':
427 'GLenum target, GLenum attachment, GLenum textarget, GLuint texture, '
428 'GLint level, GLsizei samples', },
429 { 'return_type': 'void',
430 'versions': [{ 'name': 'glFramebufferTextureLayer' }],
431 'arguments': 'GLenum target, GLenum attachment, GLuint texture, GLint level, '
432 'GLint layer', },
433 { 'return_type': 'void',
434 'names': ['glFrontFace'],
435 'arguments': 'GLenum mode', },
436 { 'return_type': 'void',
437 'names': ['glGenBuffers'],
438 'known_as': 'glGenBuffersARB',
439 'arguments': 'GLsizei n, GLuint* buffers', },
440 { 'return_type': 'void',
441 'names': ['glGenerateMipmapEXT', 'glGenerateMipmap'],
442 'arguments': 'GLenum target', },
443 { 'return_type': 'void',
444 'known_as': 'glGenFencesAPPLE',
445 'versions': [{ 'name': 'glGenFencesAPPLE',
446 'extensions': ['GL_APPLE_fence'] }],
447 'arguments': 'GLsizei n, GLuint* fences', },
448 { 'return_type': 'void',
449 'names': ['glGenFencesNV'],
450 'arguments': 'GLsizei n, GLuint* fences', },
451 { 'return_type': 'void',
452 'names': ['glGenFramebuffersEXT', 'glGenFramebuffers'],
453 'arguments': 'GLsizei n, GLuint* framebuffers', },
454 { 'return_type': 'GLuint',
455 'names': ['glGenPathsNV'],
456 'arguments': 'GLsizei range' },
457 { 'return_type': 'void',
458 'versions': [{ 'name': 'glGenQueries' },
459 { 'name': 'glGenQueriesARB', },
460 { 'name' : 'glGenQueriesEXT',
461 'extensions': ['GL_EXT_occlusion_query_boolean'] }],
462 'arguments': 'GLsizei n, GLuint* ids', },
463 { 'return_type': 'void',
464 'names': ['glGenRenderbuffersEXT', 'glGenRenderbuffers'],
465 'arguments': 'GLsizei n, GLuint* renderbuffers', },
466 { 'return_type': 'void',
467 'versions': [{ 'name': 'glGenSamplers' }],
468 'arguments': 'GLsizei n, GLuint* samplers', },
469 { 'return_type': 'void',
470 'names': ['glGenTextures'],
471 'arguments': 'GLsizei n, GLuint* textures', },
472 { 'return_type': 'void',
473 'versions': [{ 'name': 'glGenTransformFeedbacks' }],
474 'arguments': 'GLsizei n, GLuint* ids', },
475 { 'return_type': 'void',
476 'known_as': 'glGenVertexArraysOES',
477 'versions': [{ 'name': 'glGenVertexArrays',
478 'extensions': ['GL_ARB_vertex_array_object'], },
479 { 'name': 'glGenVertexArraysOES' },
480 { 'name': 'glGenVertexArraysAPPLE',
481 'extensions': ['GL_APPLE_vertex_array_object'] }],
482 'arguments': 'GLsizei n, GLuint* arrays', },
483 { 'return_type': 'void',
484 'names': ['glGetActiveAttrib'],
485 'arguments':
486 'GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, '
487 'GLint* size, GLenum* type, char* name', },
488 { 'return_type': 'void',
489 'names': ['glGetActiveUniform'],
490 'arguments':
491 'GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, '
492 'GLint* size, GLenum* type, char* name', },
493 { 'return_type': 'void',
494 'versions': [{ 'name': 'glGetActiveUniformBlockiv' }],
495 'arguments': 'GLuint program, GLuint uniformBlockIndex, GLenum pname, '
496 'GLint* params', },
497 { 'return_type': 'void',
498 'versions': [{ 'name': 'glGetActiveUniformBlockName' }],
499 'arguments': 'GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, '
500 'GLsizei* length, char* uniformBlockName', },
501 { 'return_type': 'void',
502 'versions': [{ 'name': 'glGetActiveUniformsiv' }],
503 'arguments': 'GLuint program, GLsizei uniformCount, '
504 'const GLuint* uniformIndices, GLenum pname, GLint* params', },
505 { 'return_type': 'void',
506 'names': ['glGetAttachedShaders'],
507 'arguments':
508 'GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders', },
509 { 'return_type': 'GLint',
510 'names': ['glGetAttribLocation'],
511 'arguments': 'GLuint program, const char* name', },
512 { 'return_type': 'void',
513 'names': ['glGetBooleanv'],
514 'arguments': 'GLenum pname, GLboolean* params', },
515 { 'return_type': 'void',
516 'names': ['glGetBufferParameteriv'],
517 'arguments': 'GLenum target, GLenum pname, GLint* params', },
518 { 'return_type': 'GLenum',
519 'names': ['glGetError'],
520 'arguments': 'void',
521 'logging_code': """
522 GL_SERVICE_LOG("GL_RESULT: " << GLEnums::GetStringError(result));
523 """, },
524 { 'return_type': 'void',
525 'names': ['glGetFenceivNV'],
526 'arguments': 'GLuint fence, GLenum pname, GLint* params', },
527 { 'return_type': 'void',
528 'names': ['glGetFloatv'],
529 'arguments': 'GLenum pname, GLfloat* params', },
530 { 'return_type': 'GLint',
531 'versions': [{ 'name': 'glGetFragDataLocation' }],
532 'arguments': 'GLuint program, const char* name', },
533 { 'return_type': 'void',
534 'names': ['glGetFramebufferAttachmentParameterivEXT',
535 'glGetFramebufferAttachmentParameteriv'],
536 'arguments': 'GLenum target, '
537 'GLenum attachment, GLenum pname, GLint* params', },
538 { 'return_type': 'GLenum',
539 'names': ['glGetGraphicsResetStatusARB',
540 'glGetGraphicsResetStatusKHR',
541 'glGetGraphicsResetStatusEXT',
542 'glGetGraphicsResetStatus'],
543 'arguments': 'void', },
544 { 'return_type': 'void',
545 'versions': [{ 'name': 'glGetInteger64i_v' }],
546 'arguments': 'GLenum target, GLuint index, GLint64* data', },
547 { 'return_type': 'void',
548 'names': ['glGetInteger64v'],
549 'arguments': 'GLenum pname, GLint64* params', },
550 { 'return_type': 'void',
551 'versions': [{ 'name': 'glGetIntegeri_v' }],
552 'arguments': 'GLenum target, GLuint index, GLint* data', },
553 { 'return_type': 'void',
554 'names': ['glGetIntegerv'],
555 'arguments': 'GLenum pname, GLint* params', },
556 { 'return_type': 'void',
557 'versions': [{ 'name': 'glGetInternalformativ' }],
558 'arguments': 'GLenum target, GLenum internalformat, GLenum pname, '
559 'GLsizei bufSize, GLint* params', },
560 { 'return_type': 'void',
561 'known_as': 'glGetProgramBinary',
562 'versions': [{ 'name': 'glGetProgramBinaryOES' },
563 { 'name': 'glGetProgramBinary',
564 'extensions': ['GL_ARB_get_program_binary'] }],
565 'arguments': 'GLuint program, GLsizei bufSize, GLsizei* length, '
566 'GLenum* binaryFormat, GLvoid* binary' },
567 { 'return_type': 'void',
568 'names': ['glGetProgramInfoLog'],
569 'arguments':
570 'GLuint program, GLsizei bufsize, GLsizei* length, char* infolog', },
571 { 'return_type': 'void',
572 'names': ['glGetProgramiv'],
573 'arguments': 'GLuint program, GLenum pname, GLint* params', },
574 { 'return_type': 'GLint',
575 'names': ['glGetProgramResourceLocation'],
576 'arguments': 'GLuint program, GLenum programInterface, const char* name', },
577 { 'return_type': 'void',
578 'versions': [{ 'name': 'glGetQueryiv' },
579 { 'name': 'glGetQueryivARB' },
580 { 'name': 'glGetQueryivEXT',
581 'extensions': ['GL_EXT_occlusion_query_boolean'] }],
582 'arguments': 'GLenum target, GLenum pname, GLint* params', },
583 { 'return_type': 'void',
584 'versions': [{ 'name': 'glGetQueryObjecti64v',
585 'extensions': ['GL_ARB_timer_query'] },
586 { 'name': 'glGetQueryObjecti64vEXT' }],
587 'arguments': 'GLuint id, GLenum pname, GLint64* params', },
588 { 'return_type': 'void',
589 'versions': [{ 'name': 'glGetQueryObjectiv' },
590 { 'name': 'glGetQueryObjectivARB' },
591 { 'name': 'glGetQueryObjectivEXT' }],
592 'arguments': 'GLuint id, GLenum pname, GLint* params', },
593 { 'return_type': 'void',
594 'versions': [{ 'name': 'glGetQueryObjectui64v',
595 'extensions': ['GL_ARB_timer_query'] },
596 { 'name': 'glGetQueryObjectui64vEXT' }],
597 'arguments': 'GLuint id, GLenum pname, GLuint64* params', },
598 { 'return_type': 'void',
599 'versions': [{ 'name': 'glGetQueryObjectuiv' },
600 { 'name': 'glGetQueryObjectuivARB' },
601 { 'name': 'glGetQueryObjectuivEXT',
602 'extensions': ['GL_EXT_occlusion_query_boolean'] }],
603 'arguments': 'GLuint id, GLenum pname, GLuint* params', },
604 { 'return_type': 'void',
605 'names': ['glGetRenderbufferParameterivEXT', 'glGetRenderbufferParameteriv'],
606 'arguments': 'GLenum target, GLenum pname, GLint* params', },
607 { 'return_type': 'void',
608 'versions': [{ 'name': 'glGetSamplerParameterfv' }],
609 'arguments': 'GLuint sampler, GLenum pname, GLfloat* params', },
610 { 'return_type': 'void',
611 'versions': [{ 'name': 'glGetSamplerParameteriv' }],
612 'arguments': 'GLuint sampler, GLenum pname, GLint* params', },
613 { 'return_type': 'void',
614 'names': ['glGetShaderInfoLog'],
615 'arguments':
616 'GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog', },
617 { 'return_type': 'void',
618 'names': ['glGetShaderiv'],
619 'arguments': 'GLuint shader, GLenum pname, GLint* params', },
620 { 'return_type': 'void',
621 'names': ['glGetShaderPrecisionFormat'],
622 'arguments': 'GLenum shadertype, GLenum precisiontype, '
623 'GLint* range, GLint* precision', },
624 { 'return_type': 'void',
625 'names': ['glGetShaderSource'],
626 'arguments':
627 'GLuint shader, GLsizei bufsize, GLsizei* length, char* source', },
628 { 'return_type': 'const GLubyte*',
629 'names': ['glGetString'],
630 'arguments': 'GLenum name', },
631 { 'return_type': 'const GLubyte*',
632 # This is needed for bootstrapping on the desktop GL core profile.
633 # It won't be called unless the expected GL version is used.
634 'versions': [{ 'name': 'glGetStringi',
635 'extensions': ['GL_CHROMIUM_glgetstringi_hack'] }],
636 'arguments': 'GLenum name, GLuint index', },
637 { 'return_type': 'void',
638 'versions': [{ 'name': 'glGetSynciv',
639 'extensions': ['GL_ARB_sync'] }],
640 'arguments':
641 'GLsync sync, GLenum pname, GLsizei bufSize, GLsizei* length,'
642 'GLint* values', },
643 { 'return_type': 'void',
644 'names': ['glGetTexLevelParameterfv'],
645 'arguments': 'GLenum target, GLint level, GLenum pname, GLfloat* params', },
646 { 'return_type': 'void',
647 'names': ['glGetTexLevelParameteriv'],
648 'arguments': 'GLenum target, GLint level, GLenum pname, GLint* params', },
649 { 'return_type': 'void',
650 'names': ['glGetTexParameterfv'],
651 'arguments': 'GLenum target, GLenum pname, GLfloat* params', },
652 { 'return_type': 'void',
653 'names': ['glGetTexParameteriv'],
654 'arguments': 'GLenum target, GLenum pname, GLint* params', },
655 { 'return_type': 'void',
656 'versions': [{ 'name': 'glGetTransformFeedbackVarying' }],
657 'arguments': 'GLuint program, GLuint index, GLsizei bufSize, '
658 'GLsizei* length, GLsizei* size, GLenum* type, char* name', },
659 { 'return_type': 'void',
660 'names': ['glGetTranslatedShaderSourceANGLE'],
661 'arguments':
662 'GLuint shader, GLsizei bufsize, GLsizei* length, char* source', },
663 { 'return_type': 'GLuint',
664 'versions': [{ 'name': 'glGetUniformBlockIndex' }],
665 'arguments': 'GLuint program, const char* uniformBlockName', },
666 { 'return_type': 'void',
667 'names': ['glGetUniformfv'],
668 'arguments': 'GLuint program, GLint location, GLfloat* params', },
669 { 'return_type': 'void',
670 'versions': [{ 'name': 'glGetUniformIndices' }],
671 'arguments': 'GLuint program, GLsizei uniformCount, '
672 'const char* const* uniformNames, GLuint* uniformIndices', },
673 { 'return_type': 'void',
674 'names': ['glGetUniformiv'],
675 'arguments': 'GLuint program, GLint location, GLint* params', },
676 { 'return_type': 'GLint',
677 'names': ['glGetUniformLocation'],
678 'arguments': 'GLuint program, const char* name', },
679 { 'return_type': 'void',
680 'names': ['glGetUniformuiv'],
681 'arguments': 'GLuint program, GLint location, GLuint* params', },
682 { 'return_type': 'void',
683 'names': ['glGetVertexAttribfv'],
684 'arguments': 'GLuint index, GLenum pname, GLfloat* params', },
685 { 'return_type': 'void',
686 'names': ['glGetVertexAttribiv'],
687 'arguments': 'GLuint index, GLenum pname, GLint* params', },
688 { 'return_type': 'void',
689 'names': ['glGetVertexAttribPointerv'],
690 'arguments': 'GLuint index, GLenum pname, void** pointer', },
691 { 'return_type': 'void',
692 'names': ['glHint'],
693 'arguments': 'GLenum target, GLenum mode', },
694 { 'return_type': 'void',
695 'names': ['glInsertEventMarkerEXT'],
696 'arguments': 'GLsizei length, const char* marker', },
697 { 'return_type': 'void',
698 'versions': [{ 'name': 'glInvalidateFramebuffer' }],
699 'arguments': 'GLenum target, GLsizei numAttachments, '
700 'const GLenum* attachments' },
701 { 'return_type': 'void',
702 'versions': [{ 'name': 'glInvalidateSubFramebuffer' }],
703 'arguments':
704 'GLenum target, GLsizei numAttachments, const GLenum* attachments, '
705 'GLint x, GLint y, GLint width, GLint height', },
706 { 'return_type': 'GLboolean',
707 'names': ['glIsBuffer'],
708 'arguments': 'GLuint buffer', },
709 { 'return_type': 'GLboolean',
710 'names': ['glIsEnabled'],
711 'arguments': 'GLenum cap', },
712 { 'return_type': 'GLboolean',
713 'known_as': 'glIsFenceAPPLE',
714 'versions': [{ 'name': 'glIsFenceAPPLE',
715 'extensions': ['GL_APPLE_fence'] }],
716 'arguments': 'GLuint fence', },
717 { 'return_type': 'GLboolean',
718 'names': ['glIsFenceNV'],
719 'arguments': 'GLuint fence', },
720 { 'return_type': 'GLboolean',
721 'names': ['glIsFramebufferEXT', 'glIsFramebuffer'],
722 'arguments': 'GLuint framebuffer', },
723 { 'return_type': 'GLboolean',
724 'names': ['glIsPathNV'],
725 'arguments': 'GLuint path' },
726 { 'return_type': 'GLboolean',
727 'names': ['glIsProgram'],
728 'arguments': 'GLuint program', },
729 { 'return_type': 'GLboolean',
730 'versions': [{ 'name': 'glIsQuery' },
731 { 'name': 'glIsQueryARB' },
732 { 'name': 'glIsQueryEXT',
733 'extensions': ['GL_EXT_occlusion_query_boolean'] }],
734 'arguments': 'GLuint query', },
735 { 'return_type': 'GLboolean',
736 'names': ['glIsRenderbufferEXT', 'glIsRenderbuffer'],
737 'arguments': 'GLuint renderbuffer', },
738 { 'return_type': 'GLboolean',
739 'versions': [{ 'name': 'glIsSampler' }],
740 'arguments': 'GLuint sampler', },
741 { 'return_type': 'GLboolean',
742 'names': ['glIsShader'],
743 'arguments': 'GLuint shader', },
744 { 'return_type': 'GLboolean',
745 'versions': [{ 'name': 'glIsSync',
746 'extensions': ['GL_ARB_sync'] }],
747 'arguments': 'GLsync sync', },
748 { 'return_type': 'GLboolean',
749 'names': ['glIsTexture'],
750 'arguments': 'GLuint texture', },
751 { 'return_type': 'GLboolean',
752 'versions': [{ 'name': 'glIsTransformFeedback' }],
753 'arguments': 'GLuint id', },
754 { 'return_type': 'GLboolean',
755 'known_as': 'glIsVertexArrayOES',
756 'versions': [{ 'name': 'glIsVertexArray',
757 'extensions': ['GL_ARB_vertex_array_object'], },
758 { 'name': 'glIsVertexArrayOES' },
759 { 'name': 'glIsVertexArrayAPPLE',
760 'extensions': ['GL_APPLE_vertex_array_object'] }],
761 'arguments': 'GLuint array' },
762 { 'return_type': 'void',
763 'names': ['glLineWidth'],
764 'arguments': 'GLfloat width', },
765 { 'return_type': 'void',
766 'names': ['glLinkProgram'],
767 'arguments': 'GLuint program', },
768 { 'return_type': 'void*',
769 'known_as': 'glMapBuffer',
770 'names': ['glMapBufferOES', 'glMapBuffer'],
771 'arguments': 'GLenum target, GLenum access', },
772 { 'return_type': 'void*',
773 'known_as': 'glMapBufferRange',
774 'versions': [{ 'name': 'glMapBufferRange',
775 'extensions': ['GL_ARB_map_buffer_range'] },
776 { 'name': 'glMapBufferRangeEXT',
777 'extensions': ['GL_EXT_map_buffer_range'] }],
778 'arguments':
779 'GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access', },
780 { 'return_type': 'void',
781 'known_as': 'glMatrixLoadfEXT',
782 'versions': [{ 'name': 'glMatrixLoadfEXT',
783 'extensions': ['GL_EXT_direct_state_access',
784 'GL_NV_path_rendering'] }],
785 'arguments': 'GLenum matrixMode, const GLfloat* m' },
786 { 'return_type': 'void',
787 'known_as': 'glMatrixLoadIdentityEXT',
788 'versions': [{ 'name': 'glMatrixLoadIdentityEXT',
789 'extensions': ['GL_EXT_direct_state_access',
790 'GL_NV_path_rendering'] },],
791 'arguments': 'GLenum matrixMode' },
792 { 'return_type': 'void',
793 'names': ['glPathCommandsNV'],
794 'arguments': 'GLuint path, GLsizei numCommands, const GLubyte* commands, '
795 'GLsizei numCoords, GLenum coordType, const GLvoid* coords' },
796 { 'return_type': 'void',
797 'names': ['glPathParameterfNV'],
798 'arguments': 'GLuint path, GLenum pname, GLfloat value' },
799 { 'return_type': 'void',
800 'names': ['glPathParameteriNV'],
801 'arguments': 'GLuint path, GLenum pname, GLint value' },
802 { 'return_type': 'void',
803 'names': ['glPathStencilFuncNV'],
804 'arguments': 'GLenum func, GLint ref, GLuint mask' },
805 { 'return_type': 'void',
806 'versions': [{ 'name': 'glPauseTransformFeedback' }],
807 'arguments': 'void', },
808 { 'return_type': 'void',
809 'names': ['glPixelStorei'],
810 'arguments': 'GLenum pname, GLint param', },
811 { 'return_type': 'void',
812 'names': ['glPointParameteri'],
813 'arguments': 'GLenum pname, GLint param', },
814 { 'return_type': 'void',
815 'names': ['glPolygonOffset'],
816 'arguments': 'GLfloat factor, GLfloat units', },
817 { 'return_type': 'void',
818 'names': ['glPopGroupMarkerEXT'],
819 'arguments': 'void', },
820 { 'return_type': 'void',
821 'known_as': 'glProgramBinary',
822 'versions': [{ 'name': 'glProgramBinaryOES' },
823 { 'name': 'glProgramBinary',
824 'extensions': ['GL_ARB_get_program_binary'] }],
825 'arguments': 'GLuint program, GLenum binaryFormat, '
826 'const GLvoid* binary, GLsizei length' },
827 { 'return_type': 'void',
828 'versions': [{ 'name': 'glProgramParameteri',
829 'extensions': ['GL_ARB_get_program_binary'] }],
830 'arguments': 'GLuint program, GLenum pname, GLint value' },
831 { 'return_type': 'void',
832 'names': ['glPushGroupMarkerEXT'],
833 'arguments': 'GLsizei length, const char* marker', },
834 { 'return_type': 'void',
835 'versions': [{ 'name': 'glQueryCounter',
836 'extensions': ['GL_ARB_timer_query'] },
837 { 'name': 'glQueryCounterEXT' }],
838 'arguments': 'GLuint id, GLenum target', },
839 { 'return_type': 'void',
840 'names': ['glReadBuffer'],
841 'arguments': 'GLenum src', },
842 { 'return_type': 'void',
843 'names': ['glReadPixels'],
844 'arguments':
845 'GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, '
846 'GLenum type, void* pixels', },
847 { 'return_type': 'void',
848 'names': ['glReleaseShaderCompiler'],
849 'arguments': 'void', },
850 { 'return_type': 'void',
851 'names': ['glRenderbufferStorageEXT', 'glRenderbufferStorage'],
852 'arguments':
853 'GLenum target, GLenum internalformat, GLsizei width, GLsizei height', },
854 { 'return_type': 'void',
855 'names': ['glRenderbufferStorageMultisample'],
856 'arguments': 'GLenum target, GLsizei samples, GLenum internalformat, '
857 'GLsizei width, GLsizei height', },
858 { 'return_type': 'void',
859 'names': ['glRenderbufferStorageMultisampleANGLE'],
860 'arguments': 'GLenum target, GLsizei samples, GLenum internalformat, '
861 'GLsizei width, GLsizei height', },
862 { 'return_type': 'void',
863 'names': ['glRenderbufferStorageMultisampleEXT'],
864 'arguments': 'GLenum target, GLsizei samples, GLenum internalformat, '
865 'GLsizei width, GLsizei height', },
866 { 'return_type': 'void',
867 'names': ['glRenderbufferStorageMultisampleIMG'],
868 'arguments': 'GLenum target, GLsizei samples, GLenum internalformat, '
869 'GLsizei width, GLsizei height', },
870 { 'return_type': 'void',
871 'versions': [{ 'name': 'glResumeTransformFeedback' }],
872 'arguments': 'void', },
873 { 'return_type': 'void',
874 'names': ['glSampleCoverage'],
875 'arguments': 'GLclampf value, GLboolean invert', },
876 { 'return_type': 'void',
877 'versions': [{ 'name': 'glSamplerParameterf' }],
878 'arguments': 'GLuint sampler, GLenum pname, GLfloat param', },
879 { 'return_type': 'void',
880 'versions': [{ 'name': 'glSamplerParameterfv' }],
881 'arguments': 'GLuint sampler, GLenum pname, const GLfloat* params', },
882 { 'return_type': 'void',
883 'versions': [{ 'name': 'glSamplerParameteri' }],
884 'arguments': 'GLuint sampler, GLenum pname, GLint param', },
885 { 'return_type': 'void',
886 'versions': [{ 'name': 'glSamplerParameteriv' }],
887 'arguments': 'GLuint sampler, GLenum pname, const GLint* params', },
888 { 'return_type': 'void',
889 'names': ['glScissor'],
890 'arguments': 'GLint x, GLint y, GLsizei width, GLsizei height', },
891 { 'return_type': 'void',
892 'known_as': 'glSetFenceAPPLE',
893 'versions': [{ 'name': 'glSetFenceAPPLE',
894 'extensions': ['GL_APPLE_fence'] }],
895 'arguments': 'GLuint fence', },
896 { 'return_type': 'void',
897 'names': ['glSetFenceNV'],
898 'arguments': 'GLuint fence, GLenum condition', },
899 { 'return_type': 'void',
900 'names': ['glShaderBinary'],
901 'arguments': 'GLsizei n, const GLuint* shaders, GLenum binaryformat, '
902 'const void* binary, GLsizei length', },
903 { 'return_type': 'void',
904 'names': ['glShaderSource'],
905 'arguments': 'GLuint shader, GLsizei count, const char* const* str, '
906 'const GLint* length',
907 'logging_code': """
908 GL_SERVICE_LOG_CODE_BLOCK({
909 for (GLsizei ii = 0; ii < count; ++ii) {
910 if (str[ii]) {
911 if (length && length[ii] >= 0) {
912 std::string source(str[ii], length[ii]);
913 GL_SERVICE_LOG(" " << ii << ": ---\\n" << source << "\\n---");
914 } else {
915 GL_SERVICE_LOG(" " << ii << ": ---\\n" << str[ii] << "\\n---");
917 } else {
918 GL_SERVICE_LOG(" " << ii << ": NULL");
922 """, },
923 { 'return_type': 'void',
924 'names': ['glStencilFillPathNV'],
925 'arguments': 'GLuint path, GLenum fillMode, GLuint mask' },
926 { 'return_type': 'void',
927 'names': ['glStencilFunc'],
928 'arguments': 'GLenum func, GLint ref, GLuint mask', },
929 { 'return_type': 'void',
930 'names': ['glStencilFuncSeparate'],
931 'arguments': 'GLenum face, GLenum func, GLint ref, GLuint mask', },
932 { 'return_type': 'void',
933 'names': ['glStencilMask'],
934 'arguments': 'GLuint mask', },
935 { 'return_type': 'void',
936 'names': ['glStencilMaskSeparate'],
937 'arguments': 'GLenum face, GLuint mask', },
938 { 'return_type': 'void',
939 'names': ['glStencilOp'],
940 'arguments': 'GLenum fail, GLenum zfail, GLenum zpass', },
941 { 'return_type': 'void',
942 'names': ['glStencilOpSeparate'],
943 'arguments': 'GLenum face, GLenum fail, GLenum zfail, GLenum zpass', },
944 { 'return_type': 'void',
945 'names': ['glStencilStrokePathNV'],
946 'arguments': 'GLuint path, GLint reference, GLuint mask' },
947 { 'return_type': 'void',
948 'names': ['glStencilThenCoverFillPathNV'],
949 'arguments': 'GLuint path, GLenum fillMode, GLuint mask, GLenum coverMode',
950 'is_optional': True, },
951 { 'return_type': 'void',
952 'names': ['glStencilThenCoverStrokePathNV'],
953 'arguments': 'GLuint path, GLint reference, GLuint mask, GLenum coverMode',
954 'is_optional': True, },
955 { 'return_type': 'GLboolean',
956 'known_as': 'glTestFenceAPPLE',
957 'versions': [{ 'name': 'glTestFenceAPPLE',
958 'extensions': ['GL_APPLE_fence'] }],
959 'arguments': 'GLuint fence', },
960 { 'return_type': 'GLboolean',
961 'names': ['glTestFenceNV'],
962 'arguments': 'GLuint fence', },
963 { 'return_type': 'void',
964 'names': ['glTexImage2D'],
965 'arguments':
966 'GLenum target, GLint level, GLint internalformat, GLsizei width, '
967 'GLsizei height, GLint border, GLenum format, GLenum type, '
968 'const void* pixels', },
969 { 'return_type': 'void',
970 'versions': [{ 'name': 'glTexImage3D' }],
971 'arguments':
972 'GLenum target, GLint level, GLint internalformat, GLsizei width, '
973 'GLsizei height, GLsizei depth, GLint border, GLenum format, '
974 'GLenum type, const void* pixels', },
975 { 'return_type': 'void',
976 'names': ['glTexParameterf'],
977 'arguments': 'GLenum target, GLenum pname, GLfloat param', },
978 { 'return_type': 'void',
979 'names': ['glTexParameterfv'],
980 'arguments': 'GLenum target, GLenum pname, const GLfloat* params', },
981 { 'return_type': 'void',
982 'names': ['glTexParameteri'],
983 'arguments': 'GLenum target, GLenum pname, GLint param', },
984 { 'return_type': 'void',
985 'names': ['glTexParameteriv'],
986 'arguments': 'GLenum target, GLenum pname, const GLint* params', },
987 { 'return_type': 'void',
988 'known_as': 'glTexStorage2DEXT',
989 'versions': [{ 'name': 'glTexStorage2D',
990 'extensions': ['GL_ARB_texture_storage'] },
991 { 'name': 'glTexStorage2DEXT',
992 'extensions': ['GL_EXT_texture_storage'] }],
993 'arguments': 'GLenum target, GLsizei levels, GLenum internalformat, '
994 'GLsizei width, GLsizei height', },
995 { 'return_type': 'void',
996 'versions': [{ 'name': 'glTexStorage3D' }],
997 'arguments': 'GLenum target, GLsizei levels, GLenum internalformat, '
998 'GLsizei width, GLsizei height, GLsizei depth', },
999 { 'return_type': 'void',
1000 'names': ['glTexSubImage2D'],
1001 'arguments':
1002 'GLenum target, GLint level, GLint xoffset, GLint yoffset, '
1003 'GLsizei width, GLsizei height, GLenum format, GLenum type, '
1004 'const void* pixels', },
1005 { 'return_type': 'void',
1006 'versions': [{ 'name': 'glTexSubImage3D' }],
1007 'arguments':
1008 'GLenum target, GLint level, GLint xoffset, GLint yoffset, '
1009 'GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, '
1010 'GLenum format, GLenum type, const void* pixels', },
1011 { 'return_type': 'void',
1012 'versions': [{ 'name': 'glTransformFeedbackVaryings' }],
1013 'arguments': 'GLuint program, GLsizei count, const char* const* varyings, '
1014 'GLenum bufferMode', },
1015 { 'return_type': 'void',
1016 'names': ['glUniform1f'],
1017 'arguments': 'GLint location, GLfloat x', },
1018 { 'return_type': 'void',
1019 'names': ['glUniform1fv'],
1020 'arguments': 'GLint location, GLsizei count, const GLfloat* v', },
1021 { 'return_type': 'void',
1022 'names': ['glUniform1i'],
1023 'arguments': 'GLint location, GLint x', },
1024 { 'return_type': 'void',
1025 'names': ['glUniform1iv'],
1026 'arguments': 'GLint location, GLsizei count, const GLint* v', },
1027 { 'return_type': 'void',
1028 'versions': [{ 'name': 'glUniform1ui' }],
1029 'arguments': 'GLint location, GLuint v0', },
1030 { 'return_type': 'void',
1031 'versions': [{ 'name': 'glUniform1uiv' }],
1032 'arguments': 'GLint location, GLsizei count, const GLuint* v', },
1033 { 'return_type': 'void',
1034 'names': ['glUniform2f'],
1035 'arguments': 'GLint location, GLfloat x, GLfloat y', },
1036 { 'return_type': 'void',
1037 'names': ['glUniform2fv'],
1038 'arguments': 'GLint location, GLsizei count, const GLfloat* v', },
1039 { 'return_type': 'void',
1040 'names': ['glUniform2i'],
1041 'arguments': 'GLint location, GLint x, GLint y', },
1042 { 'return_type': 'void',
1043 'names': ['glUniform2iv'],
1044 'arguments': 'GLint location, GLsizei count, const GLint* v', },
1045 { 'return_type': 'void',
1046 'versions': [{ 'name': 'glUniform2ui' }],
1047 'arguments': 'GLint location, GLuint v0, GLuint v1', },
1048 { 'return_type': 'void',
1049 'versions': [{ 'name': 'glUniform2uiv' }],
1050 'arguments': 'GLint location, GLsizei count, const GLuint* v', },
1051 { 'return_type': 'void',
1052 'names': ['glUniform3f'],
1053 'arguments': 'GLint location, GLfloat x, GLfloat y, GLfloat z', },
1054 { 'return_type': 'void',
1055 'names': ['glUniform3fv'],
1056 'arguments': 'GLint location, GLsizei count, const GLfloat* v', },
1057 { 'return_type': 'void',
1058 'names': ['glUniform3i'],
1059 'arguments': 'GLint location, GLint x, GLint y, GLint z', },
1060 { 'return_type': 'void',
1061 'names': ['glUniform3iv'],
1062 'arguments': 'GLint location, GLsizei count, const GLint* v', },
1063 { 'return_type': 'void',
1064 'versions': [{ 'name': 'glUniform3ui' }],
1065 'arguments': 'GLint location, GLuint v0, GLuint v1, GLuint v2', },
1066 { 'return_type': 'void',
1067 'versions': [{ 'name': 'glUniform3uiv' }],
1068 'arguments': 'GLint location, GLsizei count, const GLuint* v', },
1069 { 'return_type': 'void',
1070 'names': ['glUniform4f'],
1071 'arguments': 'GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w', },
1072 { 'return_type': 'void',
1073 'names': ['glUniform4fv'],
1074 'arguments': 'GLint location, GLsizei count, const GLfloat* v', },
1075 { 'return_type': 'void',
1076 'names': ['glUniform4i'],
1077 'arguments': 'GLint location, GLint x, GLint y, GLint z, GLint w', },
1078 { 'return_type': 'void',
1079 'names': ['glUniform4iv'],
1080 'arguments': 'GLint location, GLsizei count, const GLint* v', },
1081 { 'return_type': 'void',
1082 'versions': [{ 'name': 'glUniform4ui' }],
1083 'arguments': 'GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3', },
1084 { 'return_type': 'void',
1085 'versions': [{ 'name': 'glUniform4uiv' }],
1086 'arguments': 'GLint location, GLsizei count, const GLuint* v', },
1087 { 'return_type': 'void',
1088 'versions': [{ 'name': 'glUniformBlockBinding' }],
1089 'arguments': 'GLuint program, GLuint uniformBlockIndex, '
1090 'GLuint uniformBlockBinding', },
1091 { 'return_type': 'void',
1092 'names': ['glUniformMatrix2fv'],
1093 'arguments': 'GLint location, GLsizei count, '
1094 'GLboolean transpose, const GLfloat* value', },
1095 { 'return_type': 'void',
1096 'versions': [{ 'name': 'glUniformMatrix2x3fv' }],
1097 'arguments': 'GLint location, GLsizei count, '
1098 'GLboolean transpose, const GLfloat* value', },
1099 { 'return_type': 'void',
1100 'versions': [{ 'name': 'glUniformMatrix2x4fv' }],
1101 'arguments': 'GLint location, GLsizei count, '
1102 'GLboolean transpose, const GLfloat* value', },
1103 { 'return_type': 'void',
1104 'names': ['glUniformMatrix3fv'],
1105 'arguments': 'GLint location, GLsizei count, '
1106 'GLboolean transpose, const GLfloat* value', },
1107 { 'return_type': 'void',
1108 'versions': [{ 'name': 'glUniformMatrix3x2fv' }],
1109 'arguments': 'GLint location, GLsizei count, '
1110 'GLboolean transpose, const GLfloat* value', },
1111 { 'return_type': 'void',
1112 'versions': [{ 'name': 'glUniformMatrix3x4fv' }],
1113 'arguments': 'GLint location, GLsizei count, '
1114 'GLboolean transpose, const GLfloat* value', },
1115 { 'return_type': 'void',
1116 'names': ['glUniformMatrix4fv'],
1117 'arguments': 'GLint location, GLsizei count, '
1118 'GLboolean transpose, const GLfloat* value', },
1119 { 'return_type': 'void',
1120 'versions': [{ 'name': 'glUniformMatrix4x2fv' }],
1121 'arguments': 'GLint location, GLsizei count, '
1122 'GLboolean transpose, const GLfloat* value', },
1123 { 'return_type': 'void',
1124 'versions': [{ 'name': 'glUniformMatrix4x3fv' }],
1125 'arguments': 'GLint location, GLsizei count, '
1126 'GLboolean transpose, const GLfloat* value', },
1127 { 'return_type': 'GLboolean',
1128 'known_as': 'glUnmapBuffer',
1129 'names': ['glUnmapBufferOES', 'glUnmapBuffer'],
1130 'arguments': 'GLenum target', },
1131 { 'return_type': 'void',
1132 'names': ['glUseProgram'],
1133 'arguments': 'GLuint program', },
1134 { 'return_type': 'void',
1135 'names': ['glValidateProgram'],
1136 'arguments': 'GLuint program', },
1137 { 'return_type': 'void',
1138 'names': ['glVertexAttrib1f'],
1139 'arguments': 'GLuint indx, GLfloat x', },
1140 { 'return_type': 'void',
1141 'names': ['glVertexAttrib1fv'],
1142 'arguments': 'GLuint indx, const GLfloat* values', },
1143 { 'return_type': 'void',
1144 'names': ['glVertexAttrib2f'],
1145 'arguments': 'GLuint indx, GLfloat x, GLfloat y', },
1146 { 'return_type': 'void',
1147 'names': ['glVertexAttrib2fv'],
1148 'arguments': 'GLuint indx, const GLfloat* values', },
1149 { 'return_type': 'void',
1150 'names': ['glVertexAttrib3f'],
1151 'arguments': 'GLuint indx, GLfloat x, GLfloat y, GLfloat z', },
1152 { 'return_type': 'void',
1153 'names': ['glVertexAttrib3fv'],
1154 'arguments': 'GLuint indx, const GLfloat* values', },
1155 { 'return_type': 'void',
1156 'names': ['glVertexAttrib4f'],
1157 'arguments': 'GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w', },
1158 { 'return_type': 'void',
1159 'names': ['glVertexAttrib4fv'],
1160 'arguments': 'GLuint indx, const GLfloat* values', },
1161 { 'return_type': 'void',
1162 'known_as': 'glVertexAttribDivisorANGLE',
1163 'names': ['glVertexAttribDivisorARB', 'glVertexAttribDivisorANGLE',
1164 'glVertexAttribDivisor'],
1165 'arguments':
1166 'GLuint index, GLuint divisor', },
1167 { 'return_type': 'void',
1168 'versions': [{ 'name': 'glVertexAttribI4i' }],
1169 'arguments': 'GLuint indx, GLint x, GLint y, GLint z, GLint w', },
1170 { 'return_type': 'void',
1171 'versions': [{ 'name': 'glVertexAttribI4iv' }],
1172 'arguments': 'GLuint indx, const GLint* values', },
1173 { 'return_type': 'void',
1174 'versions': [{ 'name': 'glVertexAttribI4ui' }],
1175 'arguments': 'GLuint indx, GLuint x, GLuint y, GLuint z, GLuint w', },
1176 { 'return_type': 'void',
1177 'versions': [{ 'name': 'glVertexAttribI4uiv' }],
1178 'arguments': 'GLuint indx, const GLuint* values', },
1179 { 'return_type': 'void',
1180 'versions': [{ 'name': 'glVertexAttribIPointer' }],
1181 'arguments': 'GLuint indx, GLint size, GLenum type, GLsizei stride, '
1182 'const void* ptr', },
1183 { 'return_type': 'void',
1184 'names': ['glVertexAttribPointer'],
1185 'arguments': 'GLuint indx, GLint size, GLenum type, GLboolean normalized, '
1186 'GLsizei stride, const void* ptr', },
1187 { 'return_type': 'void',
1188 'names': ['glViewport'],
1189 'arguments': 'GLint x, GLint y, GLsizei width, GLsizei height', },
1190 { 'return_type': 'GLenum',
1191 'versions': [{ 'name': 'glWaitSync',
1192 'extensions': ['GL_ARB_sync'] }],
1193 'arguments':
1194 'GLsync sync, GLbitfield flags, GLuint64 timeout', },
1197 OSMESA_FUNCTIONS = [
1198 { 'return_type': 'void',
1199 'names': ['OSMesaColorClamp'],
1200 'arguments': 'GLboolean enable', },
1201 { 'return_type': 'OSMesaContext',
1202 'names': ['OSMesaCreateContext'],
1203 'arguments': 'GLenum format, OSMesaContext sharelist', },
1204 { 'return_type': 'OSMesaContext',
1205 'names': ['OSMesaCreateContextExt'],
1206 'arguments':
1207 'GLenum format, GLint depthBits, GLint stencilBits, GLint accumBits, '
1208 'OSMesaContext sharelist', },
1209 { 'return_type': 'void',
1210 'names': ['OSMesaDestroyContext'],
1211 'arguments': 'OSMesaContext ctx', },
1212 { 'return_type': 'GLboolean',
1213 'names': ['OSMesaGetColorBuffer'],
1214 'arguments': 'OSMesaContext c, GLint* width, GLint* height, GLint* format, '
1215 'void** buffer', },
1216 { 'return_type': 'OSMesaContext',
1217 'names': ['OSMesaGetCurrentContext'],
1218 'arguments': 'void', },
1219 { 'return_type': 'GLboolean',
1220 'names': ['OSMesaGetDepthBuffer'],
1221 'arguments':
1222 'OSMesaContext c, GLint* width, GLint* height, GLint* bytesPerValue, '
1223 'void** buffer', },
1224 { 'return_type': 'void',
1225 'names': ['OSMesaGetIntegerv'],
1226 'arguments': 'GLint pname, GLint* value', },
1227 { 'return_type': 'OSMESAproc',
1228 'names': ['OSMesaGetProcAddress'],
1229 'arguments': 'const char* funcName', },
1230 { 'return_type': 'GLboolean',
1231 'names': ['OSMesaMakeCurrent'],
1232 'arguments': 'OSMesaContext ctx, void* buffer, GLenum type, GLsizei width, '
1233 'GLsizei height', },
1234 { 'return_type': 'void',
1235 'names': ['OSMesaPixelStore'],
1236 'arguments': 'GLint pname, GLint value', },
1239 EGL_FUNCTIONS = [
1240 { 'return_type': 'EGLBoolean',
1241 'names': ['eglBindAPI'],
1242 'arguments': 'EGLenum api', },
1243 { 'return_type': 'EGLBoolean',
1244 'names': ['eglBindTexImage'],
1245 'arguments': 'EGLDisplay dpy, EGLSurface surface, EGLint buffer', },
1246 { 'return_type': 'EGLBoolean',
1247 'names': ['eglChooseConfig'],
1248 'arguments': 'EGLDisplay dpy, const EGLint* attrib_list, EGLConfig* configs, '
1249 'EGLint config_size, EGLint* num_config', },
1250 { 'return_type': 'EGLint',
1251 'versions': [{ 'name': 'eglClientWaitSyncKHR',
1252 'extensions': [
1253 'EGL_KHR_fence_sync',
1254 'GL_CHROMIUM_egl_khr_fence_sync_hack'
1255 ] }],
1256 'arguments': 'EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, '
1257 'EGLTimeKHR timeout' },
1258 { 'return_type': 'EGLBoolean',
1259 'names': ['eglCopyBuffers'],
1260 'arguments':
1261 'EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target', },
1262 { 'return_type': 'EGLContext',
1263 'names': ['eglCreateContext'],
1264 'arguments': 'EGLDisplay dpy, EGLConfig config, EGLContext share_context, '
1265 'const EGLint* attrib_list', },
1266 { 'return_type': 'EGLImageKHR',
1267 'versions': [{ 'name': 'eglCreateImageKHR',
1268 'extensions':
1269 ['EGL_KHR_image_base', 'EGL_KHR_gl_texture_2D_image'] }],
1270 'arguments':
1271 'EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, '
1272 'const EGLint* attrib_list' },
1273 { 'return_type': 'EGLSurface',
1274 'names': ['eglCreatePbufferFromClientBuffer'],
1275 'arguments':
1276 'EGLDisplay dpy, EGLenum buftype, void* buffer, EGLConfig config, '
1277 'const EGLint* attrib_list', },
1278 { 'return_type': 'EGLSurface',
1279 'names': ['eglCreatePbufferSurface'],
1280 'arguments': 'EGLDisplay dpy, EGLConfig config, const EGLint* attrib_list', },
1281 { 'return_type': 'EGLSurface',
1282 'names': ['eglCreatePixmapSurface'],
1283 'arguments': 'EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, '
1284 'const EGLint* attrib_list', },
1285 { 'return_type': 'EGLSyncKHR',
1286 'versions': [{ 'name': 'eglCreateSyncKHR',
1287 'extensions': [
1288 'EGL_KHR_fence_sync',
1289 'GL_CHROMIUM_egl_khr_fence_sync_hack'
1290 ] }],
1291 'arguments': 'EGLDisplay dpy, EGLenum type, const EGLint* attrib_list' },
1292 { 'return_type': 'EGLSurface',
1293 'names': ['eglCreateWindowSurface'],
1294 'arguments': 'EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, '
1295 'const EGLint* attrib_list', },
1296 { 'return_type': 'EGLBoolean',
1297 'names': ['eglDestroyContext'],
1298 'arguments': 'EGLDisplay dpy, EGLContext ctx', },
1299 { 'return_type': 'EGLBoolean',
1300 'versions': [{ 'name' : 'eglDestroyImageKHR',
1301 'extensions': ['EGL_KHR_image_base'] }],
1302 'arguments': 'EGLDisplay dpy, EGLImageKHR image' },
1303 { 'return_type': 'EGLBoolean',
1304 'names': ['eglDestroySurface'],
1305 'arguments': 'EGLDisplay dpy, EGLSurface surface', },
1306 { 'return_type': 'EGLBoolean',
1307 'versions': [{ 'name': 'eglDestroySyncKHR',
1308 'extensions': [
1309 'EGL_KHR_fence_sync',
1310 'GL_CHROMIUM_egl_khr_fence_sync_hack'
1311 ] }],
1312 'arguments': 'EGLDisplay dpy, EGLSyncKHR sync' },
1313 { 'return_type': 'EGLBoolean',
1314 'names': ['eglGetConfigAttrib'],
1315 'arguments':
1316 'EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint* value', },
1317 { 'return_type': 'EGLBoolean',
1318 'names': ['eglGetConfigs'],
1319 'arguments': 'EGLDisplay dpy, EGLConfig* configs, EGLint config_size, '
1320 'EGLint* num_config', },
1321 { 'return_type': 'EGLContext',
1322 'names': ['eglGetCurrentContext'],
1323 'arguments': 'void', },
1324 { 'return_type': 'EGLDisplay',
1325 'names': ['eglGetCurrentDisplay'],
1326 'arguments': 'void', },
1327 { 'return_type': 'EGLSurface',
1328 'names': ['eglGetCurrentSurface'],
1329 'arguments': 'EGLint readdraw', },
1330 { 'return_type': 'EGLDisplay',
1331 'names': ['eglGetDisplay'],
1332 'arguments': 'EGLNativeDisplayType display_id', },
1333 { 'return_type': 'EGLint',
1334 'names': ['eglGetError'],
1335 'arguments': 'void', },
1336 { 'return_type': 'EGLDisplay',
1337 'known_as': 'eglGetPlatformDisplayEXT',
1338 'versions': [{ 'name': 'eglGetPlatformDisplayEXT',
1339 'client_extensions': ['EGL_EXT_platform_base'], }],
1340 'arguments': 'EGLenum platform, void* native_display, '
1341 'const EGLint* attrib_list', },
1342 { 'return_type': '__eglMustCastToProperFunctionPointerType',
1343 'names': ['eglGetProcAddress'],
1344 'arguments': 'const char* procname', },
1345 { 'return_type': 'EGLBoolean',
1346 'versions': [{ 'name': 'eglGetSyncAttribKHR',
1347 'extensions': [
1348 'EGL_KHR_fence_sync',
1349 'GL_CHROMIUM_egl_khr_fence_sync_hack'
1350 ] }],
1351 'arguments': 'EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, '
1352 'EGLint* value' },
1353 { 'return_type': 'EGLBoolean',
1354 'names': ['eglGetSyncValuesCHROMIUM'],
1355 'arguments':
1356 'EGLDisplay dpy, EGLSurface surface, '
1357 'EGLuint64CHROMIUM* ust, EGLuint64CHROMIUM* msc, '
1358 'EGLuint64CHROMIUM* sbc', },
1359 { 'return_type': 'EGLBoolean',
1360 'names': ['eglInitialize'],
1361 'arguments': 'EGLDisplay dpy, EGLint* major, EGLint* minor', },
1362 { 'return_type': 'EGLBoolean',
1363 'names': ['eglMakeCurrent'],
1364 'arguments':
1365 'EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx', },
1366 { 'return_type': 'EGLBoolean',
1367 'names': ['eglPostSubBufferNV'],
1368 'arguments': 'EGLDisplay dpy, EGLSurface surface, '
1369 'EGLint x, EGLint y, EGLint width, EGLint height', },
1370 { 'return_type': 'EGLenum',
1371 'names': ['eglQueryAPI'],
1372 'arguments': 'void', },
1373 { 'return_type': 'EGLBoolean',
1374 'names': ['eglQueryContext'],
1375 'arguments':
1376 'EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint* value', },
1377 { 'return_type': 'const char*',
1378 'names': ['eglQueryString'],
1379 'arguments': 'EGLDisplay dpy, EGLint name', },
1380 { 'return_type': 'EGLBoolean',
1381 'names': ['eglQuerySurface'],
1382 'arguments':
1383 'EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint* value', },
1384 { 'return_type': 'EGLBoolean',
1385 'names': ['eglQuerySurfacePointerANGLE'],
1386 'arguments':
1387 'EGLDisplay dpy, EGLSurface surface, EGLint attribute, void** value', },
1388 { 'return_type': 'EGLBoolean',
1389 'names': ['eglReleaseTexImage'],
1390 'arguments': 'EGLDisplay dpy, EGLSurface surface, EGLint buffer', },
1391 { 'return_type': 'EGLBoolean',
1392 'names': ['eglReleaseThread'],
1393 'arguments': 'void', },
1394 { 'return_type': 'EGLBoolean',
1395 'names': ['eglSurfaceAttrib'],
1396 'arguments':
1397 'EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value', },
1398 { 'return_type': 'EGLBoolean',
1399 'names': ['eglSwapBuffers'],
1400 'arguments': 'EGLDisplay dpy, EGLSurface surface', },
1401 { 'return_type': 'EGLBoolean',
1402 'names': ['eglSwapInterval'],
1403 'arguments': 'EGLDisplay dpy, EGLint interval', },
1404 { 'return_type': 'EGLBoolean',
1405 'names': ['eglTerminate'],
1406 'arguments': 'EGLDisplay dpy', },
1407 { 'return_type': 'EGLBoolean',
1408 'names': ['eglWaitClient'],
1409 'arguments': 'void', },
1410 { 'return_type': 'EGLBoolean',
1411 'names': ['eglWaitGL'],
1412 'arguments': 'void', },
1413 { 'return_type': 'EGLBoolean',
1414 'names': ['eglWaitNative'],
1415 'arguments': 'EGLint engine', },
1416 { 'return_type': 'EGLint',
1417 'versions': [{ 'name': 'eglWaitSyncKHR',
1418 'extensions': ['EGL_KHR_wait_sync'] }],
1419 'arguments': 'EGLDisplay dpy, EGLSyncKHR sync, EGLint flags' },
1422 WGL_FUNCTIONS = [
1423 { 'return_type': 'BOOL',
1424 'names': ['wglChoosePixelFormatARB'],
1425 'arguments':
1426 'HDC dc, const int* int_attrib_list, const float* float_attrib_list, '
1427 'UINT max_formats, int* formats, UINT* num_formats', },
1428 { 'return_type': 'BOOL',
1429 'names': ['wglCopyContext'],
1430 'arguments': 'HGLRC hglrcSrc, HGLRC hglrcDst, UINT mask', },
1431 { 'return_type': 'HGLRC',
1432 'names': ['wglCreateContext'],
1433 'arguments': 'HDC hdc', },
1434 { 'return_type': 'HGLRC',
1435 'names': ['wglCreateLayerContext'],
1436 'arguments': 'HDC hdc, int iLayerPlane', },
1437 { 'return_type': 'HPBUFFERARB',
1438 'names': ['wglCreatePbufferARB'],
1439 'arguments': 'HDC hDC, int iPixelFormat, int iWidth, int iHeight, '
1440 'const int* piAttribList', },
1441 { 'return_type': 'BOOL',
1442 'names': ['wglDeleteContext'],
1443 'arguments': 'HGLRC hglrc', },
1444 { 'return_type': 'BOOL',
1445 'names': ['wglDestroyPbufferARB'],
1446 'arguments': 'HPBUFFERARB hPbuffer', },
1447 { 'return_type': 'HGLRC',
1448 'names': ['wglGetCurrentContext'],
1449 'arguments': '', },
1450 { 'return_type': 'HDC',
1451 'names': ['wglGetCurrentDC'],
1452 'arguments': '', },
1453 { 'return_type': 'const char*',
1454 'names': ['wglGetExtensionsStringARB'],
1455 'arguments': 'HDC hDC', },
1456 { 'return_type': 'const char*',
1457 'names': ['wglGetExtensionsStringEXT'],
1458 'arguments': '', },
1459 { 'return_type': 'HDC',
1460 'names': ['wglGetPbufferDCARB'],
1461 'arguments': 'HPBUFFERARB hPbuffer', },
1462 { 'return_type': 'BOOL',
1463 'names': ['wglMakeCurrent'],
1464 'arguments': 'HDC hdc, HGLRC hglrc', },
1465 { 'return_type': 'BOOL',
1466 'names': ['wglQueryPbufferARB'],
1467 'arguments': 'HPBUFFERARB hPbuffer, int iAttribute, int* piValue', },
1468 { 'return_type': 'int',
1469 'names': ['wglReleasePbufferDCARB'],
1470 'arguments': 'HPBUFFERARB hPbuffer, HDC hDC', },
1471 { 'return_type': 'BOOL',
1472 'names': ['wglShareLists'],
1473 'arguments': 'HGLRC hglrc1, HGLRC hglrc2', },
1474 { 'return_type': 'BOOL',
1475 'names': ['wglSwapIntervalEXT'],
1476 'arguments': 'int interval', },
1477 { 'return_type': 'BOOL',
1478 'names': ['wglSwapLayerBuffers'],
1479 'arguments': 'HDC hdc, UINT fuPlanes', },
1482 GLX_FUNCTIONS = [
1483 { 'return_type': 'void',
1484 'names': ['glXBindTexImageEXT'],
1485 'arguments':
1486 'Display* dpy, GLXDrawable drawable, int buffer, int* attribList', },
1487 { 'return_type': 'GLXFBConfig*',
1488 'names': ['glXChooseFBConfig'],
1489 'arguments':
1490 'Display* dpy, int screen, const int* attribList, int* nitems', },
1491 { 'return_type': 'XVisualInfo*',
1492 'names': ['glXChooseVisual'],
1493 'arguments': 'Display* dpy, int screen, int* attribList', },
1494 { 'return_type': 'void',
1495 'names': ['glXCopyContext'],
1496 'arguments':
1497 'Display* dpy, GLXContext src, GLXContext dst, unsigned long mask', },
1498 { 'return_type': 'void',
1499 'names': ['glXCopySubBufferMESA'],
1500 'arguments': 'Display* dpy, GLXDrawable drawable, '
1501 'int x, int y, int width, int height', },
1502 { 'return_type': 'GLXContext',
1503 'names': ['glXCreateContext'],
1504 'arguments':
1505 'Display* dpy, XVisualInfo* vis, GLXContext shareList, int direct', },
1506 { 'return_type': 'GLXContext',
1507 'names': ['glXCreateContextAttribsARB'],
1508 'arguments':
1509 'Display* dpy, GLXFBConfig config, GLXContext share_context, int direct, '
1510 'const int* attrib_list', },
1511 { 'return_type': 'GLXPixmap',
1512 'names': ['glXCreateGLXPixmap'],
1513 'arguments': 'Display* dpy, XVisualInfo* visual, Pixmap pixmap', },
1514 { 'return_type': 'GLXContext',
1515 'names': ['glXCreateNewContext'],
1516 'arguments': 'Display* dpy, GLXFBConfig config, int renderType, '
1517 'GLXContext shareList, int direct', },
1518 { 'return_type': 'GLXPbuffer',
1519 'names': ['glXCreatePbuffer'],
1520 'arguments': 'Display* dpy, GLXFBConfig config, const int* attribList', },
1521 { 'return_type': 'GLXPixmap',
1522 'names': ['glXCreatePixmap'],
1523 'arguments': 'Display* dpy, GLXFBConfig config, '
1524 'Pixmap pixmap, const int* attribList', },
1525 { 'return_type': 'GLXWindow',
1526 'names': ['glXCreateWindow'],
1527 'arguments':
1528 'Display* dpy, GLXFBConfig config, Window win, const int* attribList', },
1529 { 'return_type': 'void',
1530 'names': ['glXDestroyContext'],
1531 'arguments': 'Display* dpy, GLXContext ctx', },
1532 { 'return_type': 'void',
1533 'names': ['glXDestroyGLXPixmap'],
1534 'arguments': 'Display* dpy, GLXPixmap pixmap', },
1535 { 'return_type': 'void',
1536 'names': ['glXDestroyPbuffer'],
1537 'arguments': 'Display* dpy, GLXPbuffer pbuf', },
1538 { 'return_type': 'void',
1539 'names': ['glXDestroyPixmap'],
1540 'arguments': 'Display* dpy, GLXPixmap pixmap', },
1541 { 'return_type': 'void',
1542 'names': ['glXDestroyWindow'],
1543 'arguments': 'Display* dpy, GLXWindow window', },
1544 { 'return_type': 'const char*',
1545 'names': ['glXGetClientString'],
1546 'arguments': 'Display* dpy, int name', },
1547 { 'return_type': 'int',
1548 'names': ['glXGetConfig'],
1549 'arguments': 'Display* dpy, XVisualInfo* visual, int attrib, int* value', },
1550 { 'return_type': 'GLXContext',
1551 'names': ['glXGetCurrentContext'],
1552 'arguments': 'void', },
1553 { 'return_type': 'Display*',
1554 'names': ['glXGetCurrentDisplay'],
1555 'arguments': 'void', },
1556 { 'return_type': 'GLXDrawable',
1557 'names': ['glXGetCurrentDrawable'],
1558 'arguments': 'void', },
1559 { 'return_type': 'GLXDrawable',
1560 'names': ['glXGetCurrentReadDrawable'],
1561 'arguments': 'void', },
1562 { 'return_type': 'int',
1563 'names': ['glXGetFBConfigAttrib'],
1564 'arguments': 'Display* dpy, GLXFBConfig config, int attribute, int* value', },
1565 { 'return_type': 'GLXFBConfig',
1566 'names': ['glXGetFBConfigFromVisualSGIX'],
1567 'arguments': 'Display* dpy, XVisualInfo* visualInfo', },
1568 { 'return_type': 'GLXFBConfig*',
1569 'names': ['glXGetFBConfigs'],
1570 'arguments': 'Display* dpy, int screen, int* nelements', },
1571 { 'return_type': 'bool',
1572 'names': ['glXGetMscRateOML'],
1573 'arguments':
1574 'Display* dpy, GLXDrawable drawable, int32* numerator, '
1575 'int32* denominator' },
1576 { 'return_type': 'void',
1577 'names': ['glXGetSelectedEvent'],
1578 'arguments': 'Display* dpy, GLXDrawable drawable, unsigned long* mask', },
1579 { 'return_type': 'bool',
1580 'names': ['glXGetSyncValuesOML'],
1581 'arguments':
1582 'Display* dpy, GLXDrawable drawable, int64* ust, int64* msc, '
1583 'int64* sbc' },
1584 { 'return_type': 'XVisualInfo*',
1585 'names': ['glXGetVisualFromFBConfig'],
1586 'arguments': 'Display* dpy, GLXFBConfig config', },
1587 { 'return_type': 'int',
1588 'names': ['glXIsDirect'],
1589 'arguments': 'Display* dpy, GLXContext ctx', },
1590 { 'return_type': 'int',
1591 'names': ['glXMakeContextCurrent'],
1592 'arguments':
1593 'Display* dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx', },
1594 { 'return_type': 'int',
1595 'names': ['glXMakeCurrent'],
1596 'arguments': 'Display* dpy, GLXDrawable drawable, GLXContext ctx', },
1597 { 'return_type': 'int',
1598 'names': ['glXQueryContext'],
1599 'arguments': 'Display* dpy, GLXContext ctx, int attribute, int* value', },
1600 { 'return_type': 'void',
1601 'names': ['glXQueryDrawable'],
1602 'arguments':
1603 'Display* dpy, GLXDrawable draw, int attribute, unsigned int* value', },
1604 { 'return_type': 'int',
1605 'names': ['glXQueryExtension'],
1606 'arguments': 'Display* dpy, int* errorb, int* event', },
1607 { 'return_type': 'const char*',
1608 'names': ['glXQueryExtensionsString'],
1609 'arguments': 'Display* dpy, int screen', },
1610 { 'return_type': 'const char*',
1611 'names': ['glXQueryServerString'],
1612 'arguments': 'Display* dpy, int screen, int name', },
1613 { 'return_type': 'int',
1614 'names': ['glXQueryVersion'],
1615 'arguments': 'Display* dpy, int* maj, int* min', },
1616 { 'return_type': 'void',
1617 'names': ['glXReleaseTexImageEXT'],
1618 'arguments': 'Display* dpy, GLXDrawable drawable, int buffer', },
1619 { 'return_type': 'void',
1620 'names': ['glXSelectEvent'],
1621 'arguments': 'Display* dpy, GLXDrawable drawable, unsigned long mask', },
1622 { 'return_type': 'void',
1623 'names': ['glXSwapBuffers'],
1624 'arguments': 'Display* dpy, GLXDrawable drawable', },
1625 { 'return_type': 'void',
1626 'names': ['glXSwapIntervalEXT'],
1627 'arguments': 'Display* dpy, GLXDrawable drawable, int interval', },
1628 { 'return_type': 'void',
1629 'names': ['glXSwapIntervalMESA'],
1630 'arguments': 'unsigned int interval', },
1631 { 'return_type': 'void',
1632 'names': ['glXUseXFont'],
1633 'arguments': 'Font font, int first, int count, int list', },
1634 { 'return_type': 'void',
1635 'names': ['glXWaitGL'],
1636 'arguments': 'void', },
1637 { 'return_type': 'int',
1638 'names': ['glXWaitVideoSyncSGI'],
1639 'arguments': 'int divisor, int remainder, unsigned int* count', },
1640 { 'return_type': 'void',
1641 'names': ['glXWaitX'],
1642 'arguments': 'void', },
1645 FUNCTION_SETS = [
1646 [GL_FUNCTIONS, 'gl', [
1647 'GL/gl.h',
1648 'noninclude/GL/glext.h',
1649 'GLES2/gl2ext.h',
1650 'GLES3/gl3.h',
1651 'GLES3/gl31.h',
1652 # Files below are Chromium-specific and shipped with Chromium sources.
1653 'GL/glextchromium.h',
1654 'GLES2/gl2chromium.h',
1655 'GLES2/gl2extchromium.h'
1656 ], []],
1657 [OSMESA_FUNCTIONS, 'osmesa', [], []],
1658 [EGL_FUNCTIONS, 'egl', [
1659 'EGL/eglext.h',
1660 # Files below are Chromium-specific and shipped with Chromium sources.
1661 'EGL/eglextchromium.h',
1664 'EGL_ANGLE_d3d_share_handle_client_buffer',
1665 'EGL_ANGLE_surface_d3d_texture_2d_share_handle',
1668 [WGL_FUNCTIONS, 'wgl', ['noninclude/GL/wglext.h'], []],
1669 [GLX_FUNCTIONS, 'glx', ['GL/glx.h', 'noninclude/GL/glxext.h'], []],
1672 GLES2_HEADERS_WITH_ENUMS = [
1673 'GLES2/gl2.h',
1674 'GLES2/gl2ext.h',
1675 'GLES2/gl2chromium.h',
1676 'GLES2/gl2extchromium.h',
1677 'GLES3/gl3.h',
1680 SELF_LOCATION = os.path.dirname(os.path.abspath(__file__))
1682 LICENSE_AND_HEADER = """\
1683 // Copyright 2014 The Chromium Authors. All rights reserved.
1684 // Use of this source code is governed by a BSD-style license that can be
1685 // found in the LICENSE file.
1687 // This file is auto-generated from
1688 // ui/gl/generate_bindings.py
1689 // It's formatted by clang-format using chromium coding style:
1690 // clang-format -i -style=chromium filename
1691 // DO NOT EDIT!
1695 GLVersion = namedtuple('GLVersion', 'is_es major_version minor_version')
1697 def GLVersionBindAlways(version):
1698 return version.major_version <= 2
1701 def GetStaticBinding(func):
1702 """If this function has a name assigned to it that should be bound always,
1703 then return this name.
1705 This will be the case if either a function name is specified
1706 that depends on an extension from UNCONDITIONALLY_BOUND_EXTENSIONS,
1707 or if the GL version it depends on is assumed to be available (e.g. <=2.1).
1708 There can only be one name that satisfies this condition (or the bindings
1709 would be ambiguous)."""
1711 static_bindings = set([])
1713 for version in func['versions']:
1714 if 'extensions' in version:
1715 extensions = version['extensions']
1716 num_unconditional_extensions = len(
1717 extensions & UNCONDITIONALLY_BOUND_EXTENSIONS)
1718 if num_unconditional_extensions:
1719 static_bindings.add(version['name'])
1720 elif 'gl_versions' in version:
1721 versions = [v for v in version['gl_versions'] if GLVersionBindAlways(v)]
1722 # It's only unconditional if it exists in GL and GLES
1723 if len(versions) == 2:
1724 assert versions[0].is_es != versions[1].is_es
1725 static_bindings.add(version['name'])
1726 else:
1727 static_bindings.add(version['name'])
1729 # Avoid ambiguous bindings (static binding with different names)
1730 assert len(static_bindings) <= 1
1731 if len(static_bindings):
1732 static_name = static_bindings.pop()
1733 # Avoid ambiguous bindings (static and dynamic bindings with
1734 # different names)
1735 assert len([v['name'] for v in func['versions']
1736 if v['name'] != static_name]) == 0, func
1737 return static_name
1738 else:
1739 return None
1742 def GenerateHeader(file, functions, set_name,
1743 used_extensions, used_client_extensions):
1744 """Generates gl_bindings_autogen_x.h"""
1746 # Write file header.
1747 file.write(LICENSE_AND_HEADER +
1750 #ifndef UI_GFX_GL_GL_BINDINGS_AUTOGEN_%(name)s_H_
1751 #define UI_GFX_GL_GL_BINDINGS_AUTOGEN_%(name)s_H_
1753 namespace gfx {
1755 class GLContext;
1757 """ % {'name': set_name.upper()})
1759 # Write typedefs for function pointer types. Always use the GL name for the
1760 # typedef.
1761 file.write('\n')
1762 for func in functions:
1763 file.write('typedef %s (GL_BINDING_CALL *%sProc)(%s);\n' %
1764 (func['return_type'], func['known_as'], func['arguments']))
1766 # Write declarations for booleans indicating which extensions are available.
1767 file.write('\n')
1768 file.write("struct Extensions%s {\n" % set_name.upper())
1769 for extension in sorted(used_client_extensions):
1770 file.write(' bool b_%s;\n' % extension)
1771 for extension in sorted(used_extensions):
1772 file.write(' bool b_%s;\n' % extension)
1773 file.write('};\n')
1774 file.write('\n')
1776 # Write Procs struct.
1777 file.write("struct Procs%s {\n" % set_name.upper())
1778 for func in functions:
1779 file.write(' %sProc %sFn;\n' % (func['known_as'], func['known_as']))
1780 file.write('};\n')
1781 file.write('\n')
1783 # Write Api class.
1784 file.write(
1785 """class GL_EXPORT %(name)sApi {
1786 public:
1787 %(name)sApi();
1788 virtual ~%(name)sApi();
1790 """ % {'name': set_name.upper()})
1791 for func in functions:
1792 file.write(' virtual %s %sFn(%s) = 0;\n' %
1793 (func['return_type'], func['known_as'], func['arguments']))
1794 file.write('};\n')
1795 file.write('\n')
1797 file.write( '} // namespace gfx\n')
1799 # Write macros to invoke function pointers. Always use the GL name for the
1800 # macro.
1801 file.write('\n')
1802 for func in functions:
1803 file.write('#define %s ::gfx::g_current_%s_context->%sFn\n' %
1804 (func['known_as'], set_name.lower(), func['known_as']))
1806 file.write('\n')
1807 file.write('#endif // UI_GFX_GL_GL_BINDINGS_AUTOGEN_%s_H_\n' %
1808 set_name.upper())
1811 def GenerateAPIHeader(file, functions, set_name):
1812 """Generates gl_bindings_api_autogen_x.h"""
1814 # Write file header.
1815 file.write(LICENSE_AND_HEADER)
1817 # Write API declaration.
1818 for func in functions:
1819 file.write(' %s %sFn(%s) override;\n' %
1820 (func['return_type'], func['known_as'], func['arguments']))
1822 file.write('\n')
1825 def GenerateMockHeader(file, functions, set_name):
1826 """Generates gl_mock_autogen_x.h"""
1828 # Write file header.
1829 file.write(LICENSE_AND_HEADER)
1831 # Write API declaration.
1832 for func in functions:
1833 args = func['arguments']
1834 if args == 'void':
1835 args = ''
1836 arg_count = 0
1837 if len(args):
1838 arg_count = func['arguments'].count(',') + 1
1839 # TODO(zmo): crbug.com/456340
1840 # For now gmock supports at most 10 args.
1841 if arg_count <= 10:
1842 file.write(' MOCK_METHOD%d(%s, %s(%s));\n' %
1843 (arg_count, func['known_as'][2:], func['return_type'], args))
1844 else:
1845 file.write(' // TODO(zmo): crbug.com/456340\n')
1846 file.write(' // %s cannot be mocked because it has %d args.\n' %
1847 (func['known_as'], arg_count))
1849 file.write('\n')
1852 def GenerateSource(file, functions, set_name, used_extensions,
1853 used_client_extensions, options):
1854 """Generates gl_bindings_autogen_x.cc"""
1856 set_header_name = "ui/gl/gl_" + set_name.lower() + "_api_implementation.h"
1857 include_list = [ 'base/trace_event/trace_event.h',
1858 'ui/gl/gl_enums.h',
1859 'ui/gl/gl_bindings.h',
1860 'ui/gl/gl_context.h',
1861 'ui/gl/gl_implementation.h',
1862 'ui/gl/gl_version_info.h',
1863 set_header_name ]
1865 includes_string = "\n".join(["#include \"{0}\"".format(h)
1866 for h in sorted(include_list)])
1868 # Write file header.
1869 file.write(LICENSE_AND_HEADER +
1872 #include <string>
1876 namespace gfx {
1877 """ % includes_string)
1879 file.write('\n')
1880 file.write('static bool g_debugBindingsInitialized;\n')
1881 file.write('Driver%s g_driver_%s;\n' % (set_name.upper(), set_name.lower()))
1882 file.write('\n')
1884 # Write stub functions that take the place of some functions before a context
1885 # is initialized. This is done to provide clear asserts on debug build and to
1886 # avoid crashing in case of a bug on release build.
1887 file.write('\n')
1888 num_dynamic = 0
1889 for func in functions:
1890 static_binding = GetStaticBinding(func)
1891 if static_binding:
1892 func['static_binding'] = static_binding
1893 else:
1894 num_dynamic = num_dynamic + 1
1896 print "[%s] %d static bindings, %d dynamic bindings" % (
1897 set_name, len(functions) - num_dynamic, num_dynamic)
1899 # Write function to initialize the function pointers that are always the same
1900 # and to initialize bindings where choice of the function depends on the
1901 # extension string or the GL version to point to stub functions.
1902 file.write('\n')
1903 file.write('void Driver%s::InitializeStaticBindings() {\n' %
1904 set_name.upper())
1906 def WriteFuncBinding(file, known_as, version_name):
1907 file.write(
1908 ' fn.%sFn = reinterpret_cast<%sProc>(GetGLProcAddress("%s"));\n' %
1909 (known_as, known_as, version_name))
1911 for func in functions:
1912 if 'static_binding' in func:
1913 WriteFuncBinding(file, func['known_as'], func['static_binding'])
1914 else:
1915 file.write(' fn.%sFn = 0;\n' % func['known_as'])
1917 def GetGLVersionCondition(gl_version):
1918 if GLVersionBindAlways(gl_version):
1919 if gl_version.is_es:
1920 return 'ver->is_es'
1921 else:
1922 return '!ver->is_es'
1923 elif gl_version.is_es:
1924 return 'ver->IsAtLeastGLES(%du, %du)' % (
1925 gl_version.major_version, gl_version.minor_version)
1926 else:
1927 return 'ver->IsAtLeastGL(%du, %du)' % (
1928 gl_version.major_version, gl_version.minor_version)
1930 def GetBindingCondition(version):
1931 conditions = []
1932 if 'gl_versions' in version:
1933 conditions.extend(
1934 [GetGLVersionCondition(v) for v in version['gl_versions']])
1935 if 'extensions' in version and version['extensions']:
1936 conditions.extend(
1937 ['ext.b_%s' % e for e in version['extensions']])
1938 return ' || '.join(conditions)
1940 def WriteConditionalFuncBinding(file, func):
1941 assert len(func['versions']) > 0
1942 known_as = func['known_as']
1943 i = 0
1944 first_version = True
1945 while i < len(func['versions']):
1946 version = func['versions'][i]
1947 cond = GetBindingCondition(version)
1948 if first_version:
1949 file.write(' if (%s) {\n ' % cond)
1950 else:
1951 file.write(' else if (%s) {\n ' % (cond))
1953 WriteFuncBinding(file, known_as, version['name'])
1954 if not 'is_optional' in func or not func['is_optional']:
1955 file.write('DCHECK(fn.%sFn);\n' % known_as)
1956 file.write('}\n')
1957 i += 1
1958 first_version = False
1960 # TODO(jmadill): make more robust
1961 def IsClientExtensionFunc(func):
1962 assert len(func['versions']) > 0
1963 if 'client_extensions' in func['versions'][0]:
1964 assert len(func['versions']) == 1
1965 return True
1966 return False
1968 file.write("}\n\n");
1970 if set_name == 'gl':
1971 file.write("""\
1972 void DriverGL::InitializeDynamicBindings(
1973 GLContext* context) {
1974 DCHECK(context && context->IsCurrent(NULL));
1975 const GLVersionInfo* ver = context->GetVersionInfo();
1976 ALLOW_UNUSED_LOCAL(ver);
1977 std::string extensions = context->GetExtensions() + " ";
1978 ALLOW_UNUSED_LOCAL(extensions);
1980 """)
1981 elif set_name == 'egl':
1982 file.write("""\
1983 void DriverEGL::InitializeExtensionBindings() {
1984 std::string client_extensions(GetClientExtensions());
1985 client_extensions += " ";
1986 ALLOW_UNUSED_LOCAL(client_extensions);
1988 """)
1989 else:
1990 file.write("""\
1991 void Driver%s::InitializeExtensionBindings() {
1992 std::string extensions(GetPlatformExtensions());
1993 extensions += " ";
1994 ALLOW_UNUSED_LOCAL(extensions);
1996 """ % (set_name.upper(),))
1998 def OutputExtensionBindings(extension_var, extensions, extension_funcs):
1999 # Extra space at the end of the extension name is intentional,
2000 # it is used as a separator
2001 for extension in extensions:
2002 file.write(' ext.b_%s = %s.find("%s ") != std::string::npos;\n' %
2003 (extension, extension_var, extension))
2005 for func in extension_funcs:
2006 if not 'static_binding' in func:
2007 file.write('\n')
2008 file.write(' debug_fn.%sFn = 0;\n' % func['known_as'])
2009 WriteConditionalFuncBinding(file, func)
2011 OutputExtensionBindings(
2012 'client_extensions',
2013 sorted(used_client_extensions),
2014 [ f for f in functions if IsClientExtensionFunc(f) ])
2016 if set_name == 'egl':
2017 file.write("""\
2018 std::string extensions(GetPlatformExtensions());
2019 extensions += " ";
2020 ALLOW_UNUSED_LOCAL(extensions);
2022 """)
2024 OutputExtensionBindings(
2025 'extensions',
2026 sorted(used_extensions),
2027 [ f for f in functions if not IsClientExtensionFunc(f) ])
2029 # Some new function pointers have been added, so update them in debug bindings
2030 file.write('\n')
2031 file.write(' if (g_debugBindingsInitialized)\n')
2032 file.write(' InitializeDebugBindings();\n')
2033 file.write('}\n')
2034 file.write('\n')
2036 # Write logging wrappers for each function.
2037 file.write('extern "C" {\n')
2038 for func in functions:
2039 return_type = func['return_type']
2040 arguments = func['arguments']
2041 file.write('\n')
2042 file.write('static %s GL_BINDING_CALL Debug_%s(%s) {\n' %
2043 (return_type, func['known_as'], arguments))
2044 argument_names = re.sub(
2045 r'(const )?[a-zA-Z0-9_]+\** ([a-zA-Z0-9_]+)', r'\2', arguments)
2046 argument_names = re.sub(
2047 r'(const )?[a-zA-Z0-9_]+\** ([a-zA-Z0-9_]+)', r'\2', argument_names)
2048 log_argument_names = re.sub(
2049 r'const char\* ([a-zA-Z0-9_]+)', r'CONSTCHAR_\1', arguments)
2050 log_argument_names = re.sub(
2051 r'(const )?[a-zA-Z0-9_]+\* ([a-zA-Z0-9_]+)',
2052 r'CONSTVOID_\2', log_argument_names)
2053 log_argument_names = re.sub(
2054 r'(?<!E)GLenum ([a-zA-Z0-9_]+)', r'GLenum_\1', log_argument_names)
2055 log_argument_names = re.sub(
2056 r'(?<!E)GLboolean ([a-zA-Z0-9_]+)', r'GLboolean_\1', log_argument_names)
2057 log_argument_names = re.sub(
2058 r'(const )?[a-zA-Z0-9_]+\** ([a-zA-Z0-9_]+)', r'\2',
2059 log_argument_names)
2060 log_argument_names = re.sub(
2061 r'(const )?[a-zA-Z0-9_]+\** ([a-zA-Z0-9_]+)', r'\2',
2062 log_argument_names)
2063 log_argument_names = re.sub(
2064 r'CONSTVOID_([a-zA-Z0-9_]+)',
2065 r'static_cast<const void*>(\1)', log_argument_names)
2066 log_argument_names = re.sub(
2067 r'CONSTCHAR_([a-zA-Z0-9_]+)', r'\1', log_argument_names)
2068 log_argument_names = re.sub(
2069 r'GLenum_([a-zA-Z0-9_]+)', r'GLEnums::GetStringEnum(\1)',
2070 log_argument_names)
2071 log_argument_names = re.sub(
2072 r'GLboolean_([a-zA-Z0-9_]+)', r'GLEnums::GetStringBool(\1)',
2073 log_argument_names)
2074 log_argument_names = log_argument_names.replace(',', ' << ", " <<')
2075 if argument_names == 'void' or argument_names == '':
2076 argument_names = ''
2077 log_argument_names = ''
2078 else:
2079 log_argument_names = " << " + log_argument_names
2080 function_name = func['known_as']
2081 if return_type == 'void':
2082 file.write(' GL_SERVICE_LOG("%s" << "(" %s << ")");\n' %
2083 (function_name, log_argument_names))
2084 file.write(' g_driver_%s.debug_fn.%sFn(%s);\n' %
2085 (set_name.lower(), function_name, argument_names))
2086 if 'logging_code' in func:
2087 file.write("%s\n" % func['logging_code'])
2088 if options.generate_dchecks and set_name == 'gl':
2089 file.write(' {\n')
2090 file.write(' GLenum error = g_driver_gl.debug_fn.glGetErrorFn();\n')
2091 file.write(' DCHECK(error == 0);\n')
2092 file.write(' }\n')
2093 else:
2094 file.write(' GL_SERVICE_LOG("%s" << "(" %s << ")");\n' %
2095 (function_name, log_argument_names))
2096 file.write(' %s result = g_driver_%s.debug_fn.%sFn(%s);\n' %
2097 (return_type, set_name.lower(), function_name, argument_names))
2098 if 'logging_code' in func:
2099 file.write("%s\n" % func['logging_code'])
2100 else:
2101 file.write(' GL_SERVICE_LOG("GL_RESULT: " << result);\n')
2102 if options.generate_dchecks and set_name == 'gl':
2103 file.write(' {\n')
2104 file.write(' GLenum _error = g_driver_gl.debug_fn.glGetErrorFn();\n')
2105 file.write(' DCHECK(_error == 0);\n')
2106 file.write(' }\n')
2107 file.write(' return result;\n')
2108 file.write('}\n')
2109 file.write('} // extern "C"\n')
2111 # Write function to initialize the debug function pointers.
2112 file.write('\n')
2113 file.write('void Driver%s::InitializeDebugBindings() {\n' %
2114 set_name.upper())
2115 for func in functions:
2116 first_name = func['known_as']
2117 file.write(' if (!debug_fn.%sFn) {\n' % first_name)
2118 file.write(' debug_fn.%sFn = fn.%sFn;\n' % (first_name, first_name))
2119 file.write(' fn.%sFn = Debug_%s;\n' % (first_name, first_name))
2120 file.write(' }\n')
2121 file.write(' g_debugBindingsInitialized = true;\n')
2122 file.write('}\n')
2124 # Write function to clear all function pointers.
2125 file.write('\n')
2126 file.write("""void Driver%s::ClearBindings() {
2127 memset(this, 0, sizeof(*this));
2129 """ % set_name.upper())
2131 def MakeArgNames(arguments):
2132 argument_names = re.sub(
2133 r'(const )?[a-zA-Z0-9_]+\** ([a-zA-Z0-9_]+)', r'\2', arguments)
2134 argument_names = re.sub(
2135 r'(const )?[a-zA-Z0-9_]+\** ([a-zA-Z0-9_]+)', r'\2', argument_names)
2136 if argument_names == 'void' or argument_names == '':
2137 argument_names = ''
2138 return argument_names
2140 # Write GLApiBase functions
2141 for func in functions:
2142 function_name = func['known_as']
2143 return_type = func['return_type']
2144 arguments = func['arguments']
2145 file.write('\n')
2146 file.write('%s %sApiBase::%sFn(%s) {\n' %
2147 (return_type, set_name.upper(), function_name, arguments))
2148 argument_names = MakeArgNames(arguments)
2149 if return_type == 'void':
2150 file.write(' driver_->fn.%sFn(%s);\n' %
2151 (function_name, argument_names))
2152 else:
2153 file.write(' return driver_->fn.%sFn(%s);\n' %
2154 (function_name, argument_names))
2155 file.write('}\n')
2157 # Write TraceGLApi functions
2158 for func in functions:
2159 function_name = func['known_as']
2160 return_type = func['return_type']
2161 arguments = func['arguments']
2162 file.write('\n')
2163 file.write('%s Trace%sApi::%sFn(%s) {\n' %
2164 (return_type, set_name.upper(), function_name, arguments))
2165 argument_names = MakeArgNames(arguments)
2166 file.write(' TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::%s")\n' %
2167 function_name)
2168 if return_type == 'void':
2169 file.write(' %s_api_->%sFn(%s);\n' %
2170 (set_name.lower(), function_name, argument_names))
2171 else:
2172 file.write(' return %s_api_->%sFn(%s);\n' %
2173 (set_name.lower(), function_name, argument_names))
2174 file.write('}\n')
2176 # Write NoContextGLApi functions
2177 if set_name.upper() == "GL":
2178 for func in functions:
2179 function_name = func['known_as']
2180 return_type = func['return_type']
2181 arguments = func['arguments']
2182 file.write('\n')
2183 file.write('%s NoContextGLApi::%sFn(%s) {\n' %
2184 (return_type, function_name, arguments))
2185 argument_names = MakeArgNames(arguments)
2186 no_context_error = "Trying to call %s() without current GL context" % function_name
2187 file.write(' NOTREACHED() << "%s";\n' % no_context_error)
2188 file.write(' LOG(ERROR) << "%s";\n' % no_context_error)
2189 default_value = { 'GLenum': 'static_cast<GLenum>(0)',
2190 'GLuint': '0U',
2191 'GLint': '0',
2192 'GLboolean': 'GL_FALSE',
2193 'GLbyte': '0',
2194 'GLubyte': '0',
2195 'GLbutfield': '0',
2196 'GLushort': '0',
2197 'GLsizei': '0',
2198 'GLfloat': '0.0f',
2199 'GLdouble': '0.0',
2200 'GLsync': 'NULL'}
2201 if return_type.endswith('*'):
2202 file.write(' return NULL;\n')
2203 elif return_type != 'void':
2204 file.write(' return %s;\n' % default_value[return_type])
2205 file.write('}\n')
2207 file.write('\n')
2208 file.write('} // namespace gfx\n')
2211 def GetUniquelyNamedFunctions(functions):
2212 uniquely_named_functions = {}
2214 for func in functions:
2215 for version in func['versions']:
2216 uniquely_named_functions[version['name']] = ({
2217 'name': version['name'],
2218 'return_type': func['return_type'],
2219 'arguments': func['arguments'],
2220 'known_as': func['known_as']
2222 return uniquely_named_functions
2225 def GenerateMockBindingsHeader(file, functions):
2226 """Headers for functions that invoke MockGLInterface members"""
2228 file.write(LICENSE_AND_HEADER)
2229 uniquely_named_functions = GetUniquelyNamedFunctions(functions)
2231 for key in sorted(uniquely_named_functions.iterkeys()):
2232 func = uniquely_named_functions[key]
2233 file.write('static %s GL_BINDING_CALL Mock_%s(%s);\n' %
2234 (func['return_type'], func['name'], func['arguments']))
2237 def GenerateMockBindingsSource(file, functions):
2238 """Generates functions that invoke MockGLInterface members and a
2239 GetGLProcAddress function that returns addresses to those functions."""
2241 file.write(LICENSE_AND_HEADER +
2244 #include <string.h>
2246 #include "ui/gl/gl_mock.h"
2248 namespace gfx {
2250 // This is called mainly to prevent the compiler combining the code of mock
2251 // functions with identical contents, so that their function pointers will be
2252 // different.
2253 void MakeFunctionUnique(const char *func_name) {
2254 VLOG(2) << "Calling mock " << func_name;
2257 """)
2258 # Write functions that trampoline into the set MockGLInterface instance.
2259 uniquely_named_functions = GetUniquelyNamedFunctions(functions)
2260 sorted_function_names = sorted(uniquely_named_functions.iterkeys())
2262 for key in sorted_function_names:
2263 func = uniquely_named_functions[key]
2264 file.write('\n')
2265 file.write('%s GL_BINDING_CALL MockGLInterface::Mock_%s(%s) {\n' %
2266 (func['return_type'], func['name'], func['arguments']))
2267 file.write(' MakeFunctionUnique("%s");\n' % func['name'])
2268 arg_re = r'(const )?[a-zA-Z0-9]+((\s*const\s*)?\*)* ([a-zA-Z0-9]+)'
2269 argument_names = re.sub(arg_re, r'\4', func['arguments'])
2270 if argument_names == 'void':
2271 argument_names = ''
2272 function_name = func['known_as'][2:]
2273 if func['return_type'] == 'void':
2274 file.write(' interface_->%s(%s);\n' %
2275 (function_name, argument_names))
2276 else:
2277 file.write(' return interface_->%s(%s);\n' %
2278 (function_name, argument_names))
2279 file.write('}\n')
2281 # Write an 'invalid' function to catch code calling through uninitialized
2282 # function pointers or trying to interpret the return value of
2283 # GLProcAddress().
2284 file.write('\n')
2285 file.write('static void MockInvalidFunction() {\n')
2286 file.write(' NOTREACHED();\n')
2287 file.write('}\n')
2289 # Write a function to lookup a mock GL function based on its name.
2290 file.write('\n')
2291 file.write('void* GL_BINDING_CALL ' +
2292 'MockGLInterface::GetGLProcAddress(const char* name) {\n')
2293 for key in sorted_function_names:
2294 name = uniquely_named_functions[key]['name']
2295 file.write(' if (strcmp(name, "%s") == 0)\n' % name)
2296 file.write(' return reinterpret_cast<void*>(Mock_%s);\n' % name)
2297 # Always return a non-NULL pointer like some EGL implementations do.
2298 file.write(' return reinterpret_cast<void*>(&MockInvalidFunction);\n')
2299 file.write('}\n')
2301 file.write('\n')
2302 file.write('} // namespace gfx\n')
2304 def GenerateEnumUtils(out_file, input_filenames):
2305 enum_re = re.compile(r'\#define\s+(GL_[a-zA-Z0-9_]+)\s+([0-9A-Fa-fx]+)')
2306 dict = {}
2307 for fname in input_filenames:
2308 lines = open(fname).readlines()
2309 for line in lines:
2310 m = enum_re.match(line)
2311 if m:
2312 name = m.group(1)
2313 value = m.group(2)
2314 if len(value) <= 10:
2315 if not value in dict:
2316 dict[value] = name
2317 # check our own _CHROMIUM macro conflicts with khronos GL headers.
2318 elif dict[value] != name and (name.endswith('_CHROMIUM') or
2319 dict[value].endswith('_CHROMIUM')):
2320 raise RunTimeError("code collision: %s and %s have the same code %s"
2321 % (dict[value], name, value))
2323 out_file.write(LICENSE_AND_HEADER)
2324 out_file.write("static const GLEnums::EnumToString "
2325 "enum_to_string_table[] = {\n")
2326 for value in dict:
2327 out_file.write(' { %s, "%s", },\n' % (value, dict[value]))
2328 out_file.write("""};
2330 const GLEnums::EnumToString* const GLEnums::enum_to_string_table_ =
2331 enum_to_string_table;
2332 const size_t GLEnums::enum_to_string_table_len_ =
2333 sizeof(enum_to_string_table) / sizeof(enum_to_string_table[0]);
2335 """)
2338 def ParseFunctionsFromHeader(header_file, extensions, versions):
2339 """Parse a C extension header file and return a map from extension names to
2340 a list of functions.
2342 Args:
2343 header_file: Line-iterable C header file.
2344 Returns:
2345 Map of extension name => functions, Map of gl version => functions.
2346 Functions will only be in either one of the two maps.
2348 version_start = re.compile(
2349 r'#ifndef GL_(ES_|)VERSION((?:_[0-9])+)$')
2350 extension_start = re.compile(
2351 r'#ifndef ((?:GL|EGL|WGL|GLX)_[A-Z]+_[a-zA-Z]\w+)')
2352 extension_function = re.compile(r'.+\s+([a-z]+\w+)\s*\(')
2353 typedef = re.compile(r'typedef .*')
2354 macro_start = re.compile(r'^#(if|ifdef|ifndef).*')
2355 macro_end = re.compile(r'^#endif.*')
2356 macro_depth = 0
2357 current_version = None
2358 current_version_depth = 0
2359 current_extension = None
2360 current_extension_depth = 0
2362 # Pick up all core functions here, since some of them are missing in the
2363 # Khronos headers.
2364 hdr = os.path.basename(header_file.name)
2365 if hdr == "gl.h":
2366 current_version = GLVersion(False, 1, 0)
2368 line_num = 1
2369 for line in header_file:
2370 version_match = version_start.match(line)
2371 if macro_start.match(line):
2372 macro_depth += 1
2373 if version_match:
2374 if current_version:
2375 raise RuntimeError('Nested GL version macro in %s at line %d' % (
2376 header_file.name, line_num))
2377 current_version_depth = macro_depth
2378 es = version_match.group(1)
2379 major_version, minor_version =\
2380 version_match.group(2).lstrip('_').split('_')
2381 is_es = len(es) > 0
2382 if (not is_es) and (major_version == '1'):
2383 minor_version = 0
2384 current_version = GLVersion(
2385 is_es, int(major_version), int(minor_version))
2386 elif macro_end.match(line):
2387 macro_depth -= 1
2388 if macro_depth < current_extension_depth:
2389 current_extension = None
2390 if macro_depth < current_version_depth:
2391 current_version = None
2393 match = extension_start.match(line)
2394 if match and not version_match:
2395 if current_version and hdr != "gl.h":
2396 raise RuntimeError('Nested GL version macro in %s at line %d' % (
2397 header_file.name, line_num))
2398 current_extension = match.group(1)
2399 current_extension_depth = macro_depth
2401 match = extension_function.match(line)
2402 if match and not typedef.match(line):
2403 if current_extension:
2404 extensions[current_extension].add(match.group(1))
2405 elif current_version:
2406 versions[current_version].add(match.group(1))
2407 line_num = line_num + 1
2410 def GetDynamicFunctions(extension_headers):
2411 """Parse all optional functions from a list of header files.
2413 Args:
2414 extension_headers: List of header file names.
2415 Returns:
2416 Map of extension name => list of functions,
2417 Map of gl version => list of functions.
2419 extensions = collections.defaultdict(lambda: set([]))
2420 gl_versions = collections.defaultdict(lambda: set([]))
2421 for header in extension_headers:
2422 ParseFunctionsFromHeader(open(header), extensions, gl_versions)
2423 return extensions, gl_versions
2426 def GetFunctionToExtensionsMap(extensions):
2427 """Construct map from a function names to extensions which define the
2428 function.
2430 Args:
2431 extensions: Map of extension name => functions.
2432 Returns:
2433 Map of function name => extension names.
2435 function_to_extensions = {}
2436 for extension, functions in extensions.items():
2437 for function in functions:
2438 if not function in function_to_extensions:
2439 function_to_extensions[function] = set([])
2440 function_to_extensions[function].add(extension)
2441 return function_to_extensions
2443 def GetFunctionToGLVersionsMap(gl_versions):
2444 """Construct map from a function names to GL versions which define the
2445 function.
2447 Args:
2448 extensions: Map of gl versions => functions.
2449 Returns:
2450 Map of function name => gl versions.
2452 function_to_gl_versions = {}
2453 for gl_version, functions in gl_versions.items():
2454 for function in functions:
2455 if not function in function_to_gl_versions:
2456 function_to_gl_versions[function] = set([])
2457 function_to_gl_versions[function].add(gl_version)
2458 return function_to_gl_versions
2461 def LooksLikeExtensionFunction(function):
2462 """Heuristic to see if a function name is consistent with extension function
2463 naming."""
2464 vendor = re.match(r'\w+?([A-Z][A-Z]+)$', function)
2465 return vendor is not None and not vendor.group(1) in ['GL', 'API', 'DC']
2468 def SortVersions(key):
2469 # Prefer functions from the core for binding
2470 if 'gl_versions' in key:
2471 return 0
2472 else:
2473 return 1
2475 def FillExtensionsFromHeaders(functions, extension_headers, extra_extensions):
2476 """Determine which functions belong to extensions based on extension headers,
2477 and fill in this information to the functions table for functions that don't
2478 already have the information.
2480 Args:
2481 functions: List of (return type, function versions, arguments).
2482 extension_headers: List of header file names.
2483 extra_extensions: Extensions to add to the list.
2484 Returns:
2485 Set of used extensions.
2487 # Parse known extensions.
2488 extensions, gl_versions = GetDynamicFunctions(extension_headers)
2489 functions_to_extensions = GetFunctionToExtensionsMap(extensions)
2490 functions_to_gl_versions = GetFunctionToGLVersionsMap(gl_versions)
2492 # Fill in the extension information.
2493 used_extensions = set()
2494 used_client_extensions = set()
2495 used_functions_by_version = collections.defaultdict(lambda: set([]))
2496 for func in functions:
2497 for version in func['versions']:
2498 name = version['name']
2500 # There should only be one version entry per name string.
2501 if len([v for v in func['versions'] if v['name'] == name]) > 1:
2502 raise RuntimeError(
2503 'Duplicate version entries with same name for %s' % name)
2505 # Make sure we know about all extensions and extension functions.
2506 extensions_from_headers = set([])
2507 if name in functions_to_extensions:
2508 extensions_from_headers = set(functions_to_extensions[name])
2510 explicit_extensions = set([])
2512 if 'client_extensions' in version:
2513 assert not 'extensions' in version
2514 version['extensions'] = version['client_extensions']
2516 if 'extensions' in version:
2517 explicit_extensions = set(version['extensions'])
2519 in_both = explicit_extensions.intersection(extensions_from_headers)
2520 if len(in_both):
2521 print "[%s] Specified redundant extensions for binding: %s" % (
2522 name, ', '.join(in_both))
2523 diff = explicit_extensions - extensions_from_headers
2524 if len(diff):
2525 print "[%s] Specified extra extensions for binding: %s" % (
2526 name, ', '.join(diff))
2528 all_extensions = extensions_from_headers.union(explicit_extensions)
2529 if len(all_extensions):
2530 version['extensions'] = all_extensions
2532 if 'extensions' in version:
2533 assert len(version['extensions'])
2534 if 'client_extensions' in version:
2535 used_client_extensions.update(version['extensions'])
2536 else:
2537 used_extensions.update(version['extensions'])
2539 if not 'extensions' in version and LooksLikeExtensionFunction(name):
2540 raise RuntimeError('%s looks like an extension function but does not '
2541 'belong to any of the known extensions.' % name)
2543 if name in functions_to_gl_versions:
2544 assert not 'gl_versions' in version
2545 version['gl_versions'] = functions_to_gl_versions[name]
2546 for v in version['gl_versions']:
2547 used_functions_by_version[v].add(name)
2549 func['versions'] = sorted(func['versions'], key=SortVersions)
2551 # Add extensions that do not have any functions.
2552 used_extensions.update(extra_extensions)
2554 # Print out used function count by GL(ES) version.
2555 for v in sorted([v for v in used_functions_by_version if v.is_es]):
2556 print "OpenGL ES %d.%d: %d used functions" % (
2557 v.major_version, v.minor_version, len(used_functions_by_version[v]))
2558 for v in sorted([v for v in used_functions_by_version if not v.is_es]):
2559 print "OpenGL %d.%d: %d used functions" % (
2560 v.major_version, v.minor_version, len(used_functions_by_version[v]))
2562 return used_extensions, used_client_extensions
2565 def ResolveHeader(header, header_paths):
2566 for path in header_paths:
2567 result = os.path.join(path, header)
2568 if not os.path.isabs(path):
2569 result = os.path.abspath(os.path.join(SELF_LOCATION, result))
2570 if os.path.exists(result):
2571 # Always use forward slashes as path separators. Otherwise backslashes
2572 # may be incorrectly interpreted as escape characters.
2573 return result.replace(os.path.sep, '/')
2575 raise Exception('Header %s not found.' % header)
2578 def main(argv):
2579 """This is the main function."""
2581 parser = optparse.OptionParser()
2582 parser.add_option('--inputs', action='store_true')
2583 parser.add_option('--verify-order', action='store_true')
2584 parser.add_option('--generate-dchecks', action='store_true',
2585 help='Generates DCHECKs into the logging functions '
2586 'asserting no GL errors (useful for debugging)')
2588 options, args = parser.parse_args(argv)
2590 if options.inputs:
2591 for [_, _, headers, _] in FUNCTION_SETS:
2592 for header in headers:
2593 print ResolveHeader(header, HEADER_PATHS)
2594 return 0
2596 directory = SELF_LOCATION
2597 if len(args) >= 1:
2598 directory = args[0]
2600 def ClangFormat(filename):
2601 formatter = "clang-format"
2602 if platform.system() == "Windows":
2603 formatter += ".bat"
2604 call([formatter, "-i", "-style=chromium", filename])
2606 for [functions, set_name, extension_headers, extensions] in FUNCTION_SETS:
2607 # Function names can be specified in two ways (list of unique names or list
2608 # of versions with different binding conditions). Fill in the data to the
2609 # versions list in case it is missing, so that can be used from here on:
2610 for func in functions:
2611 assert 'versions' in func or 'names' in func, 'Function with no names'
2612 if 'versions' not in func:
2613 func['versions'] = [{'name': n} for n in func['names']]
2614 # Use the first version's name unless otherwise specified
2615 if 'known_as' not in func:
2616 func['known_as'] = func['versions'][0]['name']
2617 # Make sure that 'names' is not accidentally used instead of 'versions'
2618 if 'names' in func:
2619 del func['names']
2621 # Check function names in each set is sorted in alphabetical order.
2622 for index in range(len(functions) - 1):
2623 func_name = functions[index]['known_as']
2624 next_func_name = functions[index + 1]['known_as']
2625 if func_name.lower() > next_func_name.lower():
2626 raise Exception(
2627 'function %s is not in alphabetical order' % next_func_name)
2628 if options.verify_order:
2629 continue
2631 extension_headers = [ResolveHeader(h, HEADER_PATHS)
2632 for h in extension_headers]
2633 used_extensions, used_client_extensions = FillExtensionsFromHeaders(
2634 functions, extension_headers, extensions)
2636 header_file = open(
2637 os.path.join(directory, 'gl_bindings_autogen_%s.h' % set_name), 'wb')
2638 GenerateHeader(header_file, functions, set_name,
2639 used_extensions, used_client_extensions)
2640 header_file.close()
2641 ClangFormat(header_file.name)
2643 header_file = open(
2644 os.path.join(directory, 'gl_bindings_api_autogen_%s.h' % set_name),
2645 'wb')
2646 GenerateAPIHeader(header_file, functions, set_name)
2647 header_file.close()
2648 ClangFormat(header_file.name)
2650 source_file = open(
2651 os.path.join(directory, 'gl_bindings_autogen_%s.cc' % set_name), 'wb')
2652 GenerateSource(source_file, functions, set_name,
2653 used_extensions, used_client_extensions, options)
2654 source_file.close()
2655 ClangFormat(source_file.name)
2657 if not options.verify_order:
2658 header_file = open(
2659 os.path.join(directory, 'gl_mock_autogen_gl.h'), 'wb')
2660 GenerateMockHeader(header_file, GL_FUNCTIONS, 'gl')
2661 header_file.close()
2662 ClangFormat(header_file.name)
2664 header_file = open(os.path.join(directory, 'gl_bindings_autogen_mock.h'),
2665 'wb')
2666 GenerateMockBindingsHeader(header_file, GL_FUNCTIONS)
2667 header_file.close()
2668 ClangFormat(header_file.name)
2670 source_file = open(os.path.join(directory, 'gl_bindings_autogen_mock.cc'),
2671 'wb')
2672 GenerateMockBindingsSource(source_file, GL_FUNCTIONS)
2673 source_file.close()
2674 ClangFormat(source_file.name)
2676 enum_header_filenames = [ResolveHeader(h, HEADER_PATHS)
2677 for h in GLES2_HEADERS_WITH_ENUMS]
2678 header_file = open(os.path.join(directory,
2679 'gl_enums_implementation_autogen.h'),
2680 'wb')
2681 GenerateEnumUtils(header_file, enum_header_filenames)
2682 header_file.close()
2683 ClangFormat(header_file.name)
2684 return 0
2687 if __name__ == '__main__':
2688 sys.exit(main(sys.argv[1:]))