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 1354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1365 'valid': [ | 1365 'valid': [ |
1366 'GL_GUILTY_CONTEXT_RESET_ARB', | 1366 'GL_GUILTY_CONTEXT_RESET_ARB', |
1367 'GL_INNOCENT_CONTEXT_RESET_ARB', | 1367 'GL_INNOCENT_CONTEXT_RESET_ARB', |
1368 'GL_UNKNOWN_CONTEXT_RESET_ARB', | 1368 'GL_UNKNOWN_CONTEXT_RESET_ARB', |
1369 ], | 1369 ], |
1370 }, | 1370 }, |
1371 'SyncCondition': { | 1371 'SyncCondition': { |
1372 'type': 'GLenum', | 1372 'type': 'GLenum', |
1373 'is_complete': True, | 1373 'is_complete': True, |
1374 'valid': [ | 1374 'valid': [ |
1375 #TODO(zmo): avoid using the direct number. | 1375 'GL_SYNC_GPU_COMMANDS_COMPLETE', |
1376 '0x9117', # GL_SYNC_GPU_COMMANDS_COMPLETE | |
1377 ], | 1376 ], |
1378 'invalid': [ | 1377 'invalid': [ |
1379 '0', | 1378 '0', |
1380 ], | 1379 ], |
1381 }, | 1380 }, |
1382 'SyncFlags': { | 1381 'SyncFlags': { |
1383 'type': 'GLbitfield', | 1382 'type': 'GLbitfield', |
1384 'is_complete': True, | 1383 'is_complete': True, |
1385 'valid': [ | 1384 'valid': [ |
1386 '0', | 1385 '0', |
(...skipping 7495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8882 file.Write("#undef GLES2_CMD_OP\n") | 8881 file.Write("#undef GLES2_CMD_OP\n") |
8883 file.Write(" kNumCommands\n") | 8882 file.Write(" kNumCommands\n") |
8884 file.Write("};\n") | 8883 file.Write("};\n") |
8885 file.Write("\n") | 8884 file.Write("\n") |
8886 file.Close() | 8885 file.Close() |
8887 self.generated_cpp_filenames.append(file.filename) | 8886 self.generated_cpp_filenames.append(file.filename) |
8888 | 8887 |
8889 def WriteFormat(self, filename): | 8888 def WriteFormat(self, filename): |
8890 """Writes the command buffer format""" | 8889 """Writes the command buffer format""" |
8891 file = CHeaderWriter(filename) | 8890 file = CHeaderWriter(filename) |
| 8891 # Forward declaration of a few enums used in constant argument |
| 8892 # to avoid including GL header files. |
| 8893 enum_defines = { |
| 8894 'GL_SYNC_GPU_COMMANDS_COMPLETE': 0x9117, |
| 8895 } |
| 8896 file.Write('\n') |
| 8897 for enum in enum_defines: |
| 8898 file.Write("#define %s 0x%x\n" % (enum, enum_defines[enum])) |
| 8899 file.Write('\n') |
8892 for func in self.functions: | 8900 for func in self.functions: |
8893 if True: | 8901 if True: |
8894 #gen_cmd = func.GetInfo('gen_cmd') | 8902 #gen_cmd = func.GetInfo('gen_cmd') |
8895 #if gen_cmd == True or gen_cmd == None: | 8903 #if gen_cmd == True or gen_cmd == None: |
8896 func.WriteStruct(file) | 8904 func.WriteStruct(file) |
8897 file.Write("\n") | 8905 file.Write("\n") |
8898 file.Close() | 8906 file.Close() |
8899 self.generated_cpp_filenames.append(file.filename) | 8907 self.generated_cpp_filenames.append(file.filename) |
8900 | 8908 |
8901 def WriteDocs(self, filename): | 8909 def WriteDocs(self, filename): |
(...skipping 1142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10044 Format(gen.generated_cpp_filenames) | 10052 Format(gen.generated_cpp_filenames) |
10045 | 10053 |
10046 if gen.errors > 0: | 10054 if gen.errors > 0: |
10047 print "%d errors" % gen.errors | 10055 print "%d errors" % gen.errors |
10048 return 1 | 10056 return 1 |
10049 return 0 | 10057 return 0 |
10050 | 10058 |
10051 | 10059 |
10052 if __name__ == '__main__': | 10060 if __name__ == '__main__': |
10053 sys.exit(main(sys.argv[1:])) | 10061 sys.exit(main(sys.argv[1:])) |
OLD | NEW |