| OLD | NEW |
| 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 optparse | 8 import optparse |
| 9 import os | 9 import os |
| 10 import collections | 10 import collections |
| (...skipping 1887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1898 | 1898 |
| 1899 | 1899 |
| 1900 def GenerateHeader(file, functions, set_name, | 1900 def GenerateHeader(file, functions, set_name, |
| 1901 used_extensions, used_client_extensions): | 1901 used_extensions, used_client_extensions): |
| 1902 """Generates gl_bindings_autogen_x.h""" | 1902 """Generates gl_bindings_autogen_x.h""" |
| 1903 | 1903 |
| 1904 # Write file header. | 1904 # Write file header. |
| 1905 file.write(LICENSE_AND_HEADER + | 1905 file.write(LICENSE_AND_HEADER + |
| 1906 """ | 1906 """ |
| 1907 | 1907 |
| 1908 #ifndef UI_GFX_GL_GL_BINDINGS_AUTOGEN_%(name)s_H_ | 1908 #ifndef UI_GL_GL_BINDINGS_AUTOGEN_%(name)s_H_ |
| 1909 #define UI_GFX_GL_GL_BINDINGS_AUTOGEN_%(name)s_H_ | 1909 #define UI_GL_GL_BINDINGS_AUTOGEN_%(name)s_H_ |
| 1910 | 1910 |
| 1911 namespace gfx { | 1911 namespace gfx { |
| 1912 | 1912 |
| 1913 class GLContext; | 1913 class GLContext; |
| 1914 | 1914 |
| 1915 """ % {'name': set_name.upper()}) | 1915 """ % {'name': set_name.upper()}) |
| 1916 | 1916 |
| 1917 # Write typedefs for function pointer types. Always use the GL name for the | 1917 # Write typedefs for function pointer types. Always use the GL name for the |
| 1918 # typedef. | 1918 # typedef. |
| 1919 file.write('\n') | 1919 file.write('\n') |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1955 file.write( '} // namespace gfx\n') | 1955 file.write( '} // namespace gfx\n') |
| 1956 | 1956 |
| 1957 # Write macros to invoke function pointers. Always use the GL name for the | 1957 # Write macros to invoke function pointers. Always use the GL name for the |
| 1958 # macro. | 1958 # macro. |
| 1959 file.write('\n') | 1959 file.write('\n') |
| 1960 for func in functions: | 1960 for func in functions: |
| 1961 file.write('#define %s ::gfx::g_current_%s_context->%sFn\n' % | 1961 file.write('#define %s ::gfx::g_current_%s_context->%sFn\n' % |
| 1962 (func['known_as'], set_name.lower(), func['known_as'])) | 1962 (func['known_as'], set_name.lower(), func['known_as'])) |
| 1963 | 1963 |
| 1964 file.write('\n') | 1964 file.write('\n') |
| 1965 file.write('#endif // UI_GFX_GL_GL_BINDINGS_AUTOGEN_%s_H_\n' % | 1965 file.write('#endif // UI_GL_GL_BINDINGS_AUTOGEN_%s_H_\n' % |
| 1966 set_name.upper()) | 1966 set_name.upper()) |
| 1967 | 1967 |
| 1968 | 1968 |
| 1969 def GenerateAPIHeader(file, functions, set_name): | 1969 def GenerateAPIHeader(file, functions, set_name): |
| 1970 """Generates gl_bindings_api_autogen_x.h""" | 1970 """Generates gl_bindings_api_autogen_x.h""" |
| 1971 | 1971 |
| 1972 # Write file header. | 1972 # Write file header. |
| 1973 file.write(LICENSE_AND_HEADER) | 1973 file.write(LICENSE_AND_HEADER) |
| 1974 | 1974 |
| 1975 # Write API declaration. | 1975 # Write API declaration. |
| (...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2845 'gl_enums_implementation_autogen.h'), | 2845 'gl_enums_implementation_autogen.h'), |
| 2846 'wb') | 2846 'wb') |
| 2847 GenerateEnumUtils(header_file, enum_header_filenames) | 2847 GenerateEnumUtils(header_file, enum_header_filenames) |
| 2848 header_file.close() | 2848 header_file.close() |
| 2849 ClangFormat(header_file.name) | 2849 ClangFormat(header_file.name) |
| 2850 return 0 | 2850 return 0 |
| 2851 | 2851 |
| 2852 | 2852 |
| 2853 if __name__ == '__main__': | 2853 if __name__ == '__main__': |
| 2854 sys.exit(main(sys.argv[1:])) | 2854 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |