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 4202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4213 """Writes the Mojo GLES2 implementation header.""" | 4213 """Writes the Mojo GLES2 implementation header.""" |
4214 file.Write("%s %s(%s) override;\n" % | 4214 file.Write("%s %s(%s) override;\n" % |
4215 (func.return_type, func.original_name, | 4215 (func.return_type, func.original_name, |
4216 func.MakeTypedOriginalArgString(""))) | 4216 func.MakeTypedOriginalArgString(""))) |
4217 | 4217 |
4218 def WriteMojoGLES2Impl(self, func, file): | 4218 def WriteMojoGLES2Impl(self, func, file): |
4219 """Writes the Mojo GLES2 implementation.""" | 4219 """Writes the Mojo GLES2 implementation.""" |
4220 file.Write("%s MojoGLES2Impl::%s(%s) {\n" % | 4220 file.Write("%s MojoGLES2Impl::%s(%s) {\n" % |
4221 (func.return_type, func.original_name, | 4221 (func.return_type, func.original_name, |
4222 func.MakeTypedOriginalArgString(""))) | 4222 func.MakeTypedOriginalArgString(""))) |
4223 # TODO(alhaad): Add Mojo C thunk for each of the following methods and | 4223 extensions = ["CHROMIUM_sync_point", "CHROMIUM_texture_mailbox", |
4224 # remove this. | 4224 "CHROMIUM_sub_image", "CHROMIUM_miscellaneous", |
4225 func_list = ["GenQueriesEXT", "BeginQueryEXT", "MapTexSubImage2DCHROMIUM", | 4225 "occlusion_query_EXT"] |
4226 "UnmapTexSubImage2DCHROMIUM", "DeleteQueriesEXT", | |
4227 "EndQueryEXT", "GetQueryObjectuivEXT", "ShallowFlushCHROMIUM"] | |
4228 if func.original_name in func_list: | |
4229 file.Write("return static_cast<gpu::gles2::GLES2Interface*>" | |
4230 "(MojoGLES2GetGLES2Interface(context_))->" + | |
4231 func.original_name + "(" + func.MakeOriginalArgString("") + | |
4232 ");") | |
4233 file.Write("}") | |
4234 return | |
4235 | |
4236 extensions = ["CHROMIUM_sync_point", "CHROMIUM_texture_mailbox"] | |
4237 if func.IsCoreGLFunction() or func.GetInfo("extension") in extensions: | 4226 if func.IsCoreGLFunction() or func.GetInfo("extension") in extensions: |
4238 file.Write("MojoGLES2MakeCurrent(context_);"); | 4227 file.Write("MojoGLES2MakeCurrent(context_);"); |
4239 func_return = "gl" + func.original_name + "(" + \ | 4228 func_return = "gl" + func.original_name + "(" + \ |
4240 func.MakeOriginalArgString("") + ");" | 4229 func.MakeOriginalArgString("") + ");" |
4241 if func.return_type == "void": | 4230 if func.return_type == "void": |
4242 file.Write(func_return); | 4231 file.Write(func_return); |
4243 else: | 4232 else: |
4244 file.Write("return " + func_return); | 4233 file.Write("return " + func_return); |
4245 else: | 4234 else: |
4246 file.Write("NOTREACHED() << \"Unimplemented %s.\";\n" % | 4235 file.Write("NOTREACHED() << \"Unimplemented %s.\";\n" % |
(...skipping 5801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10048 def WriteMojoGLES2Impl(self, filename): | 10037 def WriteMojoGLES2Impl(self, filename): |
10049 """Writes the Mojo GLES2 implementation.""" | 10038 """Writes the Mojo GLES2 implementation.""" |
10050 file = CWriter(filename) | 10039 file = CWriter(filename) |
10051 file.Write(_LICENSE) | 10040 file.Write(_LICENSE) |
10052 file.Write(_DO_NOT_EDIT_WARNING) | 10041 file.Write(_DO_NOT_EDIT_WARNING) |
10053 | 10042 |
10054 code = """ | 10043 code = """ |
10055 #include "mojo/gpu/mojo_gles2_impl_autogen.h" | 10044 #include "mojo/gpu/mojo_gles2_impl_autogen.h" |
10056 | 10045 |
10057 #include "base/logging.h" | 10046 #include "base/logging.h" |
| 10047 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_miscellaneous.h" |
| 10048 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_sub_image.h" |
10058 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_sync_point.h" | 10049 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_sync_point.h" |
10059 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_texture_mailbox.h" | 10050 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_texture_mailbox.h" |
10060 #include "third_party/mojo/src/mojo/public/c/gles2/gles2.h" | 10051 #include "third_party/mojo/src/mojo/public/c/gles2/gles2.h" |
| 10052 #include "third_party/mojo/src/mojo/public/c/gles2/occlusion_query_ext.h" |
10061 | 10053 |
10062 namespace mojo { | 10054 namespace mojo { |
10063 | 10055 |
10064 """ | 10056 """ |
10065 file.Write(code); | 10057 file.Write(code); |
10066 for func in self.original_functions: | 10058 for func in self.original_functions: |
10067 func.WriteMojoGLES2Impl(file) | 10059 func.WriteMojoGLES2Impl(file) |
10068 code = """ | 10060 code = """ |
10069 | 10061 |
10070 } // namespace mojo | 10062 } // namespace mojo |
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10660 Format(gen.generated_cpp_filenames) | 10652 Format(gen.generated_cpp_filenames) |
10661 | 10653 |
10662 if gen.errors > 0: | 10654 if gen.errors > 0: |
10663 print "%d errors" % gen.errors | 10655 print "%d errors" % gen.errors |
10664 return 1 | 10656 return 1 |
10665 return 0 | 10657 return 0 |
10666 | 10658 |
10667 | 10659 |
10668 if __name__ == '__main__': | 10660 if __name__ == '__main__': |
10669 sys.exit(main(sys.argv[1:])) | 10661 sys.exit(main(sys.argv[1:])) |
OLD | NEW |