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 = { | |
60 'GLintptr': 'long int', | 57 'GLintptr': 'long int', |
61 'GLsizeiptr': 'long int' | 58 'GLsizeiptr': 'long int', |
62 } | |
63 | |
64 _GL_TYPES_64 = { | |
65 'GLintptr': 'long long int', | |
66 'GLsizeiptr': 'long long int' | |
67 } | 59 } |
68 | 60 |
69 # Capabilites selected with glEnable | 61 # Capabilites selected with glEnable |
70 _CAPABILITY_FLAGS = [ | 62 _CAPABILITY_FLAGS = [ |
71 {'name': 'blend'}, | 63 {'name': 'blend'}, |
72 {'name': 'cull_face'}, | 64 {'name': 'cull_face'}, |
73 {'name': 'depth_test', 'state_flag': 'framebuffer_state_.clear_state_dirty'}, | 65 {'name': 'depth_test', 'state_flag': 'framebuffer_state_.clear_state_dirty'}, |
74 {'name': 'dither', 'default': True}, | 66 {'name': 'dither', 'default': True}, |
75 {'name': 'polygon_offset_fill'}, | 67 {'name': 'polygon_offset_fill'}, |
76 {'name': 'sample_alpha_to_coverage'}, | 68 {'name': 'sample_alpha_to_coverage'}, |
(...skipping 7517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7594 "// OpenGL ES interface.\n", | 7586 "// OpenGL ES interface.\n", |
7595 2) | 7587 2) |
7596 | 7588 |
7597 file.Write("#include \"ppapi/c/pp_resource.h\"\n") | 7589 file.Write("#include \"ppapi/c/pp_resource.h\"\n") |
7598 if dev: | 7590 if dev: |
7599 file.Write("#include \"ppapi/c/ppb_opengles2.h\"\n\n") | 7591 file.Write("#include \"ppapi/c/ppb_opengles2.h\"\n\n") |
7600 else: | 7592 else: |
7601 file.Write("\n#ifndef __gl2_h_\n") | 7593 file.Write("\n#ifndef __gl2_h_\n") |
7602 for (k, v) in _GL_TYPES.iteritems(): | 7594 for (k, v) in _GL_TYPES.iteritems(): |
7603 file.Write("typedef %s %s;\n" % (v, k)) | 7595 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") | |
7611 file.Write("#endif // __gl2_h_\n\n") | 7596 file.Write("#endif // __gl2_h_\n\n") |
7612 | 7597 |
7613 for interface in self.pepper_interfaces: | 7598 for interface in self.pepper_interfaces: |
7614 if interface.dev != dev: | 7599 if interface.dev != dev: |
7615 continue | 7600 continue |
7616 file.Write("#define %s_1_0 \"%s;1.0\"\n" % | 7601 file.Write("#define %s_1_0 \"%s;1.0\"\n" % |
7617 (interface.GetInterfaceName(), interface.GetInterfaceString())) | 7602 (interface.GetInterfaceName(), interface.GetInterfaceString())) |
7618 file.Write("#define %s %s_1_0\n" % | 7603 file.Write("#define %s %s_1_0\n" % |
7619 (interface.GetInterfaceName(), interface.GetInterfaceName())) | 7604 (interface.GetInterfaceName(), interface.GetInterfaceName())) |
7620 | 7605 |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7853 gen.WriteGLES2Header("../GLES2/gl2chromium_autogen.h") | 7838 gen.WriteGLES2Header("../GLES2/gl2chromium_autogen.h") |
7854 | 7839 |
7855 if gen.errors > 0: | 7840 if gen.errors > 0: |
7856 print "%d errors" % gen.errors | 7841 print "%d errors" % gen.errors |
7857 return 1 | 7842 return 1 |
7858 return 0 | 7843 return 0 |
7859 | 7844 |
7860 | 7845 |
7861 if __name__ == '__main__': | 7846 if __name__ == '__main__': |
7862 sys.exit(main(sys.argv[1:])) | 7847 sys.exit(main(sys.argv[1:])) |
OLD | NEW |