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

Side by Side Diff: ui/gl/generate_bindings.py

Issue 10392068: ui: Move gl/ directory out of gfx/, up to ui/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix mac_rel Created 8 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/gl/egl_util.cc ('k') | ui/gl/gl.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """code generator for GL/GLES extension wrangler.""" 6 """code generator for GL/GLES extension wrangler."""
7 7
8 import os 8 import os
9 import collections 9 import collections
10 import re 10 import re
(...skipping 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after
1049 'names': ['glXGetFBConfigFromVisualSGIX'], 1049 'names': ['glXGetFBConfigFromVisualSGIX'],
1050 'arguments': 'Display* dpy, XVisualInfo* visualInfo', }, 1050 'arguments': 'Display* dpy, XVisualInfo* visualInfo', },
1051 { 'return_type': 'GLXContext', 1051 { 'return_type': 'GLXContext',
1052 'names': ['glXCreateContextAttribsARB'], 1052 'names': ['glXCreateContextAttribsARB'],
1053 'arguments': 1053 'arguments':
1054 'Display* dpy, GLXFBConfig config, GLXContext share_context, int direct, ' 1054 'Display* dpy, GLXFBConfig config, GLXContext share_context, int direct, '
1055 'const int* attrib_list', }, 1055 'const int* attrib_list', },
1056 ] 1056 ]
1057 1057
1058 FUNCTION_SETS = [ 1058 FUNCTION_SETS = [
1059 [GL_FUNCTIONS, 'gl', ['../../../third_party/mesa/MesaLib/include/GL/glext.h', 1059 [GL_FUNCTIONS, 'gl', ['../../third_party/mesa/MesaLib/include/GL/glext.h',
1060 '../../../third_party/khronos/GLES2/gl2ext.h'], []], 1060 '../../third_party/khronos/GLES2/gl2ext.h'], []],
1061 [OSMESA_FUNCTIONS, 'osmesa', [], []], 1061 [OSMESA_FUNCTIONS, 'osmesa', [], []],
1062 [EGL_FUNCTIONS, 'egl', ['../../../third_party/khronos/EGL/eglext.h'], 1062 [EGL_FUNCTIONS, 'egl', ['../../third_party/khronos/EGL/eglext.h'],
1063 [ 1063 [
1064 'EGL_ANGLE_d3d_share_handle_client_buffer', 1064 'EGL_ANGLE_d3d_share_handle_client_buffer',
1065 ], 1065 ],
1066 ], 1066 ],
1067 [WGL_FUNCTIONS, 'wgl', [ 1067 [WGL_FUNCTIONS, 'wgl', [
1068 '../../../third_party/mesa/MesaLib/include/GL/wglext.h'], []], 1068 '../../third_party/mesa/MesaLib/include/GL/wglext.h'], []],
1069 [GLX_FUNCTIONS, 'glx', [ 1069 [GLX_FUNCTIONS, 'glx', [
1070 '../../../third_party/mesa/MesaLib/include/GL/glxext.h'], []], 1070 '../../third_party/mesa/MesaLib/include/GL/glxext.h'], []],
1071 ] 1071 ]
1072 1072
1073 def GenerateHeader(file, functions, set_name, used_extension_functions): 1073 def GenerateHeader(file, functions, set_name, used_extension_functions):
1074 """Generates gl_binding_autogen_x.h""" 1074 """Generates gl_binding_autogen_x.h"""
1075 1075
1076 # Write file header. 1076 # Write file header.
1077 file.write('// Copyright (c) 2011 The Chromium Authors. All rights reserved.\n ') 1077 file.write('// Copyright (c) 2011 The Chromium Authors. All rights reserved.\n ')
1078 file.write('// Use of this source code is governed by a BSD-style license that can be\n') 1078 file.write('// Use of this source code is governed by a BSD-style license that can be\n')
1079 file.write('// found in the LICENSE file.\n') 1079 file.write('// found in the LICENSE file.\n')
1080 file.write('\n') 1080 file.write('\n')
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1133 1133
1134 # Write file header. 1134 # Write file header.
1135 file.write('// Copyright (c) 2011 The Chromium Authors. All rights reserved.\n ') 1135 file.write('// Copyright (c) 2011 The Chromium Authors. All rights reserved.\n ')
1136 file.write('// Use of this source code is governed by a BSD-style license that can be\n') 1136 file.write('// Use of this source code is governed by a BSD-style license that can be\n')
1137 file.write('// found in the LICENSE file.\n') 1137 file.write('// found in the LICENSE file.\n')
1138 file.write('\n') 1138 file.write('\n')
1139 file.write('// This file is automatically generated.\n') 1139 file.write('// This file is automatically generated.\n')
1140 file.write('\n') 1140 file.write('\n')
1141 file.write('#include <string>\n') 1141 file.write('#include <string>\n')
1142 file.write('#include "gpu/command_buffer/common/gles2_cmd_utils.h"\n') 1142 file.write('#include "gpu/command_buffer/common/gles2_cmd_utils.h"\n')
1143 file.write('#include "ui/gfx/gl/gl_bindings.h"\n') 1143 file.write('#include "ui/gl/gl_bindings.h"\n')
1144 file.write('#include "ui/gfx/gl/gl_context.h"\n') 1144 file.write('#include "ui/gl/gl_context.h"\n')
1145 file.write('#include "ui/gfx/gl/gl_implementation.h"\n') 1145 file.write('#include "ui/gl/gl_implementation.h"\n')
1146 1146
1147 # Write definitions for booleans indicating which extensions are available. 1147 # Write definitions for booleans indicating which extensions are available.
1148 file.write('\n') 1148 file.write('\n')
1149 file.write('using gpu::gles2::GLES2Util;\n') 1149 file.write('using gpu::gles2::GLES2Util;\n')
1150 file.write('\n') 1150 file.write('\n')
1151 file.write('namespace gfx {\n') 1151 file.write('namespace gfx {\n')
1152 file.write('\n') 1152 file.write('\n')
1153 for extension, ext_functions in used_extension_functions: 1153 for extension, ext_functions in used_extension_functions:
1154 file.write('bool g_%s;\n' % extension) 1154 file.write('bool g_%s;\n' % extension)
1155 1155
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
1325 """Generates functions that invoke a mock GLInterface""" 1325 """Generates functions that invoke a mock GLInterface"""
1326 1326
1327 file.write('// Copyright (c) 2011 The Chromium Authors. All rights reserved.\n ') 1327 file.write('// Copyright (c) 2011 The Chromium Authors. All rights reserved.\n ')
1328 file.write('// Use of this source code is governed by a BSD-style license that can be\n') 1328 file.write('// Use of this source code is governed by a BSD-style license that can be\n')
1329 file.write('// found in the LICENSE file.\n') 1329 file.write('// found in the LICENSE file.\n')
1330 file.write('\n') 1330 file.write('\n')
1331 file.write('// This file is automatically generated.\n') 1331 file.write('// This file is automatically generated.\n')
1332 file.write('\n') 1332 file.write('\n')
1333 file.write('#include <string.h>\n') 1333 file.write('#include <string.h>\n')
1334 file.write('\n') 1334 file.write('\n')
1335 file.write('#include "ui/gfx/gl/gl_interface.h"\n') 1335 file.write('#include "ui/gl/gl_interface.h"\n')
1336 1336
1337 file.write('\n') 1337 file.write('\n')
1338 file.write('namespace gfx {\n') 1338 file.write('namespace gfx {\n')
1339 1339
1340 # Write function that trampoline into the GLInterface. 1340 # Write function that trampoline into the GLInterface.
1341 for func in functions: 1341 for func in functions:
1342 file.write('\n') 1342 file.write('\n')
1343 file.write('%s GL_BINDING_CALL Mock_%s(%s) {\n' % 1343 file.write('%s GL_BINDING_CALL Mock_%s(%s) {\n' %
1344 (func['return_type'], func['names'][0], func['arguments'])) 1344 (func['return_type'], func['names'][0], func['arguments']))
1345 argument_names = re.sub(r'(const )?[a-zA-Z0-9]+\** ([a-zA-Z0-9]+)', r'\2', 1345 argument_names = re.sub(r'(const )?[a-zA-Z0-9]+\** ([a-zA-Z0-9]+)', r'\2',
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
1522 source_file.close() 1522 source_file.close()
1523 1523
1524 source_file = open(os.path.join(dir, 'gl_bindings_autogen_mock.cc'), 'wb') 1524 source_file = open(os.path.join(dir, 'gl_bindings_autogen_mock.cc'), 'wb')
1525 GenerateMockSource(source_file, GL_FUNCTIONS) 1525 GenerateMockSource(source_file, GL_FUNCTIONS)
1526 source_file.close() 1526 source_file.close()
1527 return 0 1527 return 0
1528 1528
1529 1529
1530 if __name__ == '__main__': 1530 if __name__ == '__main__':
1531 sys.exit(main(sys.argv[1:])) 1531 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « ui/gl/egl_util.cc ('k') | ui/gl/gl.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698