Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(769)

Unified Diff: ui/gl/generate_bindings.py

Issue 893213002: Revert of Make GL bindings conditional (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gl/BUILD.gn ('k') | ui/gl/gl.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gl/generate_bindings.py
diff --git a/ui/gl/generate_bindings.py b/ui/gl/generate_bindings.py
index 5943bb6a048ffd663de02874aa8fcc26ea0a04a4..0f297a9788f19f6a55df11a87432bdc73cf49471 100755
--- a/ui/gl/generate_bindings.py
+++ b/ui/gl/generate_bindings.py
@@ -12,7 +12,6 @@
import platform
import sys
from subprocess import call
-from collections import namedtuple
HEADER_PATHS = [
'../../third_party/khronos',
@@ -21,19 +20,22 @@
'../../gpu',
]
-UNCONDITIONALLY_BOUND_EXTENSIONS = set([
- 'WGL_ARB_extensions_string',
- 'WGL_EXT_extensions_string',
- 'GL_CHROMIUM_gles_depth_binding_hack', # crbug.com/448206
-])
-
-"""Function binding conditions can be specified manually by supplying a versions
+"""In case there are multiple versions of the same function, one that's listed
+first takes priority if its conditions are met. If the function is an extension
+function, finding the extension from the extension string is a condition for
+binding it. The last version of the function is treated as a fallback option in
+case no other versions were bound, so a non-null function pointer in the
+bindings does not guarantee that the function is supported.
+
+Function binding conditions can be specified manually by supplying a versions
array instead of the names array. Each version has the following keys:
name: Mandatory. Name of the function. Multiple versions can have the same
name but different conditions.
- extensions: Extra Extensions for which the function is bound. Only needed
- in some cases where the extension cannot be parsed from the
- headers.
+ gl_versions: List of GL versions where the function is found.
+ extensions: Extensions where the function is found. If not specified, the
+ extensions are determined based on GL header files.
+ If the function exists in an extension header, you may specify
+ an empty array to prevent making that a condition for binding.
By default, the function gets its name from the first name in its names or
versions array. This can be overridden by supplying a 'known_as' key.
@@ -46,15 +48,15 @@
'names': ['glAttachShader'],
'arguments': 'GLuint program, GLuint shader', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glBeginQuery' }],
+ 'versions': [{ 'name': 'glBeginQuery',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }],
'arguments': 'GLenum target, GLuint id', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glBeginQueryARB' },
- { 'name': 'glBeginQueryEXT',
- 'extensions': ['GL_EXT_occlusion_query_boolean'] }],
+ 'names': ['glBeginQueryARB', 'glBeginQueryEXT'],
'arguments': 'GLenum target, GLuint id', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glBeginTransformFeedback' }],
+ 'versions': [{ 'name': 'glBeginTransformFeedback',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }],
'arguments': 'GLenum primitiveMode', },
{ 'return_type': 'void',
'names': ['glBindAttribLocation'],
@@ -63,10 +65,12 @@
'names': ['glBindBuffer'],
'arguments': 'GLenum target, GLuint buffer', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glBindBufferBase' }],
+ 'versions': [{ 'name': 'glBindBufferBase',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }],
'arguments': 'GLenum target, GLuint index, GLuint buffer', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glBindBufferRange' }],
+ 'versions': [{ 'name': 'glBindBufferRange',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }],
'arguments': 'GLenum target, GLuint index, GLuint buffer, GLintptr offset, '
'GLsizeiptr size', },
{ 'return_type': 'void',
@@ -83,18 +87,22 @@
'names': ['glBindRenderbufferEXT', 'glBindRenderbuffer'],
'arguments': 'GLenum target, GLuint renderbuffer', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glBindSampler' }],
+ 'versions': [{ 'name': 'glBindSampler',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }], # GL 3.2 or higher.
'arguments': 'GLuint unit, GLuint sampler', },
{ 'return_type': 'void',
'names': ['glBindTexture'],
'arguments': 'GLenum target, GLuint texture', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glBindTransformFeedback' }],
+ 'versions': [{ 'name': 'glBindTransformFeedback',
+ 'gl_versions': ['gl4', 'es3'] }],
'arguments': 'GLenum target, GLuint id', },
{ 'return_type': 'void',
'known_as': 'glBindVertexArrayOES',
'versions': [{ 'name': 'glBindVertexArray',
- 'extensions': ['GL_ARB_vertex_array_object'], },
+ 'gl_versions': ['gl3', 'gl4', 'es3'] },
+ { 'name': 'glBindVertexArray',
+ 'extensions': ['GL_ARB_vertex_array_object'] },
{ 'name': 'glBindVertexArrayOES' },
{ 'name': 'glBindVertexArrayAPPLE',
'extensions': ['GL_APPLE_vertex_array_object'] }],
@@ -156,24 +164,27 @@
'names': ['glClear'],
'arguments': 'GLbitfield mask', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glClearBufferfi' }],
+ 'versions': [{ 'name': 'glClearBufferfi',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }],
'arguments': 'GLenum buffer, GLint drawbuffer, const GLfloat depth, '
'GLint stencil', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glClearBufferfv' }],
+ 'versions': [{ 'name': 'glClearBufferfv',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }],
'arguments': 'GLenum buffer, GLint drawbuffer, const GLfloat* value', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glClearBufferiv' }],
+ 'versions': [{ 'name': 'glClearBufferiv',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }],
'arguments': 'GLenum buffer, GLint drawbuffer, const GLint* value', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glClearBufferuiv' }],
+ 'versions': [{ 'name': 'glClearBufferuiv',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }],
'arguments': 'GLenum buffer, GLint drawbuffer, const GLuint* value', },
{ 'return_type': 'void',
'names': ['glClearColor'],
'arguments': 'GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glClearDepth',
- 'extensions': ['GL_CHROMIUM_gles_depth_binding_hack'] }],
+ 'names': ['glClearDepth'],
'arguments': 'GLclampd depth', },
{ 'return_type': 'void',
'names': ['glClearDepthf'],
@@ -182,8 +193,7 @@
'names': ['glClearStencil'],
'arguments': 'GLint s', },
{ 'return_type': 'GLenum',
- 'versions': [{ 'name': 'glClientWaitSync',
- 'extensions': ['GL_ARB_sync'] }],
+ 'names': ['glClientWaitSync'],
'arguments': 'GLsync sync, GLbitfield flags, GLuint64 timeout', },
{ 'return_type': 'void',
'names': ['glColorMask'],
@@ -198,7 +208,8 @@
'GLenum target, GLint level, GLenum internalformat, GLsizei width, '
'GLsizei height, GLint border, GLsizei imageSize, const void* data', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glCompressedTexImage3D' }],
+ 'versions': [{ 'name': 'glCompressedTexImage3D',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }],
'arguments':
'GLenum target, GLint level, GLenum internalformat, GLsizei width, '
'GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, '
@@ -211,13 +222,15 @@
'const void* data', },
# TODO(zmo): wait for MOCK_METHOD11.
# { 'return_type': 'void',
-# 'versions': [{ 'name': 'glCompressedTexSubImage3D' }],
+# 'versions': [{ 'name': 'glCompressedTexSubImage3D',
+# 'gl_versions': ['gl3', 'gl4', 'es3'] }],
# 'arguments':
# 'GLenum target, GLint level, GLint xoffset, GLint yoffset, '
# 'GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, '
# 'GLenum format, GLsizei imageSize, const void* data', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glCopyBufferSubData' }],
+ 'versions': [{ 'name': 'glCopyBufferSubData',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }], # GL 3.1 or higher.
'arguments':
'GLenum readTarget, GLenum writeTarget, GLintptr readOffset, '
'GLintptr writeOffset, GLsizeiptr size', },
@@ -232,7 +245,8 @@
'GLenum target, GLint level, GLint xoffset, '
'GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glCopyTexSubImage3D' }],
+ 'versions': [{ 'name': 'glCopyTexSubImage3D',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }],
'arguments':
'GLenum target, GLint level, GLint xoffset, GLint yoffset, '
'GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height', },
@@ -246,8 +260,7 @@
'names': ['glCullFace'],
'arguments': 'GLenum mode', },
{ 'return_type': 'void',
- 'names': ['glDeleteBuffers'],
- 'known_as': 'glDeleteBuffersARB',
+ 'names': ['glDeleteBuffersARB', 'glDeleteBuffers'],
'arguments': 'GLsizei n, const GLuint* buffers', },
{ 'return_type': 'void',
'known_as': 'glDeleteFencesAPPLE',
@@ -264,36 +277,38 @@
'names': ['glDeleteProgram'],
'arguments': 'GLuint program', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glDeleteQueries' }],
+ 'versions': [{ 'name': 'glDeleteQueries',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }],
'arguments': 'GLsizei n, const GLuint* ids', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glDeleteQueriesARB'},
- { 'name': 'glDeleteQueriesEXT',
- 'extensions': ['GL_EXT_occlusion_query_boolean'] }],
+ 'names': ['glDeleteQueriesARB', 'glDeleteQueriesEXT'],
'arguments': 'GLsizei n, const GLuint* ids', },
{ 'return_type': 'void',
'names': ['glDeleteRenderbuffersEXT', 'glDeleteRenderbuffers'],
'arguments': 'GLsizei n, const GLuint* renderbuffers', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glDeleteSamplers' }],
+ 'versions': [{ 'name': 'glDeleteSamplers',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }], # GL 3.2 or higher.
'arguments': 'GLsizei n, const GLuint* samplers', },
{ 'return_type': 'void',
'names': ['glDeleteShader'],
'arguments': 'GLuint shader', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glDeleteSync',
- 'extensions': ['GL_ARB_sync'] }],
+ 'names': ['glDeleteSync'],
'arguments': 'GLsync sync', },
{ 'return_type': 'void',
'names': ['glDeleteTextures'],
'arguments': 'GLsizei n, const GLuint* textures', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glDeleteTransformFeedbacks' }],
+ 'versions': [{ 'name': 'glDeleteTransformFeedbacks',
+ 'gl_versions': ['gl4', 'es3'] }],
'arguments': 'GLsizei n, const GLuint* ids', },
{ 'return_type': 'void',
'known_as': 'glDeleteVertexArraysOES',
'versions': [{ 'name': 'glDeleteVertexArrays',
- 'extensions': ['GL_ARB_vertex_array_object'], },
+ 'gl_versions': ['gl3', 'gl4', 'es3'] },
+ { 'name': 'glDeleteVertexArrays',
+ 'extensions': ['GL_ARB_vertex_array_object'] },
{ 'name': 'glDeleteVertexArraysOES' },
{ 'name': 'glDeleteVertexArraysAPPLE',
'extensions': ['GL_APPLE_vertex_array_object'] }],
@@ -305,8 +320,7 @@
'names': ['glDepthMask'],
'arguments': 'GLboolean flag', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glDepthRange',
- 'extensions': ['GL_CHROMIUM_gles_depth_binding_hack'] }],
+ 'names': ['glDepthRange'],
'arguments': 'GLclampd zNear, GLclampd zFar', },
{ 'return_type': 'void',
'names': ['glDepthRangef'],
@@ -351,7 +365,8 @@
'GLenum mode, GLsizei count, GLenum type, const void* indices, '
'GLsizei primcount', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glDrawRangeElements' }],
+ 'versions': [{ 'name': 'glDrawRangeElements',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }],
'arguments': 'GLenum mode, GLuint start, GLuint end, GLsizei count, '
'GLenum type, const void* indices', },
{ 'return_type': 'void',
@@ -367,19 +382,18 @@
'names': ['glEnableVertexAttribArray'],
'arguments': 'GLuint index', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glEndQuery' }],
+ 'versions': [{ 'name': 'glEndQuery',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }],
'arguments': 'GLenum target', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glEndQueryARB' },
- { 'name': 'glEndQueryEXT',
- 'extensions': ['GL_EXT_occlusion_query_boolean'] }],
+ 'names': ['glEndQueryARB', 'glEndQueryEXT'],
'arguments': 'GLenum target', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glEndTransformFeedback' }],
+ 'versions': [{ 'name': 'glEndTransformFeedback',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }],
'arguments': 'void', },
{ 'return_type': 'GLsync',
- 'versions': [{ 'name': 'glFenceSync',
- 'extensions': ['GL_ARB_sync'] }],
+ 'names': ['glFenceSync'],
'arguments': 'GLenum condition, GLbitfield flags', },
{ 'return_type': 'void',
'names': ['glFinish'],
@@ -419,15 +433,15 @@
'GLenum target, GLenum attachment, GLenum textarget, GLuint texture, '
'GLint level, GLsizei samples', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glFramebufferTextureLayer' }],
+ 'versions': [{ 'name': 'glFramebufferTextureLayer',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }],
'arguments': 'GLenum target, GLenum attachment, GLuint texture, GLint level, '
'GLint layer', },
{ 'return_type': 'void',
'names': ['glFrontFace'],
'arguments': 'GLenum mode', },
{ 'return_type': 'void',
- 'names': ['glGenBuffers'],
- 'known_as': 'glGenBuffersARB',
+ 'names': ['glGenBuffersARB', 'glGenBuffers'],
'arguments': 'GLsizei n, GLuint* buffers', },
{ 'return_type': 'void',
'names': ['glGenerateMipmapEXT', 'glGenerateMipmap'],
@@ -444,29 +458,32 @@
'names': ['glGenFramebuffersEXT', 'glGenFramebuffers'],
'arguments': 'GLsizei n, GLuint* framebuffers', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glGenQueries' }],
+ 'versions': [{ 'name': 'glGenQueries',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }],
'arguments': 'GLsizei n, GLuint* ids', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glGenQueriesARB', },
- { 'name' : 'glGenQueriesEXT',
- 'extensions': ['GL_EXT_occlusion_query_boolean'] }],
+ 'names': ['glGenQueriesARB', 'glGenQueriesEXT'],
'arguments': 'GLsizei n, GLuint* ids', },
{ 'return_type': 'void',
'names': ['glGenRenderbuffersEXT', 'glGenRenderbuffers'],
'arguments': 'GLsizei n, GLuint* renderbuffers', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glGenSamplers' }],
+ 'versions': [{ 'name': 'glGenSamplers',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }], # GL 3.2 or higher.
'arguments': 'GLsizei n, GLuint* samplers', },
{ 'return_type': 'void',
'names': ['glGenTextures'],
'arguments': 'GLsizei n, GLuint* textures', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glGenTransformFeedbacks' }],
+ 'versions': [{ 'name': 'glGenTransformFeedbacks',
+ 'gl_versions': ['gl4', 'es3'] }],
'arguments': 'GLsizei n, GLuint* ids', },
{ 'return_type': 'void',
'known_as': 'glGenVertexArraysOES',
'versions': [{ 'name': 'glGenVertexArrays',
- 'extensions': ['GL_ARB_vertex_array_object'], },
+ 'gl_versions': ['gl3', 'gl4', 'es3'] },
+ { 'name': 'glGenVertexArrays',
+ 'extensions': ['GL_ARB_vertex_array_object'] },
{ 'name': 'glGenVertexArraysOES' },
{ 'name': 'glGenVertexArraysAPPLE',
'extensions': ['GL_APPLE_vertex_array_object'] }],
@@ -482,15 +499,18 @@
'GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, '
'GLint* size, GLenum* type, char* name', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glGetActiveUniformBlockiv' }],
+ 'versions': [{ 'name': 'glGetActiveUniformBlockiv',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }], # GL 3.1 or higher.
'arguments': 'GLuint program, GLuint uniformBlockIndex, GLenum pname, '
'GLint* params', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glGetActiveUniformBlockName' }],
+ 'versions': [{ 'name': 'glGetActiveUniformBlockName',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }], # GL 3.1 or higher.
'arguments': 'GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, '
'GLsizei* length, char* uniformBlockName', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glGetActiveUniformsiv' }],
+ 'versions': [{ 'name': 'glGetActiveUniformsiv',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }], # GL 3.1 or higher.
'arguments': 'GLuint program, GLsizei uniformCount, '
'const GLuint* uniformIndices, GLenum pname, GLint* params', },
{ 'return_type': 'void',
@@ -519,7 +539,8 @@
'names': ['glGetFloatv'],
'arguments': 'GLenum pname, GLfloat* params', },
{ 'return_type': 'GLint',
- 'versions': [{ 'name': 'glGetFragDataLocation' }],
+ 'versions': [{ 'name': 'glGetFragDataLocation',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }],
'arguments': 'GLuint program, const char* name', },
{ 'return_type': 'void',
'names': ['glGetFramebufferAttachmentParameterivEXT',
@@ -533,26 +554,30 @@
'glGetGraphicsResetStatus'],
'arguments': 'void', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glGetInteger64i_v' }],
+ 'versions': [{ 'name': 'glGetInteger64i_v',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }], # GL 3.2 or higher.
'arguments': 'GLenum target, GLuint index, GLint64* data', },
{ 'return_type': 'void',
'names': ['glGetInteger64v'],
'arguments': 'GLenum pname, GLint64* params', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glGetIntegeri_v' }],
+ 'versions': [{ 'name': 'glGetIntegeri_v',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }],
'arguments': 'GLenum target, GLuint index, GLint* data', },
{ 'return_type': 'void',
'names': ['glGetIntegerv'],
'arguments': 'GLenum pname, GLint* params', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glGetInternalformativ' }],
+ 'versions': [{ 'name': 'glGetInternalformativ',
+ 'gl_versions': ['gl4', 'es3'] }], # GL 4.2 or higher.
'arguments': 'GLenum target, GLenum internalformat, GLenum pname, '
'GLsizei bufSize, GLint* params', },
{ 'return_type': 'void',
'known_as': 'glGetProgramBinary',
'versions': [{ 'name': 'glGetProgramBinaryOES' },
{ 'name': 'glGetProgramBinary',
- 'extensions': ['GL_ARB_get_program_binary'] }],
+ 'extensions': ['GL_ARB_get_program_binary'] },
+ { 'name': 'glGetProgramBinary' }],
'arguments': 'GLuint program, GLsizei bufSize, GLsizei* length, '
'GLenum* binaryFormat, GLvoid* binary' },
{ 'return_type': 'void',
@@ -563,45 +588,42 @@
'names': ['glGetProgramiv'],
'arguments': 'GLuint program, GLenum pname, GLint* params', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glGetQueryiv' }],
+ 'versions': [{ 'name': 'glGetQueryiv',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }],
'arguments': 'GLenum target, GLenum pname, GLint* params', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glGetQueryivARB' },
- { 'name': 'glGetQueryivEXT',
- 'extensions': ['GL_EXT_occlusion_query_boolean'] }],
+ 'names': ['glGetQueryivARB', 'glGetQueryivEXT'],
'arguments': 'GLenum target, GLenum pname, GLint* params', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glGetQueryObjecti64v',
- 'extensions': ['GL_ARB_timer_query'] },
- { 'name': 'glGetQueryObjecti64vEXT' }],
+ 'names': ['glGetQueryObjecti64v'],
'arguments': 'GLuint id, GLenum pname, GLint64* params', },
{ 'return_type': 'void',
- 'names': ['glGetQueryObjectiv'],
+ 'versions': [{ 'name': 'glGetQueryObjectiv',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }],
'arguments': 'GLuint id, GLenum pname, GLint* params', },
{ 'return_type': 'void',
'names': ['glGetQueryObjectivARB', 'glGetQueryObjectivEXT'],
'arguments': 'GLuint id, GLenum pname, GLint* params', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glGetQueryObjectui64v',
- 'extensions': ['GL_ARB_timer_query'] },
- { 'name': 'glGetQueryObjectui64vEXT' }],
+ 'names': ['glGetQueryObjectui64v', 'glGetQueryObjectui64vEXT'],
'arguments': 'GLuint id, GLenum pname, GLuint64* params', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glGetQueryObjectuiv' }],
+ 'versions': [{ 'name': 'glGetQueryObjectuiv',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }],
'arguments': 'GLuint id, GLenum pname, GLuint* params', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glGetQueryObjectuivARB' },
- { 'name': 'glGetQueryObjectuivEXT',
- 'extensions': ['GL_EXT_occlusion_query_boolean'] }],
+ 'names': ['glGetQueryObjectuivARB', 'glGetQueryObjectuivEXT'],
'arguments': 'GLuint id, GLenum pname, GLuint* params', },
{ 'return_type': 'void',
'names': ['glGetRenderbufferParameterivEXT', 'glGetRenderbufferParameteriv'],
'arguments': 'GLenum target, GLenum pname, GLint* params', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glGetSamplerParameterfv' }],
+ 'versions': [{ 'name': 'glGetSamplerParameterfv',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }], # GL 3.2 or higher.
'arguments': 'GLuint sampler, GLenum pname, GLfloat* params', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glGetSamplerParameteriv' }],
+ 'versions': [{ 'name': 'glGetSamplerParameteriv',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }], # GL 3.2 or higher.
'arguments': 'GLuint sampler, GLenum pname, GLint* params', },
{ 'return_type': 'void',
'names': ['glGetShaderInfoLog'],
@@ -622,8 +644,7 @@
'names': ['glGetString'],
'arguments': 'GLenum name', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glGetSynciv',
- 'extensions': ['GL_ARB_sync'] }],
+ 'names': ['glGetSynciv'],
'arguments':
'GLsync sync, GLenum pname, GLsizei bufSize, GLsizei* length,'
'GLint* values', },
@@ -640,7 +661,8 @@
'names': ['glGetTexParameteriv'],
'arguments': 'GLenum target, GLenum pname, GLint* params', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glGetTransformFeedbackVarying' }],
+ 'versions': [{ 'name': 'glGetTransformFeedbackVarying',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }],
'arguments': 'GLuint program, GLuint index, GLsizei bufSize, '
'GLsizei* length, GLenum* type, char* name', },
{ 'return_type': 'void',
@@ -648,13 +670,15 @@
'arguments':
'GLuint shader, GLsizei bufsize, GLsizei* length, char* source', },
{ 'return_type': 'GLuint',
- 'versions': [{ 'name': 'glGetUniformBlockIndex' }],
+ 'versions': [{ 'name': 'glGetUniformBlockIndex',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }], # GL 3.1 or higher.
'arguments': 'GLuint program, const char* uniformBlockName', },
{ 'return_type': 'void',
'names': ['glGetUniformfv'],
'arguments': 'GLuint program, GLint location, GLfloat* params', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glGetUniformIndices' }],
+ 'versions': [{ 'name': 'glGetUniformIndices',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }], # GL 3.1 or higher.
'arguments': 'GLuint program, GLsizei uniformCount, '
'const char* const* uniformNames, GLuint* uniformIndices', },
{ 'return_type': 'void',
@@ -679,11 +703,13 @@
'names': ['glInsertEventMarkerEXT'],
'arguments': 'GLsizei length, const char* marker', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glInvalidateFramebuffer' }],
+ 'versions': [{ 'name': 'glInvalidateFramebuffer',
+ 'gl_versions': ['gl4', 'es3'] }], # GL 4.3 or higher.
'arguments': 'GLenum target, GLsizei numAttachments, '
'const GLenum* attachments' },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glInvalidateSubFramebuffer' }],
+ 'versions': [{ 'name': 'glInvalidateSubFramebuffer',
+ 'gl_versions': ['gl4', 'es3'] }], # GL 4.3 or higher.
'arguments':
'GLenum target, GLsizei numAttachments, const GLenum* attachments, '
'GLint x, GLint y, GLint width, GLint height', },
@@ -708,36 +734,38 @@
'names': ['glIsProgram'],
'arguments': 'GLuint program', },
{ 'return_type': 'GLboolean',
- 'versions': [{ 'name': 'glIsQuery' }],
+ 'versions': [{ 'name': 'glIsQuery',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }],
'arguments': 'GLuint query', },
{ 'return_type': 'GLboolean',
- 'versions': [{ 'name': 'glIsQueryARB' },
- { 'name': 'glIsQueryEXT',
- 'extensions': ['GL_EXT_occlusion_query_boolean'] }],
+ 'names': ['glIsQueryARB', 'glIsQueryEXT'],
'arguments': 'GLuint query', },
{ 'return_type': 'GLboolean',
'names': ['glIsRenderbufferEXT', 'glIsRenderbuffer'],
'arguments': 'GLuint renderbuffer', },
{ 'return_type': 'GLboolean',
- 'versions': [{ 'name': 'glIsSampler' }],
+ 'versions': [{ 'name': 'glIsSampler',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }], # GL 3.2 or higher.
'arguments': 'GLuint sampler', },
{ 'return_type': 'GLboolean',
'names': ['glIsShader'],
'arguments': 'GLuint shader', },
{ 'return_type': 'GLboolean',
- 'versions': [{ 'name': 'glIsSync',
- 'extensions': ['GL_ARB_sync'] }],
+ 'names': ['glIsSync'],
'arguments': 'GLsync sync', },
{ 'return_type': 'GLboolean',
'names': ['glIsTexture'],
'arguments': 'GLuint texture', },
{ 'return_type': 'GLboolean',
- 'versions': [{ 'name': 'glIsTransformFeedback' }],
+ 'versions': [{ 'name': 'glIsTransformFeedback',
+ 'gl_versions': ['gl4', 'es3'] }],
'arguments': 'GLuint id', },
{ 'return_type': 'GLboolean',
'known_as': 'glIsVertexArrayOES',
'versions': [{ 'name': 'glIsVertexArray',
- 'extensions': ['GL_ARB_vertex_array_object'], },
+ 'gl_versions': ['gl3', 'gl4', 'es3'] },
+ { 'name': 'glIsVertexArray',
+ 'extensions': ['GL_ARB_vertex_array_object'] },
{ 'name': 'glIsVertexArrayOES' },
{ 'name': 'glIsVertexArrayAPPLE',
'extensions': ['GL_APPLE_vertex_array_object'] }],
@@ -755,6 +783,8 @@
{ 'return_type': 'void*',
'known_as': 'glMapBufferRange',
'versions': [{ 'name': 'glMapBufferRange',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] },
+ { 'name': 'glMapBufferRange',
'extensions': ['GL_ARB_map_buffer_range'] },
{ 'name': 'glMapBufferRangeEXT',
'extensions': ['GL_EXT_map_buffer_range'] }],
@@ -763,17 +793,24 @@
{ 'return_type': 'void',
'known_as': 'glMatrixLoadfEXT',
'versions': [{ 'name': 'glMatrixLoadfEXT',
- 'extensions': ['GL_EXT_direct_state_access',
- 'GL_NV_path_rendering'] }],
+ 'gl_versions': ['gl4'],
+ 'extensions': ['GL_EXT_direct_state_access'] },
+ { 'name': 'glMatrixLoadfEXT',
+ 'gl_versions': ['es3'],
+ 'extensions': ['GL_NV_path_rendering'] }],
'arguments': 'GLenum matrixMode, const GLfloat* m' },
{ 'return_type': 'void',
'known_as': 'glMatrixLoadIdentityEXT',
'versions': [{ 'name': 'glMatrixLoadIdentityEXT',
- 'extensions': ['GL_EXT_direct_state_access',
- 'GL_NV_path_rendering'] },],
+ 'gl_versions': ['gl4'],
+ 'extensions': ['GL_EXT_direct_state_access'] },
+ { 'name': 'glMatrixLoadIdentityEXT',
+ 'gl_versions': ['es3'],
+ 'extensions': ['GL_NV_path_rendering'] }],
'arguments': 'GLenum matrixMode' },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glPauseTransformFeedback' }],
+ 'versions': [{ 'name': 'glPauseTransformFeedback',
+ 'gl_versions': ['gl4', 'es3'] }],
'arguments': 'void', },
{ 'return_type': 'void',
'names': ['glPixelStorei'],
@@ -791,20 +828,20 @@
'known_as': 'glProgramBinary',
'versions': [{ 'name': 'glProgramBinaryOES' },
{ 'name': 'glProgramBinary',
- 'extensions': ['GL_ARB_get_program_binary'] }],
+ 'extensions': ['GL_ARB_get_program_binary'] },
+ { 'name': 'glProgramBinary' }],
'arguments': 'GLuint program, GLenum binaryFormat, '
'const GLvoid* binary, GLsizei length' },
{ 'return_type': 'void',
'versions': [{ 'name': 'glProgramParameteri',
- 'extensions': ['GL_ARB_get_program_binary'] }],
+ 'extensions': ['GL_ARB_get_program_binary'] },
+ { 'name': 'glProgramParameteri' }],
'arguments': 'GLuint program, GLenum pname, GLint value' },
{ 'return_type': 'void',
'names': ['glPushGroupMarkerEXT'],
'arguments': 'GLsizei length, const char* marker', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glQueryCounter',
- 'extensions': ['GL_ARB_timer_query'] },
- { 'name': 'glQueryCounterEXT' }],
+ 'names': ['glQueryCounter', 'glQueryCounterEXT'],
'arguments': 'GLuint id, GLenum target', },
{ 'return_type': 'void',
'names': ['glReadBuffer'],
@@ -857,22 +894,27 @@
'arguments': 'GLenum target, GLsizei samples, GLenum internalformat, '
'GLsizei width, GLsizei height', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glResumeTransformFeedback' }],
+ 'versions': [{ 'name': 'glResumeTransformFeedback',
+ 'gl_versions': ['gl4', 'es3'] }],
'arguments': 'void', },
{ 'return_type': 'void',
'names': ['glSampleCoverage'],
'arguments': 'GLclampf value, GLboolean invert', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glSamplerParameterf' }],
+ 'versions': [{ 'name': 'glSamplerParameterf',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }], # GL 3.2 or higher.
'arguments': 'GLuint sampler, GLenum pname, GLfloat param', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glSamplerParameterfv' }],
+ 'versions': [{ 'name': 'glSamplerParameterfv',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }], # GL 3.2 or higher.
'arguments': 'GLuint sampler, GLenum pname, const GLfloat* params', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glSamplerParameteri' }],
+ 'versions': [{ 'name': 'glSamplerParameteri',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }], # GL 3.2 or higher.
'arguments': 'GLuint sampler, GLenum pname, GLint param', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glSamplerParameteriv' }],
+ 'versions': [{ 'name': 'glSamplerParameteriv',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }], # GL 3.2 or higher.
'arguments': 'GLuint sampler, GLenum pname, const GLint* params', },
{ 'return_type': 'void',
'names': ['glScissor'],
@@ -942,7 +984,8 @@
'GLsizei height, GLint border, GLenum format, GLenum type, '
'const void* pixels', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glTexImage3D' }],
+ 'versions': [{ 'name': 'glTexImage3D',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }],
'arguments':
'GLenum target, GLint level, GLint internalformat, GLsizei width, '
'GLsizei height, GLsizei depth, GLint border, GLenum format, '
@@ -962,13 +1005,16 @@
{ 'return_type': 'void',
'known_as': 'glTexStorage2DEXT',
'versions': [{ 'name': 'glTexStorage2D',
+ 'gl_versions': ['es3'] },
+ { 'name': 'glTexStorage2D',
'extensions': ['GL_ARB_texture_storage'] },
{ 'name': 'glTexStorage2DEXT',
'extensions': ['GL_EXT_texture_storage'] }],
'arguments': 'GLenum target, GLsizei levels, GLenum internalformat, '
'GLsizei width, GLsizei height', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glTexStorage3D' }],
+ 'versions': [{ 'name': 'glTexStorage3D',
+ 'gl_versions': ['gl4', 'es3'] }], # GL 4.2 or higher.
'arguments': 'GLenum target, GLsizei levels, GLenum internalformat, '
'GLsizei width, GLsizei height, GLsizei depth', },
{ 'return_type': 'void',
@@ -979,13 +1025,15 @@
'const void* pixels', },
# TODO(zmo): wait for MOCK_METHOD11.
# { 'return_type': 'void',
-# 'versions': [{ 'name': 'glTexSubImage3D' }],
+# 'versions': [{ 'name': 'glTexSubImage3D',
+# 'gl_versions': ['gl3', 'gl4', 'es3'] }],
# 'arguments':
# 'GLenum target, GLint level, GLint xoffset, GLint yoffset, '
# 'GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, '
# 'GLenum format, GLenum type, const void* pixels', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glTransformFeedbackVaryings' }],
+ 'versions': [{ 'name': 'glTransformFeedbackVaryings',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }],
'arguments': 'GLuint program, GLsizei count, const char* const* varyings, '
'GLenum bufferMode', },
{ 'return_type': 'void',
@@ -1001,10 +1049,12 @@
'names': ['glUniform1iv'],
'arguments': 'GLint location, GLsizei count, const GLint* v', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glUniform1ui' }],
+ 'versions': [{ 'name': 'glUniform1ui',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }],
'arguments': 'GLint location, GLuint v0', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glUniform1uiv' }],
+ 'versions': [{ 'name': 'glUniform1uiv',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }],
'arguments': 'GLint location, GLsizei count, const GLuint* v', },
{ 'return_type': 'void',
'names': ['glUniform2f'],
@@ -1019,10 +1069,12 @@
'names': ['glUniform2iv'],
'arguments': 'GLint location, GLsizei count, const GLint* v', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glUniform2ui' }],
+ 'versions': [{ 'name': 'glUniform2ui',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }],
'arguments': 'GLint location, GLuint v0, GLuint v1', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glUniform2uiv' }],
+ 'versions': [{ 'name': 'glUniform2uiv',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }],
'arguments': 'GLint location, GLsizei count, const GLuint* v', },
{ 'return_type': 'void',
'names': ['glUniform3f'],
@@ -1037,10 +1089,12 @@
'names': ['glUniform3iv'],
'arguments': 'GLint location, GLsizei count, const GLint* v', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glUniform3ui' }],
+ 'versions': [{ 'name': 'glUniform3ui',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }],
'arguments': 'GLint location, GLuint v0, GLuint v1, GLuint v2', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glUniform3uiv' }],
+ 'versions': [{ 'name': 'glUniform3uiv',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }],
'arguments': 'GLint location, GLsizei count, const GLuint* v', },
{ 'return_type': 'void',
'names': ['glUniform4f'],
@@ -1055,13 +1109,16 @@
'names': ['glUniform4iv'],
'arguments': 'GLint location, GLsizei count, const GLint* v', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glUniform4ui' }],
+ 'versions': [{ 'name': 'glUniform4ui',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }],
'arguments': 'GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glUniform4uiv' }],
+ 'versions': [{ 'name': 'glUniform4uiv',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }],
'arguments': 'GLint location, GLsizei count, const GLuint* v', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glUniformBlockBinding' }],
+ 'versions': [{ 'name': 'glUniformBlockBinding',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }], # GL 3.1 or higher.
'arguments': 'GLuint program, GLuint uniformBlockIndex, '
'GLuint uniformBlockBinding', },
{ 'return_type': 'void',
@@ -1069,11 +1126,13 @@
'arguments': 'GLint location, GLsizei count, '
'GLboolean transpose, const GLfloat* value', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glUniformMatrix2x3fv' }],
+ 'versions': [{ 'name': 'glUniformMatrix2x3fv',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }],
'arguments': 'GLint location, GLsizei count, '
'GLboolean transpose, const GLfloat* value', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glUniformMatrix2x4fv' }],
+ 'versions': [{ 'name': 'glUniformMatrix2x4fv',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }],
'arguments': 'GLint location, GLsizei count, '
'GLboolean transpose, const GLfloat* value', },
{ 'return_type': 'void',
@@ -1081,11 +1140,13 @@
'arguments': 'GLint location, GLsizei count, '
'GLboolean transpose, const GLfloat* value', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glUniformMatrix3x2fv' }],
+ 'versions': [{ 'name': 'glUniformMatrix3x2fv',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }],
'arguments': 'GLint location, GLsizei count, '
'GLboolean transpose, const GLfloat* value', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glUniformMatrix3x4fv' }],
+ 'versions': [{ 'name': 'glUniformMatrix3x4fv',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }],
'arguments': 'GLint location, GLsizei count, '
'GLboolean transpose, const GLfloat* value', },
{ 'return_type': 'void',
@@ -1093,11 +1154,13 @@
'arguments': 'GLint location, GLsizei count, '
'GLboolean transpose, const GLfloat* value', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glUniformMatrix4x2fv' }],
+ 'versions': [{ 'name': 'glUniformMatrix4x2fv',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }],
'arguments': 'GLint location, GLsizei count, '
'GLboolean transpose, const GLfloat* value', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glUniformMatrix4x3fv' }],
+ 'versions': [{ 'name': 'glUniformMatrix4x3fv',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }],
'arguments': 'GLint location, GLsizei count, '
'GLboolean transpose, const GLfloat* value', },
{ 'return_type': 'GLboolean',
@@ -1141,19 +1204,24 @@
'arguments':
'GLuint index, GLuint divisor', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glVertexAttribI4i' }],
+ 'versions': [{ 'name': 'glVertexAttribI4i',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }],
'arguments': 'GLuint indx, GLint x, GLint y, GLint z, GLint w', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glVertexAttribI4iv' }],
+ 'versions': [{ 'name': 'glVertexAttribI4iv',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }],
'arguments': 'GLuint indx, const GLint* values', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glVertexAttribI4ui' }],
+ 'versions': [{ 'name': 'glVertexAttribI4ui',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }],
'arguments': 'GLuint indx, GLuint x, GLuint y, GLuint z, GLuint w', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glVertexAttribI4uiv' }],
+ 'versions': [{ 'name': 'glVertexAttribI4uiv',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }],
'arguments': 'GLuint indx, const GLuint* values', },
{ 'return_type': 'void',
- 'versions': [{ 'name': 'glVertexAttribIPointer' }],
+ 'versions': [{ 'name': 'glVertexAttribIPointer',
+ 'gl_versions': ['gl3', 'gl4', 'es3'] }],
'arguments': 'GLuint indx, GLint size, GLenum type, GLsizei stride, '
'const void* ptr', },
{ 'return_type': 'void',
@@ -1164,8 +1232,7 @@
'names': ['glViewport'],
'arguments': 'GLint x, GLint y, GLsizei width, GLsizei height', },
{ 'return_type': 'GLenum',
- 'versions': [{ 'name': 'glWaitSync',
- 'extensions': ['GL_ARB_sync'] }],
+ 'names': ['glWaitSync'],
'arguments':
'GLsync sync, GLbitfield flags, GLuint64 timeout', },
]
@@ -1608,11 +1675,8 @@
FUNCTION_SETS = [
[GL_FUNCTIONS, 'gl', [
- 'GL/gl.h',
- 'noninclude/GL/glext.h',
+ 'GL/glext.h',
'GLES2/gl2ext.h',
- 'GLES3/gl3.h',
- 'GLES3/gl31.h',
# Files below are Chromium-specific and shipped with Chromium sources.
'GL/glextchromium.h',
'GLES2/gl2chromium.h',
@@ -1629,8 +1693,8 @@
'EGL_ANGLE_surface_d3d_texture_2d_share_handle',
],
],
- [WGL_FUNCTIONS, 'wgl', ['noninclude/GL/wglext.h'], []],
- [GLX_FUNCTIONS, 'glx', ['GL/glx.h', 'noninclude/GL/glxext.h'], []],
+ [WGL_FUNCTIONS, 'wgl', ['GL/wglext.h'], []],
+ [GLX_FUNCTIONS, 'glx', ['GL/glx.h', 'GL/glxext.h'], []],
]
GLES2_HEADERS_WITH_ENUMS = [
@@ -1656,53 +1720,6 @@
"""
-GLVersion = namedtuple('GLVersion', 'is_es major_version minor_version')
-
-def GLVersionBindAlways(version):
- return version.major_version <= 2
-
-
-def GetStaticBinding(func):
- """If this function has a name assigned to it that should be bound always,
- then return this name.
-
- This will be the case if either a function name is specified
- that depends on an extension from UNCONDITIONALLY_BOUND_EXTENSIONS,
- or if the GL version it depends on is assumed to be available (e.g. <=2.1).
- There can only be one name that satisfies this condition (or the bindings
- would be ambiguous)."""
-
- static_bindings = set([])
-
- for version in func['versions']:
- if 'extensions' in version:
- extensions = version['extensions']
- num_unconditional_extensions = len(
- extensions & UNCONDITIONALLY_BOUND_EXTENSIONS)
- if num_unconditional_extensions:
- static_bindings.add(version['name'])
- elif 'gl_versions' in version:
- versions = [v for v in version['gl_versions'] if GLVersionBindAlways(v)]
- # It's only unconditional if it exists in GL and GLES
- if len(versions) == 2:
- assert versions[0].is_es != versions[1].is_es
- static_bindings.add(version['name'])
- else:
- static_bindings.add(version['name'])
-
- # Avoid ambiguous bindings (static binding with different names)
- assert len(static_bindings) <= 1
- if len(static_bindings):
- static_name = static_bindings.pop()
- # Avoid ambiguous bindings (static and dynamic bindings with
- # different names)
- assert len([v['name'] for v in func['versions']
- if v['name'] != static_name]) == 0, func
- return static_name
- else:
- return None
-
-
def GenerateHeader(file, functions, set_name, used_extensions):
"""Generates gl_bindings_autogen_x.h"""
@@ -1814,7 +1831,6 @@
'ui/gl/gl_implementation.h',
'ui/gl/gl_version_info.h',
set_header_name ]
-
includes_string = "\n".join(["#include \"{0}\"".format(h)
for h in sorted(include_list)])
@@ -1838,16 +1854,17 @@
# is initialized. This is done to provide clear asserts on debug build and to
# avoid crashing in case of a bug on release build.
file.write('\n')
- num_dynamic = 0
for func in functions:
- static_binding = GetStaticBinding(func)
- if static_binding:
- func['static_binding'] = static_binding
- else:
- num_dynamic = num_dynamic + 1
-
- print "[%s] %d static bindings, %d dynamic bindings" % (
- set_name, len(functions) - num_dynamic, num_dynamic)
+ unique_names = set([version['name'] for version in func['versions']])
+ if len(unique_names) > 1:
+ file.write('%s %sNotBound(%s) {\n' %
+ (func['return_type'], func['known_as'], func['arguments']))
+ file.write(' NOTREACHED();\n')
+ return_type = func['return_type'].lower()
+ # Returning 0 works for booleans, integers and pointers.
+ if return_type != 'void':
+ file.write(' return 0;\n')
+ file.write('}\n')
# Write function to initialize the function pointers that are always the same
# and to initialize bindings where choice of the function depends on the
@@ -1862,81 +1879,100 @@
(known_as, known_as, version_name))
for func in functions:
- if 'static_binding' in func:
- WriteFuncBinding(file, func['known_as'], func['static_binding'])
+ unique_names = set([version['name'] for version in func['versions']])
+ if len(unique_names) == 1:
+ WriteFuncBinding(file, func['known_as'], func['known_as'])
else:
- file.write(' fn.%sFn = 0;\n' % func['known_as'])
-
- if set_name == 'gl':
- # Write the deferred bindings for GL that need a current context and depend
- # on GL_VERSION and GL_EXTENSIONS.
- file.write('}\n\n')
- file.write("""void DriverGL::InitializeDynamicBindings(GLContext* context) {
+ file.write(' fn.%sFn = reinterpret_cast<%sProc>(%sNotBound);\n' %
+ (func['known_as'], func['known_as'], func['known_as']))
+
+ file.write('}\n')
+ file.write('\n')
+
+ # Write function to initialize bindings where choice of the function depends
+ # on the extension string or the GL version.
+ file.write("""void Driver%s::InitializeDynamicBindings(GLContext* context) {
DCHECK(context && context->IsCurrent(NULL));
const GLVersionInfo* ver = context->GetVersionInfo();
ALLOW_UNUSED_LOCAL(ver);
std::string extensions = context->GetExtensions() + " ";
ALLOW_UNUSED_LOCAL(extensions);
-""")
- else:
- file.write("""std::string extensions(GetPlatformExtensions());
- extensions += " ";
- ALLOW_UNUSED_LOCAL(extensions);
-
-""")
-
+""" % set_name.upper())
for extension in sorted(used_extensions):
# Extra space at the end of the extension name is intentional, it is used
# as a separator
file.write(' ext.b_%s = extensions.find("%s ") != std::string::npos;\n' %
(extension, extension))
- def GetGLVersionCondition(gl_version):
- if GLVersionBindAlways(gl_version):
- if gl_version.is_es:
- return 'ver->is_es'
- else:
- return '!ver->is_es'
- elif gl_version.is_es:
- return 'ver->IsAtLeastGLES(%du, %du)' % (
- gl_version.major_version, gl_version.minor_version)
- else:
- return 'ver->IsAtLeastGL(%du, %du)' % (
- gl_version.major_version, gl_version.minor_version)
-
- def GetBindingCondition(version):
+ def WrapOr(cond):
+ if ' || ' in cond:
+ return '(%s)' % cond
+ return cond
+
+ def WrapAnd(cond):
+ if ' && ' in cond:
+ return '(%s)' % cond
+ return cond
+
+ def VersionCondition(version):
conditions = []
if 'gl_versions' in version:
- conditions.extend(
- [GetGLVersionCondition(v) for v in version['gl_versions']])
+ gl_versions = version['gl_versions']
+ version_cond = ' || '.join(['ver->is_%s' % gl for gl in gl_versions])
+ conditions.append(WrapOr(version_cond))
if 'extensions' in version and version['extensions']:
- conditions.extend(
- ['ext.b_%s' % e for e in version['extensions']])
- return ' || '.join(conditions)
+ ext_cond = ' || '.join(['ext.b_%s' % e for e in version['extensions']])
+ conditions.append(WrapOr(ext_cond))
+ return ' && '.join(conditions)
def WriteConditionalFuncBinding(file, func):
- assert len(func['versions']) > 0
+ # Functions with only one version are always bound unconditionally
+ assert len(func['versions']) > 1
known_as = func['known_as']
i = 0
first_version = True
while i < len(func['versions']):
version = func['versions'][i]
- cond = GetBindingCondition(version)
- if first_version:
- file.write(' if (%s) {\n ' % cond)
- else:
- file.write(' else if (%s) {\n ' % (cond))
-
+ cond = VersionCondition(version)
+ combined_conditions = [WrapAnd(cond)]
+ last_version = i + 1 == len(func['versions'])
+ while not last_version and \
+ func['versions'][i + 1]['name'] == version['name']:
+ i += 1
+ combinable_cond = VersionCondition(func['versions'][i])
+ combined_conditions.append(WrapAnd(combinable_cond))
+ last_version = i + 1 == len(func['versions'])
+ if len(combined_conditions) > 1:
+ if [1 for cond in combined_conditions if cond == '']:
+ cond = ''
+ else:
+ cond = ' || '.join(combined_conditions)
+ # Don't make the last possible binding conditional on anything else but
+ # that the function isn't already bound to avoid verbose specification
+ # of functions which have both ARB and core versions with the same name,
+ # and to be able to bind to mock extension functions in unit tests which
+ # call InitializeDynamicGLBindings with a stub context that doesn't have
+ # extensions in its extension string.
+ # TODO(oetuaho@nvidia.com): Get rid of the fallback.
+ # http://crbug.com/325668
+ if cond != '' and not last_version:
+ if not first_version:
+ file.write(' if (!fn.%sFn && (%s)) {\n ' % (known_as, cond))
+ else:
+ file.write(' if (%s) {\n ' % cond)
+ elif not first_version:
+ file.write(' if (!fn.%sFn) {\n ' % known_as)
WriteFuncBinding(file, known_as, version['name'])
- file.write('DCHECK(fn.%sFn);\n' % known_as)
file.write('}\n')
i += 1
first_version = False
for func in functions:
- if not 'static_binding' in func:
+ unique_names = set([version['name'] for version in func['versions']])
+ if len(unique_names) > 1:
file.write('\n')
+ file.write(' fn.%sFn = 0;\n' % func['known_as'])
file.write(' debug_fn.%sFn = 0;\n' % func['known_as'])
WriteConditionalFuncBinding(file, func)
@@ -2239,18 +2275,15 @@
""")
-def ParseFunctionsFromHeader(header_file, extensions, versions):
+def ParseExtensionFunctionsFromHeader(header_file):
"""Parse a C extension header file and return a map from extension names to
a list of functions.
Args:
header_file: Line-iterable C header file.
Returns:
- Map of extension name => functions, Map of gl version => functions.
- Functions will only be in either one of the two maps.
+ Map of extension name => functions.
"""
- version_start = re.compile(
- r'#ifndef GL_(ES_|)VERSION((?:_[0-9])+)$')
extension_start = re.compile(
r'#ifndef ((?:GL|EGL|WGL|GLX)_[A-Z]+_[a-zA-Z]\w+)')
extension_function = re.compile(r'.+\s+([a-z]+\w+)\s*\(')
@@ -2258,108 +2291,58 @@
macro_start = re.compile(r'^#(if|ifdef|ifndef).*')
macro_end = re.compile(r'^#endif.*')
macro_depth = 0
- current_version = None
- current_version_depth = 0
current_extension = None
current_extension_depth = 0
-
- # Pick up all core functions here, since some of them are missing in the
- # Khronos headers.
- hdr = os.path.basename(header_file.name)
- if hdr == "gl.h":
- current_version = GLVersion(False, 1, 0)
-
- line_num = 1
+ extensions = collections.defaultdict(lambda: [])
for line in header_file:
- version_match = version_start.match(line)
if macro_start.match(line):
macro_depth += 1
- if version_match:
- if current_version:
- raise RuntimeError('Nested GL version macro in %s at line %d' % (
- header_file.name, line_num))
- current_version_depth = macro_depth
- es = version_match.group(1)
- major_version, minor_version =\
- version_match.group(2).lstrip('_').split('_')
- is_es = len(es) > 0
- if (not is_es) and (major_version == '1'):
- minor_version = 0
- current_version = GLVersion(
- is_es, int(major_version), int(minor_version))
elif macro_end.match(line):
macro_depth -= 1
if macro_depth < current_extension_depth:
current_extension = None
- if macro_depth < current_version_depth:
- current_version = None
-
match = extension_start.match(line)
- if match and not version_match:
- if current_version and hdr != "gl.h":
- raise RuntimeError('Nested GL version macro in %s at line %d' % (
- header_file.name, line_num))
+ if match:
current_extension = match.group(1)
current_extension_depth = macro_depth
-
+ assert current_extension not in extensions, \
+ "Duplicate extension: " + current_extension
match = extension_function.match(line)
- if match and not typedef.match(line):
- if current_extension:
- extensions[current_extension].add(match.group(1))
- elif current_version:
- versions[current_version].add(match.group(1))
- line_num = line_num + 1
-
-
-def GetDynamicFunctions(extension_headers):
- """Parse all optional functions from a list of header files.
+ if match and current_extension and not typedef.match(line):
+ extensions[current_extension].append(match.group(1))
+ return extensions
+
+
+def GetExtensionFunctions(extension_headers):
+ """Parse extension functions from a list of header files.
Args:
extension_headers: List of header file names.
Returns:
- Map of extension name => list of functions,
- Map of gl version => list of functions.
+ Map of extension name => list of functions.
"""
- extensions = collections.defaultdict(lambda: set([]))
- gl_versions = collections.defaultdict(lambda: set([]))
+ extensions = {}
for header in extension_headers:
- ParseFunctionsFromHeader(open(header), extensions, gl_versions)
- return extensions, gl_versions
-
-
-def GetFunctionToExtensionsMap(extensions):
+ extensions.update(ParseExtensionFunctionsFromHeader(open(header)))
+ return extensions
+
+
+def GetFunctionToExtensionMap(extensions):
"""Construct map from a function names to extensions which define the
function.
Args:
extensions: Map of extension name => functions.
Returns:
- Map of function name => extension names.
+ Map of function name => extension name.
"""
function_to_extensions = {}
for extension, functions in extensions.items():
for function in functions:
if not function in function_to_extensions:
- function_to_extensions[function] = set([])
- function_to_extensions[function].add(extension)
+ function_to_extensions[function] = []
+ function_to_extensions[function].append(extension)
return function_to_extensions
-
-def GetFunctionToGLVersionsMap(gl_versions):
- """Construct map from a function names to GL versions which define the
- function.
-
- Args:
- extensions: Map of gl versions => functions.
- Returns:
- Map of function name => gl versions.
- """
- function_to_gl_versions = {}
- for gl_version, functions in gl_versions.items():
- for function in functions:
- if not function in function_to_gl_versions:
- function_to_gl_versions[function] = set([])
- function_to_gl_versions[function].add(gl_version)
- return function_to_gl_versions
def LooksLikeExtensionFunction(function):
@@ -2368,13 +2351,6 @@
vendor = re.match(r'\w+?([A-Z][A-Z]+)$', function)
return vendor is not None and not vendor.group(1) in ['GL', 'API', 'DC']
-
-def SortVersions(key):
- # Prefer functions from the core for binding
- if 'gl_versions' in key:
- return 0
- else:
- return 1
def FillExtensionsFromHeaders(functions, extension_headers, extra_extensions):
"""Determine which functions belong to extensions based on extension headers,
@@ -2389,70 +2365,30 @@
Set of used extensions.
"""
# Parse known extensions.
- extensions, gl_versions = GetDynamicFunctions(extension_headers)
- functions_to_extensions = GetFunctionToExtensionsMap(extensions)
- functions_to_gl_versions = GetFunctionToGLVersionsMap(gl_versions)
+ extensions = GetExtensionFunctions(extension_headers)
+ functions_to_extensions = GetFunctionToExtensionMap(extensions)
# Fill in the extension information.
used_extensions = set()
- used_functions_by_version = collections.defaultdict(lambda: set([]))
for func in functions:
for version in func['versions']:
name = version['name']
-
- # There should only be one version entry per name string.
- if len([v for v in func['versions'] if v['name'] == name]) > 1:
- raise RuntimeError(
- 'Duplicate version entries with same name for %s' % name)
-
# Make sure we know about all extensions and extension functions.
- extensions_from_headers = set([])
- if name in functions_to_extensions:
- extensions_from_headers = set(functions_to_extensions[name])
-
- explicit_extensions = set([])
if 'extensions' in version:
- explicit_extensions = set(version['extensions'])
-
- in_both = explicit_extensions.intersection(extensions_from_headers)
- if len(in_both):
- print "[%s] Specified redundant extensions for binding: %s" % (
- name, ', '.join(in_both))
- diff = explicit_extensions - extensions_from_headers
- if len(diff):
- print "[%s] Specified extra extensions for binding: %s" % (
- name, ', '.join(diff))
-
- all_extensions = extensions_from_headers.union(explicit_extensions)
- if len(all_extensions):
- version['extensions'] = all_extensions
-
- if 'extensions' in version:
- assert len(version['extensions'])
used_extensions.update(version['extensions'])
-
- if not 'extensions' in version and LooksLikeExtensionFunction(name):
+ elif name in functions_to_extensions:
+ # If there are multiple versions with the same name, assume that they
+ # already have all the correct conditions, we can't just blindly add
+ # the same extension conditions to all of them
+ if len([v for v in func['versions'] if v['name'] == name]) == 1:
+ version['extensions'] = functions_to_extensions[name]
+ used_extensions.update(version['extensions'])
+ elif LooksLikeExtensionFunction(name):
raise RuntimeError('%s looks like an extension function but does not '
'belong to any of the known extensions.' % name)
- if name in functions_to_gl_versions:
- assert not 'gl_versions' in version
- version['gl_versions'] = functions_to_gl_versions[name]
- for v in version['gl_versions']:
- used_functions_by_version[v].add(name)
-
- func['versions'] = sorted(func['versions'], key=SortVersions)
-
# Add extensions that do not have any functions.
used_extensions.update(extra_extensions)
-
- # Print out used function count by GL(ES) version.
- for v in sorted([v for v in used_functions_by_version if v.is_es]):
- print "OpenGL ES %d.%d: %d used functions" % (
- v.major_version, v.minor_version, len(used_functions_by_version[v]))
- for v in sorted([v for v in used_functions_by_version if not v.is_es]):
- print "OpenGL %d.%d: %d used functions" % (
- v.major_version, v.minor_version, len(used_functions_by_version[v]))
return used_extensions
« no previous file with comments | « ui/gl/BUILD.gn ('k') | ui/gl/gl.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698