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 GLES2 command buffers.""" | 7 """code generator for GLES2 command buffers.""" |
8 | 8 |
9 import os | 9 import os |
10 import os.path | 10 import os.path |
(...skipping 5382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5393 help="generates files that are generally hand edited..") | 5393 help="generates files that are generally hand edited..") |
5394 parser.add_option( | 5394 parser.add_option( |
5395 "--generate-command-id-tests", action="store_true", | 5395 "--generate-command-id-tests", action="store_true", |
5396 help="generate tests for commands ids. Commands MUST not change ID!") | 5396 help="generate tests for commands ids. Commands MUST not change ID!") |
5397 parser.add_option( | 5397 parser.add_option( |
5398 "--generate-docs", action="store_true", | 5398 "--generate-docs", action="store_true", |
5399 help="generate a docs friendly version of the command formats.") | 5399 help="generate a docs friendly version of the command formats.") |
5400 parser.add_option( | 5400 parser.add_option( |
5401 "--alternate-mode", type="choice", | 5401 "--alternate-mode", type="choice", |
5402 choices=("ppapi", "chrome_ppapi"), | 5402 choices=("ppapi", "chrome_ppapi"), |
5403 help="generate files for other projects. \"ppapi\" must be run from the " | 5403 help="generate files for other projects. \"ppapi\" will generate ppapi " |
5404 "directory containing the ppapi directory, and will generate ppapi " | 5404 "bindings. \"chrome_ppapi\" generate chrome implementation for ppapi.") |
5405 "bindings. \"chrome_ppapi\" must be run from chrome src directory and " | 5405 parser.add_option( |
5406 "will generate chrome plumbing for ppapi.") | 5406 "--output-dir", |
| 5407 help="base directory for resulting files, under chrome/src. default is " |
| 5408 "empty. Use this if you want the result stored under gen.") |
5407 parser.add_option( | 5409 parser.add_option( |
5408 "-v", "--verbose", action="store_true", | 5410 "-v", "--verbose", action="store_true", |
5409 help="prints more output.") | 5411 help="prints more output.") |
5410 | 5412 |
5411 (options, args) = parser.parse_args(args=argv) | 5413 (options, args) = parser.parse_args(args=argv) |
5412 | 5414 |
| 5415 # This script lives under gpu/command_buffer, cd to base directory. |
| 5416 os.chdir(os.path.dirname(__file__) + "/../..") |
| 5417 |
5413 gen = GLGenerator(options.verbose) | 5418 gen = GLGenerator(options.verbose) |
5414 gen.ParseGLH("common/GLES2/gl2.h") | 5419 gen.ParseGLH("common/GLES2/gl2.h") |
5415 | 5420 |
| 5421 # Support generating files under gen/ |
| 5422 if options.output_dir != None: |
| 5423 os.chdir(options.output_dir) |
| 5424 |
5416 if options.alternate_mode == "ppapi": | 5425 if options.alternate_mode == "ppapi": |
5417 gen.WritePepperGLES2Interface("ppapi/c/dev/ppb_opengles_dev.h") | 5426 # To trigger this action, do "make ppapi_gles_bindings" |
5418 gen.WriteGLES2ToPPAPIBridge("ppapi/lib/gl/gles2/gles2.c") | 5427 os.chdir("ppapi"); |
| 5428 gen.WritePepperGLES2Interface("c/dev/ppb_opengles_dev.h") |
| 5429 gen.WriteGLES2ToPPAPIBridge("lib/gl/gles2/gles2.c") |
5419 | 5430 |
5420 elif options.alternate_mode == "chrome_ppapi": | 5431 elif options.alternate_mode == "chrome_ppapi": |
| 5432 # To trigger this action, do "make ppapi_gles_implementation" |
5421 gen.WritePepperGLES2Implementation( | 5433 gen.WritePepperGLES2Implementation( |
5422 "webkit/plugins/ppapi/ppb_opengles_impl.cc") | 5434 "webkit/plugins/ppapi/ppb_opengles_impl.cc") |
5423 | 5435 |
5424 else: | 5436 else: |
| 5437 os.chdir("gpu/command_buffer") |
5425 gen.WriteCommandIds("common/gles2_cmd_ids_autogen.h") | 5438 gen.WriteCommandIds("common/gles2_cmd_ids_autogen.h") |
5426 gen.WriteFormat("common/gles2_cmd_format_autogen.h") | 5439 gen.WriteFormat("common/gles2_cmd_format_autogen.h") |
5427 gen.WriteFormatTest("common/gles2_cmd_format_test_autogen.h") | 5440 gen.WriteFormatTest("common/gles2_cmd_format_test_autogen.h") |
5428 gen.WriteGLES2ImplementationHeader("client/gles2_implementation_autogen.h") | 5441 gen.WriteGLES2ImplementationHeader("client/gles2_implementation_autogen.h") |
5429 gen.WriteGLES2CLibImplementation("client/gles2_c_lib_autogen.h") | 5442 gen.WriteGLES2CLibImplementation("client/gles2_c_lib_autogen.h") |
5430 gen.WriteCmdHelperHeader("client/gles2_cmd_helper_autogen.h") | 5443 gen.WriteCmdHelperHeader("client/gles2_cmd_helper_autogen.h") |
5431 gen.WriteServiceImplementation("service/gles2_cmd_decoder_autogen.h") | 5444 gen.WriteServiceImplementation("service/gles2_cmd_decoder_autogen.h") |
5432 gen.WriteServiceUnitTests("service/gles2_cmd_decoder_unittest_%d_autogen.h") | 5445 gen.WriteServiceUnitTests("service/gles2_cmd_decoder_unittest_%d_autogen.h") |
5433 gen.WriteServiceUtilsHeader("service/gles2_cmd_validation_autogen.h") | 5446 gen.WriteServiceUtilsHeader("service/gles2_cmd_validation_autogen.h") |
5434 gen.WriteServiceUtilsImplementation( | 5447 gen.WriteServiceUtilsImplementation( |
5435 "service/gles2_cmd_validation_implementation_autogen.h") | 5448 "service/gles2_cmd_validation_implementation_autogen.h") |
5436 | 5449 |
5437 if options.generate_command_id_tests: | 5450 if options.generate_command_id_tests: |
5438 gen.WriteCommandIdTest("common/gles2_cmd_id_test_autogen.h") | 5451 gen.WriteCommandIdTest("common/gles2_cmd_id_test_autogen.h") |
5439 | 5452 |
5440 if options.generate_docs: | 5453 if options.generate_docs: |
5441 gen.WriteDocs("docs/gles2_cmd_format_docs_autogen.h") | 5454 gen.WriteDocs("docs/gles2_cmd_format_docs_autogen.h") |
5442 | 5455 |
5443 if gen.errors > 0: | 5456 if gen.errors > 0: |
5444 print "%d errors" % gen.errors | 5457 print "%d errors" % gen.errors |
5445 sys.exit(1) | 5458 sys.exit(1) |
5446 | 5459 |
5447 if __name__ == '__main__': | 5460 if __name__ == '__main__': |
5448 main(sys.argv[1:]) | 5461 main(sys.argv[1:]) |
OLD | NEW |