OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # | 2 # |
3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2011 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 5465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5476 "--generate-docs", action="store_true", | 5476 "--generate-docs", action="store_true", |
5477 help="generate a docs friendly version of the command formats.") | 5477 help="generate a docs friendly version of the command formats.") |
5478 parser.add_option( | 5478 parser.add_option( |
5479 "--alternate-mode", type="choice", | 5479 "--alternate-mode", type="choice", |
5480 choices=("ppapi", "chrome_ppapi", "chrome_ppapi_proxy"), | 5480 choices=("ppapi", "chrome_ppapi", "chrome_ppapi_proxy"), |
5481 help="generate files for other projects. \"ppapi\" will generate ppapi " | 5481 help="generate files for other projects. \"ppapi\" will generate ppapi " |
5482 "bindings. \"chrome_ppapi\" generate chrome implementation for ppapi. " | 5482 "bindings. \"chrome_ppapi\" generate chrome implementation for ppapi. " |
5483 "\"chrome_ppapi_proxy\" will generate the glue for the chrome IPC ppapi" | 5483 "\"chrome_ppapi_proxy\" will generate the glue for the chrome IPC ppapi" |
5484 "proxy.") | 5484 "proxy.") |
5485 parser.add_option( | 5485 parser.add_option( |
5486 "--output-dir", | |
5487 help="base directory for resulting files, under chrome/src. default is " | |
5488 "empty. Use this if you want the result stored under gen.") | |
5489 parser.add_option( | |
5490 "-v", "--verbose", action="store_true", | 5486 "-v", "--verbose", action="store_true", |
5491 help="prints more output.") | 5487 help="prints more output.") |
5492 | 5488 |
5493 (options, args) = parser.parse_args(args=argv) | 5489 (options, args) = parser.parse_args(args=argv) |
5494 | 5490 |
5495 # This script lives under gpu/command_buffer, cd to base directory. | |
5496 os.chdir(os.path.dirname(__file__) + "/../..") | |
5497 | |
5498 gen = GLGenerator(options.verbose) | 5491 gen = GLGenerator(options.verbose) |
5499 gen.ParseGLH("common/GLES2/gl2.h") | 5492 gen.ParseGLH("common/GLES2/gl2.h") |
5500 | 5493 |
5501 # Support generating files under gen/ | |
5502 if options.output_dir != None: | |
5503 os.chdir(options.output_dir) | |
5504 | |
5505 if options.alternate_mode == "ppapi": | 5494 if options.alternate_mode == "ppapi": |
5506 # To trigger this action, do "make ppapi_gles_bindings" | 5495 gen.WritePepperGLES2Interface("ppapi/c/dev/ppb_opengles_dev.h") |
5507 os.chdir("ppapi"); | 5496 gen.WriteGLES2ToPPAPIBridge("ppapi/lib/gl/gles2/gles2.c") |
5508 gen.WritePepperGLES2Interface("c/dev/ppb_opengles_dev.h") | |
5509 gen.WriteGLES2ToPPAPIBridge("lib/gl/gles2/gles2.c") | |
5510 | 5497 |
5511 elif options.alternate_mode == "chrome_ppapi": | 5498 elif options.alternate_mode == "chrome_ppapi": |
5512 # To trigger this action, do "make ppapi_gles_implementation" | |
5513 gen.WritePepperGLES2Implementation( | 5499 gen.WritePepperGLES2Implementation( |
5514 "webkit/plugins/ppapi/ppb_opengles_impl.cc") | 5500 "webkit/plugins/ppapi/ppb_opengles_impl.cc") |
5515 | 5501 |
5516 elif options.alternate_mode == "chrome_ppapi_proxy": | 5502 elif options.alternate_mode == "chrome_ppapi_proxy": |
5517 gen.WritePepperGLES2ProxyImplementation( | 5503 gen.WritePepperGLES2ProxyImplementation( |
5518 "ppapi/proxy/ppb_opengles2_proxy.cc") | 5504 "ppapi/proxy/ppb_opengles2_proxy.cc") |
5519 | 5505 |
5520 else: | 5506 else: |
5521 os.chdir("gpu/command_buffer") | |
5522 gen.WriteCommandIds("common/gles2_cmd_ids_autogen.h") | 5507 gen.WriteCommandIds("common/gles2_cmd_ids_autogen.h") |
5523 gen.WriteFormat("common/gles2_cmd_format_autogen.h") | 5508 gen.WriteFormat("common/gles2_cmd_format_autogen.h") |
5524 gen.WriteFormatTest("common/gles2_cmd_format_test_autogen.h") | 5509 gen.WriteFormatTest("common/gles2_cmd_format_test_autogen.h") |
5525 gen.WriteGLES2ImplementationHeader("client/gles2_implementation_autogen.h") | 5510 gen.WriteGLES2ImplementationHeader("client/gles2_implementation_autogen.h") |
5526 gen.WriteGLES2CLibImplementation("client/gles2_c_lib_autogen.h") | 5511 gen.WriteGLES2CLibImplementation("client/gles2_c_lib_autogen.h") |
5527 gen.WriteCmdHelperHeader("client/gles2_cmd_helper_autogen.h") | 5512 gen.WriteCmdHelperHeader("client/gles2_cmd_helper_autogen.h") |
5528 gen.WriteServiceImplementation("service/gles2_cmd_decoder_autogen.h") | 5513 gen.WriteServiceImplementation("service/gles2_cmd_decoder_autogen.h") |
5529 gen.WriteServiceUnitTests("service/gles2_cmd_decoder_unittest_%d_autogen.h") | 5514 gen.WriteServiceUnitTests("service/gles2_cmd_decoder_unittest_%d_autogen.h") |
5530 gen.WriteServiceUtilsHeader("service/gles2_cmd_validation_autogen.h") | 5515 gen.WriteServiceUtilsHeader("service/gles2_cmd_validation_autogen.h") |
5531 gen.WriteServiceUtilsImplementation( | 5516 gen.WriteServiceUtilsImplementation( |
5532 "service/gles2_cmd_validation_implementation_autogen.h") | 5517 "service/gles2_cmd_validation_implementation_autogen.h") |
5533 | 5518 |
5534 if options.generate_command_id_tests: | 5519 if options.generate_command_id_tests: |
5535 gen.WriteCommandIdTest("common/gles2_cmd_id_test_autogen.h") | 5520 gen.WriteCommandIdTest("common/gles2_cmd_id_test_autogen.h") |
5536 | 5521 |
5537 if options.generate_docs: | 5522 if options.generate_docs: |
5538 gen.WriteDocs("docs/gles2_cmd_format_docs_autogen.h") | 5523 gen.WriteDocs("docs/gles2_cmd_format_docs_autogen.h") |
5539 | 5524 |
5540 if gen.errors > 0: | 5525 if gen.errors > 0: |
5541 print "%d errors" % gen.errors | 5526 print "%d errors" % gen.errors |
5542 sys.exit(1) | 5527 sys.exit(1) |
5543 | 5528 |
5544 if __name__ == '__main__': | 5529 if __name__ == '__main__': |
5545 main(sys.argv[1:]) | 5530 main(sys.argv[1:]) |
OLD | NEW |