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

Unified Diff: ui/gl/generate_bindings.py

Issue 11693007: Linux: use generated shim headers for system mesa. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: one less header Created 7 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
Index: ui/gl/generate_bindings.py
diff --git a/ui/gl/generate_bindings.py b/ui/gl/generate_bindings.py
index f90797c26d7e175ec95407c376a4a28536a066e5..7ac3a5e187e17cfb54b05841c37354ecfe410818 100755
--- a/ui/gl/generate_bindings.py
+++ b/ui/gl/generate_bindings.py
@@ -5,6 +5,7 @@
"""code generator for GL/GLES extension wrangler."""
+import optparse
import os
import collections
import re
@@ -1141,20 +1142,22 @@ GLX_FUNCTIONS = [
]
FUNCTION_SETS = [
- [GL_FUNCTIONS, 'gl', ['../../third_party/mesa/MesaLib/include/GL/glext.h',
- '../../third_party/khronos/GLES2/gl2ext.h'], []],
+ [GL_FUNCTIONS, 'gl', [
+ 'GL/glext.h',
+ 'GLES2/gl2ext.h',
+ # Files below are Chromium-specific and shipped with Chromium sources.
+ 'GLES2/gl2chromium.h',
+ 'GLES2/gl2extchromium.h'
+ ], []],
[OSMESA_FUNCTIONS, 'osmesa', [], []],
- [EGL_FUNCTIONS, 'egl', ['../../third_party/khronos/EGL/eglext.h'],
+ [EGL_FUNCTIONS, 'egl', ['EGL/eglext.h'],
[
'EGL_ANGLE_d3d_share_handle_client_buffer',
'EGL_ANGLE_surface_d3d_texture_2d_share_handle',
],
],
- [WGL_FUNCTIONS, 'wgl', [
- '../../third_party/mesa/MesaLib/include/GL/wglext.h'], []],
- [GLX_FUNCTIONS, 'glx', [
- '../../third_party/mesa/MesaLib/include/GL/glx.h',
- '../../third_party/mesa/MesaLib/include/GL/glxext.h'], []],
+ [WGL_FUNCTIONS, 'wgl', ['GL/wglext.h'], []],
+ [GLX_FUNCTIONS, 'glx', ['GL/glx.h', 'GL/glxext.h'], []],
]
def GenerateHeader(file, functions, set_name, used_extension_functions):
@@ -1585,7 +1588,7 @@ def ParseExtensionFunctionsFromHeader(header_file):
Map of extension name => functions.
"""
extension_start = re.compile(r'#define ([A-Z]+_[A-Z]+_[a-zA-Z]\w+) 1')
- extension_function = re.compile(r'.+\s+([a-z]+\w+)\s*\(.+\);')
+ extension_function = re.compile(r'.+\s+([a-z]+\w+)\s*\(')
typedef = re.compile(r'typedef .*')
macro_start = re.compile(r'^#(if|ifdef|ifndef).*')
macro_end = re.compile(r'^#endif.*')
@@ -1696,15 +1699,48 @@ def GetUsedExtensionFunctions(functions, extension_headers, extra_extensions):
return used_extension_functions
+def ResolveHeader(header, header_paths):
+ paths = header_paths.split(':')
+
+ # Always use a path for Chromium-specific extensions. They are extracted
+ # to separate files.
+ paths.append('../../gpu')
+
+ root = os.path.abspath(os.path.dirname(__file__))
+
+ for path in paths:
+ result = os.path.join(path, header)
+ if not os.path.isabs(path):
+ result = os.path.relpath(os.path.join(root, result), os.getcwd())
+ if os.path.exists(result):
+ return result
+
+ raise Exception('Header %s not found.' % header)
+
+
def main(argv):
"""This is the main function."""
- if len(argv) >= 1:
- dir = argv[0]
+ parser = optparse.OptionParser()
+ parser.add_option('--inputs', action='store_true')
+ parser.add_option('--header-paths')
+
+ options, args = parser.parse_args(argv)
+
+ if options.inputs:
+ for [_, _, headers, _] in FUNCTION_SETS:
+ for header in headers:
+ print ResolveHeader(header, options.header_paths)
+ return 0
+
+ if len(args) >= 1:
+ dir = args[0]
else:
dir = '.'
for [functions, set_name, extension_headers, extensions] in FUNCTION_SETS:
+ extension_headers = [ResolveHeader(h, options.header_paths)
+ for h in extension_headers]
used_extension_functions = GetUsedExtensionFunctions(
functions, extension_headers, extensions)

Powered by Google App Engine
This is Rietveld 408576698