| 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 10522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10533 for func in self.original_functions: | 10533 for func in self.original_functions: |
| 10534 func.WriteGLES2InterfaceHeader(f) | 10534 func.WriteGLES2InterfaceHeader(f) |
| 10535 self.generated_cpp_filenames.append(filename) | 10535 self.generated_cpp_filenames.append(filename) |
| 10536 | 10536 |
| 10537 def WriteMojoGLES2ImplHeader(self, filename): | 10537 def WriteMojoGLES2ImplHeader(self, filename): |
| 10538 """Writes the Mojo GLES2 implementation header.""" | 10538 """Writes the Mojo GLES2 implementation header.""" |
| 10539 comment = ("// This file is included by gles2_interface.h to declare the\n" | 10539 comment = ("// This file is included by gles2_interface.h to declare the\n" |
| 10540 "// GL api functions.\n") | 10540 "// GL api functions.\n") |
| 10541 code = """ | 10541 code = """ |
| 10542 #include "gpu/command_buffer/client/gles2_interface.h" | 10542 #include "gpu/command_buffer/client/gles2_interface.h" |
| 10543 #include "third_party/mojo/src/mojo/public/c/gles2/gles2.h" | 10543 #include "mojo/public/c/gles2/gles2.h" |
| 10544 | 10544 |
| 10545 namespace mojo { | 10545 namespace mojo { |
| 10546 | 10546 |
| 10547 class MojoGLES2Impl : public gpu::gles2::GLES2Interface { | 10547 class MojoGLES2Impl : public gpu::gles2::GLES2Interface { |
| 10548 public: | 10548 public: |
| 10549 explicit MojoGLES2Impl(MojoGLES2Context context) { | 10549 explicit MojoGLES2Impl(MojoGLES2Context context) { |
| 10550 context_ = context; | 10550 context_ = context; |
| 10551 } | 10551 } |
| 10552 ~MojoGLES2Impl() override {} | 10552 ~MojoGLES2Impl() override {} |
| 10553 """ | 10553 """ |
| (...skipping 10 matching lines...) Expand all Loading... |
| 10564 """ | 10564 """ |
| 10565 f.write(code); | 10565 f.write(code); |
| 10566 self.generated_cpp_filenames.append(filename) | 10566 self.generated_cpp_filenames.append(filename) |
| 10567 | 10567 |
| 10568 def WriteMojoGLES2Impl(self, filename): | 10568 def WriteMojoGLES2Impl(self, filename): |
| 10569 """Writes the Mojo GLES2 implementation.""" | 10569 """Writes the Mojo GLES2 implementation.""" |
| 10570 code = """ | 10570 code = """ |
| 10571 #include "mojo/gpu/mojo_gles2_impl_autogen.h" | 10571 #include "mojo/gpu/mojo_gles2_impl_autogen.h" |
| 10572 | 10572 |
| 10573 #include "base/logging.h" | 10573 #include "base/logging.h" |
| 10574 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_extension.h" | 10574 #include "mojo/public/c/gles2/chromium_extension.h" |
| 10575 #include "third_party/mojo/src/mojo/public/c/gles2/gles2.h" | 10575 #include "mojo/public/c/gles2/gles2.h" |
| 10576 | 10576 |
| 10577 namespace mojo { | 10577 namespace mojo { |
| 10578 | 10578 |
| 10579 """ | 10579 """ |
| 10580 with CWriter(filename) as f: | 10580 with CWriter(filename) as f: |
| 10581 f.write(code); | 10581 f.write(code); |
| 10582 for func in self.original_functions: | 10582 for func in self.original_functions: |
| 10583 func.WriteMojoGLES2Impl(f) | 10583 func.WriteMojoGLES2Impl(f) |
| 10584 code = """ | 10584 code = """ |
| 10585 | 10585 |
| (...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11107 gen.WriteServiceUtilsHeader( | 11107 gen.WriteServiceUtilsHeader( |
| 11108 "gpu/command_buffer/service/gles2_cmd_validation_autogen.h") | 11108 "gpu/command_buffer/service/gles2_cmd_validation_autogen.h") |
| 11109 gen.WriteServiceUtilsImplementation( | 11109 gen.WriteServiceUtilsImplementation( |
| 11110 "gpu/command_buffer/service/" | 11110 "gpu/command_buffer/service/" |
| 11111 "gles2_cmd_validation_implementation_autogen.h") | 11111 "gles2_cmd_validation_implementation_autogen.h") |
| 11112 gen.WriteCommonUtilsHeader( | 11112 gen.WriteCommonUtilsHeader( |
| 11113 "gpu/command_buffer/common/gles2_cmd_utils_autogen.h") | 11113 "gpu/command_buffer/common/gles2_cmd_utils_autogen.h") |
| 11114 gen.WriteCommonUtilsImpl( | 11114 gen.WriteCommonUtilsImpl( |
| 11115 "gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h") | 11115 "gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h") |
| 11116 gen.WriteGLES2Header("gpu/GLES2/gl2chromium_autogen.h") | 11116 gen.WriteGLES2Header("gpu/GLES2/gl2chromium_autogen.h") |
| 11117 mojo_gles2_prefix = ("third_party/mojo/src/mojo/public/c/gles2/" | 11117 mojo_gles2_prefix = ("mojo/public/c/gles2/gles2_call_visitor") |
| 11118 "gles2_call_visitor") | |
| 11119 gen.WriteMojoGLCallVisitor(mojo_gles2_prefix + "_autogen.h") | 11118 gen.WriteMojoGLCallVisitor(mojo_gles2_prefix + "_autogen.h") |
| 11120 gen.WriteMojoGLCallVisitorForExtension( | 11119 gen.WriteMojoGLCallVisitorForExtension( |
| 11121 mojo_gles2_prefix + "_chromium_extension_autogen.h") | 11120 mojo_gles2_prefix + "_chromium_extension_autogen.h") |
| 11122 | 11121 |
| 11123 Format(gen.generated_cpp_filenames) | 11122 Format(gen.generated_cpp_filenames) |
| 11124 | 11123 |
| 11125 if gen.errors > 0: | 11124 if gen.errors > 0: |
| 11126 print "%d errors" % gen.errors | 11125 print "%d errors" % gen.errors |
| 11127 return 1 | 11126 return 1 |
| 11128 return 0 | 11127 return 0 |
| 11129 | 11128 |
| 11130 | 11129 |
| 11131 if __name__ == '__main__': | 11130 if __name__ == '__main__': |
| 11132 sys.exit(main(sys.argv[1:])) | 11131 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |