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 GLES2 command buffers.""" | 6 """code generator for GLES2 command buffers.""" |
7 | 7 |
8 import itertools | 8 import itertools |
9 import os | 9 import os |
10 import os.path | 10 import os.path |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 'GLshort': 'short', | 46 'GLshort': 'short', |
47 'GLint': 'int', | 47 'GLint': 'int', |
48 'GLsizei': 'int', | 48 'GLsizei': 'int', |
49 'GLubyte': 'unsigned char', | 49 'GLubyte': 'unsigned char', |
50 'GLushort': 'unsigned short', | 50 'GLushort': 'unsigned short', |
51 'GLuint': 'unsigned int', | 51 'GLuint': 'unsigned int', |
52 'GLfloat': 'float', | 52 'GLfloat': 'float', |
53 'GLclampf': 'float', | 53 'GLclampf': 'float', |
54 'GLvoid': 'void', | 54 'GLvoid': 'void', |
55 'GLfixed': 'int', | 55 'GLfixed': 'int', |
56 'GLclampx': 'int', | 56 'GLclampx': 'int' |
| 57 } |
| 58 |
| 59 _GL_TYPES_32 = { |
57 'GLintptr': 'long int', | 60 'GLintptr': 'long int', |
58 'GLsizeiptr': 'long int', | 61 'GLsizeiptr': 'long int' |
| 62 } |
| 63 |
| 64 _GL_TYPES_64 = { |
| 65 'GLintptr': 'long long int', |
| 66 'GLsizeiptr': 'long long int' |
59 } | 67 } |
60 | 68 |
61 # Capabilites selected with glEnable | 69 # Capabilites selected with glEnable |
62 _CAPABILITY_FLAGS = [ | 70 _CAPABILITY_FLAGS = [ |
63 {'name': 'blend'}, | 71 {'name': 'blend'}, |
64 {'name': 'cull_face'}, | 72 {'name': 'cull_face'}, |
65 {'name': 'depth_test', 'state_flag': 'framebuffer_state_.clear_state_dirty'}, | 73 {'name': 'depth_test', 'state_flag': 'framebuffer_state_.clear_state_dirty'}, |
66 {'name': 'dither', 'default': True}, | 74 {'name': 'dither', 'default': True}, |
67 {'name': 'polygon_offset_fill'}, | 75 {'name': 'polygon_offset_fill'}, |
68 {'name': 'sample_alpha_to_coverage'}, | 76 {'name': 'sample_alpha_to_coverage'}, |
(...skipping 7517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7586 "// OpenGL ES interface.\n", | 7594 "// OpenGL ES interface.\n", |
7587 2) | 7595 2) |
7588 | 7596 |
7589 file.Write("#include \"ppapi/c/pp_resource.h\"\n") | 7597 file.Write("#include \"ppapi/c/pp_resource.h\"\n") |
7590 if dev: | 7598 if dev: |
7591 file.Write("#include \"ppapi/c/ppb_opengles2.h\"\n\n") | 7599 file.Write("#include \"ppapi/c/ppb_opengles2.h\"\n\n") |
7592 else: | 7600 else: |
7593 file.Write("\n#ifndef __gl2_h_\n") | 7601 file.Write("\n#ifndef __gl2_h_\n") |
7594 for (k, v) in _GL_TYPES.iteritems(): | 7602 for (k, v) in _GL_TYPES.iteritems(): |
7595 file.Write("typedef %s %s;\n" % (v, k)) | 7603 file.Write("typedef %s %s;\n" % (v, k)) |
| 7604 file.Write("#ifdef _WIN64\n") |
| 7605 for (k, v) in _GL_TYPES_64.iteritems(): |
| 7606 file.Write("typedef %s %s;\n" % (v, k)) |
| 7607 file.Write("#else\n") |
| 7608 for (k, v) in _GL_TYPES_32.iteritems(): |
| 7609 file.Write("typedef %s %s;\n" % (v, k)) |
| 7610 file.Write("#endif // _WIN64\n") |
7596 file.Write("#endif // __gl2_h_\n\n") | 7611 file.Write("#endif // __gl2_h_\n\n") |
7597 | 7612 |
7598 for interface in self.pepper_interfaces: | 7613 for interface in self.pepper_interfaces: |
7599 if interface.dev != dev: | 7614 if interface.dev != dev: |
7600 continue | 7615 continue |
7601 file.Write("#define %s_1_0 \"%s;1.0\"\n" % | 7616 file.Write("#define %s_1_0 \"%s;1.0\"\n" % |
7602 (interface.GetInterfaceName(), interface.GetInterfaceString())) | 7617 (interface.GetInterfaceName(), interface.GetInterfaceString())) |
7603 file.Write("#define %s %s_1_0\n" % | 7618 file.Write("#define %s %s_1_0\n" % |
7604 (interface.GetInterfaceName(), interface.GetInterfaceName())) | 7619 (interface.GetInterfaceName(), interface.GetInterfaceName())) |
7605 | 7620 |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7838 gen.WriteGLES2Header("../GLES2/gl2chromium_autogen.h") | 7853 gen.WriteGLES2Header("../GLES2/gl2chromium_autogen.h") |
7839 | 7854 |
7840 if gen.errors > 0: | 7855 if gen.errors > 0: |
7841 print "%d errors" % gen.errors | 7856 print "%d errors" % gen.errors |
7842 return 1 | 7857 return 1 |
7843 return 0 | 7858 return 0 |
7844 | 7859 |
7845 | 7860 |
7846 if __name__ == '__main__': | 7861 if __name__ == '__main__': |
7847 sys.exit(main(sys.argv[1:])) | 7862 sys.exit(main(sys.argv[1:])) |
OLD | NEW |