| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # | 2 # |
| 3 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 """code generator for GL command buffers.""" | 7 """code generator for GL command buffers.""" |
| 8 | 8 |
| 9 import os | 9 import os |
| 10 import os.path | 10 import os.path |
| 11 import sys | 11 import sys |
| 12 import re | 12 import re |
| 13 from optparse import OptionParser | 13 from optparse import OptionParser |
| 14 | 14 |
| 15 _SIZE_OF_UINT32 = 4 | 15 _SIZE_OF_UINT32 = 4 |
| 16 _SIZE_OF_COMMAND_HEADER = 4 | 16 _SIZE_OF_COMMAND_HEADER = 4 |
| 17 _FIRST_SPECIFIC_COMMAND_ID = 1024 | 17 _FIRST_SPECIFIC_COMMAND_ID = 256 |
| 18 | 18 |
| 19 _LICENSE = """ | 19 _LICENSE = """ |
| 20 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 20 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 21 // Use of this source code is governed by a BSD-style license that can be | 21 // Use of this source code is governed by a BSD-style license that can be |
| 22 // found in the LICENSE file. | 22 // found in the LICENSE file. |
| 23 | 23 |
| 24 """ | 24 """ |
| 25 | 25 |
| 26 # This string is copied directly out of the gl2.h file from GLES2.0 | 26 # This string is copied directly out of the gl2.h file from GLES2.0 |
| 27 # the reasons it is copied out instead of parsed directly are | 27 # the reasons it is copied out instead of parsed directly are |
| (...skipping 2518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2546 file.Write("\n") | 2546 file.Write("\n") |
| 2547 file.Write("#include \"tests/common/win/testing_common.h\"\n") | 2547 file.Write("#include \"tests/common/win/testing_common.h\"\n") |
| 2548 file.Write("#include \"gpu/command_buffer/common/gles2_cmd_format.h\"\n") | 2548 file.Write("#include \"gpu/command_buffer/common/gles2_cmd_format.h\"\n") |
| 2549 file.Write("\n") | 2549 file.Write("\n") |
| 2550 | 2550 |
| 2551 self.WriteNamespaceOpen(file) | 2551 self.WriteNamespaceOpen(file) |
| 2552 | 2552 |
| 2553 file.Write("// *** These IDs MUST NOT CHANGE!!! ***\n") | 2553 file.Write("// *** These IDs MUST NOT CHANGE!!! ***\n") |
| 2554 file.Write("// Changing them will break all client programs.\n") | 2554 file.Write("// Changing them will break all client programs.\n") |
| 2555 file.Write("TEST(GLES2CommandIdTest, CommandIdsMatch) {\n") | 2555 file.Write("TEST(GLES2CommandIdTest, CommandIdsMatch) {\n") |
| 2556 command_id = 1024 | 2556 command_id = _FIRST_SPECIFIC_COMMAND_ID |
| 2557 for func in self.functions: | 2557 for func in self.functions: |
| 2558 file.Write(" COMPILE_ASSERT(%s::kCmdId == %d,\n" % | 2558 file.Write(" COMPILE_ASSERT(%s::kCmdId == %d,\n" % |
| 2559 (func.name, command_id)) | 2559 (func.name, command_id)) |
| 2560 file.Write(" GLES2_%s_kCmdId_mismatch);\n" % func.name) | 2560 file.Write(" GLES2_%s_kCmdId_mismatch);\n" % func.name) |
| 2561 command_id += 1 | 2561 command_id += 1 |
| 2562 | 2562 |
| 2563 file.Write("}\n") | 2563 file.Write("}\n") |
| 2564 | 2564 |
| 2565 self.WriteNamespaceClose(file) | 2565 self.WriteNamespaceClose(file) |
| 2566 | 2566 |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2692 gen.WriteGLES2ImplementationImpl("client/gles2_implementation_gen.h") | 2692 gen.WriteGLES2ImplementationImpl("client/gles2_implementation_gen.h") |
| 2693 gen.WriteServiceValidation("service/gles2_cmd_decoder_validate.h") | 2693 gen.WriteServiceValidation("service/gles2_cmd_decoder_validate.h") |
| 2694 | 2694 |
| 2695 if options.generate_command_id_tests: | 2695 if options.generate_command_id_tests: |
| 2696 gen.WriteCommandIdTest("common/gles2_cmd_id_test.cc") | 2696 gen.WriteCommandIdTest("common/gles2_cmd_id_test.cc") |
| 2697 | 2697 |
| 2698 | 2698 |
| 2699 if __name__ == '__main__': | 2699 if __name__ == '__main__': |
| 2700 main(sys.argv[1:]) | 2700 main(sys.argv[1:]) |
| 2701 | 2701 |
| OLD | NEW |