| 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 4833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4844 def WriteMojoGLES2Impl(self, func, f): | 4844 def WriteMojoGLES2Impl(self, func, f): |
| 4845 """Writes the Mojo GLES2 implementation.""" | 4845 """Writes the Mojo GLES2 implementation.""" |
| 4846 f.write("%s MojoGLES2Impl::%s(%s) {\n" % | 4846 f.write("%s MojoGLES2Impl::%s(%s) {\n" % |
| 4847 (func.return_type, func.original_name, | 4847 (func.return_type, func.original_name, |
| 4848 func.MakeTypedOriginalArgString(""))) | 4848 func.MakeTypedOriginalArgString(""))) |
| 4849 extensions = ["CHROMIUM_sync_point", "CHROMIUM_texture_mailbox", | 4849 extensions = ["CHROMIUM_sync_point", "CHROMIUM_texture_mailbox", |
| 4850 "CHROMIUM_sub_image", "CHROMIUM_miscellaneous", | 4850 "CHROMIUM_sub_image", "CHROMIUM_miscellaneous", |
| 4851 "occlusion_query_EXT", "CHROMIUM_image", | 4851 "occlusion_query_EXT", "CHROMIUM_image", |
| 4852 "CHROMIUM_copy_texture", | 4852 "CHROMIUM_copy_texture", |
| 4853 "CHROMIUM_pixel_transfer_buffer_object"] | 4853 "CHROMIUM_pixel_transfer_buffer_object"] |
| 4854 if func.IsCoreGLFunction() or func.GetInfo("extension") in extensions: | 4854 if func.IsCoreGLFunction() or func.GetInfo("extension") in extensions or \ |
| 4855 func.GetInfo("extension_flag") == "chromium_framebuffer_multisample": |
| 4855 f.write("MojoGLES2MakeCurrent(context_);"); | 4856 f.write("MojoGLES2MakeCurrent(context_);"); |
| 4856 func_return = "gl" + func.original_name + "(" + \ | 4857 func_return = "gl" + func.original_name + "(" + \ |
| 4857 func.MakeOriginalArgString("") + ");" | 4858 func.MakeOriginalArgString("") + ");" |
| 4858 if func.return_type == "void": | 4859 if func.return_type == "void": |
| 4859 f.write(func_return); | 4860 f.write(func_return); |
| 4860 else: | 4861 else: |
| 4861 f.write("return " + func_return); | 4862 f.write("return " + func_return); |
| 4862 else: | 4863 else: |
| 4863 f.write("NOTREACHED() << \"Unimplemented %s.\";\n" % | 4864 f.write("NOTREACHED() << \"Unimplemented %s.\";\n" % |
| 4864 func.original_name); | 4865 func.original_name); |
| (...skipping 5566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10431 f.write(code); | 10432 f.write(code); |
| 10432 self.generated_cpp_filenames.append(filename) | 10433 self.generated_cpp_filenames.append(filename) |
| 10433 | 10434 |
| 10434 def WriteMojoGLES2Impl(self, filename): | 10435 def WriteMojoGLES2Impl(self, filename): |
| 10435 """Writes the Mojo GLES2 implementation.""" | 10436 """Writes the Mojo GLES2 implementation.""" |
| 10436 code = """ | 10437 code = """ |
| 10437 #include "mojo/gpu/mojo_gles2_impl_autogen.h" | 10438 #include "mojo/gpu/mojo_gles2_impl_autogen.h" |
| 10438 | 10439 |
| 10439 #include "base/logging.h" | 10440 #include "base/logging.h" |
| 10440 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_copy_texture.h" | 10441 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_copy_texture.h" |
| 10442 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_framebuffer_multisam
ple.h" |
| 10441 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_image.h" | 10443 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_image.h" |
| 10442 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_miscellaneous.h" | 10444 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_miscellaneous.h" |
| 10443 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_pixel_transfer_buffe
r_object.h" | 10445 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_pixel_transfer_buffe
r_object.h" |
| 10444 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_sub_image.h" | 10446 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_sub_image.h" |
| 10445 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_sync_point.h" | 10447 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_sync_point.h" |
| 10446 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_texture_mailbox.h" | 10448 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_texture_mailbox.h" |
| 10447 #include "third_party/mojo/src/mojo/public/c/gles2/gles2.h" | 10449 #include "third_party/mojo/src/mojo/public/c/gles2/gles2.h" |
| 10448 #include "third_party/mojo/src/mojo/public/c/gles2/occlusion_query_ext.h" | 10450 #include "third_party/mojo/src/mojo/public/c/gles2/occlusion_query_ext.h" |
| 10449 | 10451 |
| 10450 namespace mojo { | 10452 namespace mojo { |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10861 f.write("VISIT_GL_CALL(%s, %s, (%s), (%s))\n" % | 10863 f.write("VISIT_GL_CALL(%s, %s, (%s), (%s))\n" % |
| 10862 (func.name, func.return_type, | 10864 (func.name, func.return_type, |
| 10863 func.MakeTypedOriginalArgString(""), | 10865 func.MakeTypedOriginalArgString(""), |
| 10864 func.MakeOriginalArgString(""))) | 10866 func.MakeOriginalArgString(""))) |
| 10865 self.generated_cpp_filenames.append(filename) | 10867 self.generated_cpp_filenames.append(filename) |
| 10866 | 10868 |
| 10867 def WriteMojoGLCallVisitorForExtension(self, filename, extension): | 10869 def WriteMojoGLCallVisitorForExtension(self, filename, extension): |
| 10868 """Provides the GL implementation for mojo for a particular extension""" | 10870 """Provides the GL implementation for mojo for a particular extension""" |
| 10869 with CWriter(filename) as f: | 10871 with CWriter(filename) as f: |
| 10870 for func in self.original_functions: | 10872 for func in self.original_functions: |
| 10871 if func.GetInfo("extension") != extension: | 10873 if func.GetInfo("extension") != extension and \ |
| 10874 func.GetInfo("extension_flag") != extension: |
| 10872 continue | 10875 continue |
| 10873 f.write("VISIT_GL_CALL(%s, %s, (%s), (%s))\n" % | 10876 f.write("VISIT_GL_CALL(%s, %s, (%s), (%s))\n" % |
| 10874 (func.name, func.return_type, | 10877 (func.name, func.return_type, |
| 10875 func.MakeTypedOriginalArgString(""), | 10878 func.MakeTypedOriginalArgString(""), |
| 10876 func.MakeOriginalArgString(""))) | 10879 func.MakeOriginalArgString(""))) |
| 10877 self.generated_cpp_filenames.append(filename) | 10880 self.generated_cpp_filenames.append(filename) |
| 10878 | 10881 |
| 10879 def Format(generated_files): | 10882 def Format(generated_files): |
| 10880 formatter = "clang-format" | 10883 formatter = "clang-format" |
| 10881 if platform.system() == "Windows": | 10884 if platform.system() == "Windows": |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11005 "occlusion_query_EXT") | 11008 "occlusion_query_EXT") |
| 11006 gen.WriteMojoGLCallVisitorForExtension( | 11009 gen.WriteMojoGLCallVisitorForExtension( |
| 11007 mojo_gles2_prefix + "_chromium_image_autogen.h", | 11010 mojo_gles2_prefix + "_chromium_image_autogen.h", |
| 11008 "CHROMIUM_image") | 11011 "CHROMIUM_image") |
| 11009 gen.WriteMojoGLCallVisitorForExtension( | 11012 gen.WriteMojoGLCallVisitorForExtension( |
| 11010 mojo_gles2_prefix + "_chromium_copy_texture_autogen.h", | 11013 mojo_gles2_prefix + "_chromium_copy_texture_autogen.h", |
| 11011 "CHROMIUM_copy_texture") | 11014 "CHROMIUM_copy_texture") |
| 11012 gen.WriteMojoGLCallVisitorForExtension( | 11015 gen.WriteMojoGLCallVisitorForExtension( |
| 11013 mojo_gles2_prefix + "_chromium_pixel_transfer_buffer_object_autogen.h", | 11016 mojo_gles2_prefix + "_chromium_pixel_transfer_buffer_object_autogen.h", |
| 11014 "CHROMIUM_pixel_transfer_buffer_object") | 11017 "CHROMIUM_pixel_transfer_buffer_object") |
| 11018 gen.WriteMojoGLCallVisitorForExtension( |
| 11019 mojo_gles2_prefix + "_chromium_framebuffer_multisample_autogen.h", |
| 11020 "chromium_framebuffer_multisample") |
| 11015 | 11021 |
| 11016 Format(gen.generated_cpp_filenames) | 11022 Format(gen.generated_cpp_filenames) |
| 11017 | 11023 |
| 11018 if gen.errors > 0: | 11024 if gen.errors > 0: |
| 11019 print "%d errors" % gen.errors | 11025 print "%d errors" % gen.errors |
| 11020 return 1 | 11026 return 1 |
| 11021 return 0 | 11027 return 0 |
| 11022 | 11028 |
| 11023 | 11029 |
| 11024 if __name__ == '__main__': | 11030 if __name__ == '__main__': |
| 11025 sys.exit(main(sys.argv[1:])) | 11031 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |