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 2183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2194 'trace_level': 2, | 2194 'trace_level': 2, |
2195 }, | 2195 }, |
2196 'BindTransformFeedback': { | 2196 'BindTransformFeedback': { |
2197 'type': 'Bind', | 2197 'type': 'Bind', |
2198 'id_mapping': [ 'TransformFeedback' ], | 2198 'id_mapping': [ 'TransformFeedback' ], |
2199 'unsafe': True, | 2199 'unsafe': True, |
2200 }, | 2200 }, |
2201 'BlitFramebufferCHROMIUM': { | 2201 'BlitFramebufferCHROMIUM': { |
2202 'decoder_func': 'DoBlitFramebufferCHROMIUM', | 2202 'decoder_func': 'DoBlitFramebufferCHROMIUM', |
2203 'unit_test': False, | 2203 'unit_test': False, |
2204 'extension': 'chromium_framebuffer_multisample', | |
2205 'extension_flag': 'chromium_framebuffer_multisample', | 2204 'extension_flag': 'chromium_framebuffer_multisample', |
2206 'pepper_interface': 'FramebufferBlit', | 2205 'pepper_interface': 'FramebufferBlit', |
2207 'pepper_name': 'BlitFramebufferEXT', | 2206 'pepper_name': 'BlitFramebufferEXT', |
2208 'defer_reads': True, | 2207 'defer_reads': True, |
2209 'defer_draws': True, | 2208 'defer_draws': True, |
2210 'trace_level': 1, | 2209 'trace_level': 1, |
2211 }, | 2210 }, |
2212 'BufferData': { | 2211 'BufferData': { |
2213 'type': 'Manual', | 2212 'type': 'Manual', |
2214 'data_transfer_methods': ['shm'], | 2213 'data_transfer_methods': ['shm'], |
(...skipping 1046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3261 'expectation': False, | 3260 'expectation': False, |
3262 'trace_level': 1, | 3261 'trace_level': 1, |
3263 }, | 3262 }, |
3264 'RenderbufferStorageMultisampleCHROMIUM': { | 3263 'RenderbufferStorageMultisampleCHROMIUM': { |
3265 'cmd_comment': | 3264 'cmd_comment': |
3266 '// GL_CHROMIUM_framebuffer_multisample\n', | 3265 '// GL_CHROMIUM_framebuffer_multisample\n', |
3267 'decoder_func': 'DoRenderbufferStorageMultisampleCHROMIUM', | 3266 'decoder_func': 'DoRenderbufferStorageMultisampleCHROMIUM', |
3268 'gl_test_func': 'glRenderbufferStorageMultisampleCHROMIUM', | 3267 'gl_test_func': 'glRenderbufferStorageMultisampleCHROMIUM', |
3269 'expectation': False, | 3268 'expectation': False, |
3270 'unit_test': False, | 3269 'unit_test': False, |
3271 'extension': 'chromium_framebuffer_multisample', | |
3272 'extension_flag': 'chromium_framebuffer_multisample', | 3270 'extension_flag': 'chromium_framebuffer_multisample', |
3273 'pepper_interface': 'FramebufferMultisample', | 3271 'pepper_interface': 'FramebufferMultisample', |
3274 'pepper_name': 'RenderbufferStorageMultisampleEXT', | 3272 'pepper_name': 'RenderbufferStorageMultisampleEXT', |
3275 'trace_level': 1, | 3273 'trace_level': 1, |
3276 }, | 3274 }, |
3277 'RenderbufferStorageMultisampleEXT': { | 3275 'RenderbufferStorageMultisampleEXT': { |
3278 'cmd_comment': | 3276 'cmd_comment': |
3279 '// GL_EXT_multisampled_render_to_texture\n', | 3277 '// GL_EXT_multisampled_render_to_texture\n', |
3280 'decoder_func': 'DoRenderbufferStorageMultisampleEXT', | 3278 'decoder_func': 'DoRenderbufferStorageMultisampleEXT', |
3281 'gl_test_func': 'glRenderbufferStorageMultisampleEXT', | 3279 'gl_test_func': 'glRenderbufferStorageMultisampleEXT', |
(...skipping 1587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4869 | 4867 |
4870 def WriteMojoGLES2Impl(self, func, f): | 4868 def WriteMojoGLES2Impl(self, func, f): |
4871 """Writes the Mojo GLES2 implementation.""" | 4869 """Writes the Mojo GLES2 implementation.""" |
4872 f.write("%s MojoGLES2Impl::%s(%s) {\n" % | 4870 f.write("%s MojoGLES2Impl::%s(%s) {\n" % |
4873 (func.return_type, func.original_name, | 4871 (func.return_type, func.original_name, |
4874 func.MakeTypedOriginalArgString(""))) | 4872 func.MakeTypedOriginalArgString(""))) |
4875 extensions = ["CHROMIUM_sync_point", "CHROMIUM_texture_mailbox", | 4873 extensions = ["CHROMIUM_sync_point", "CHROMIUM_texture_mailbox", |
4876 "CHROMIUM_sub_image", "CHROMIUM_miscellaneous", | 4874 "CHROMIUM_sub_image", "CHROMIUM_miscellaneous", |
4877 "occlusion_query_EXT", "CHROMIUM_image", | 4875 "occlusion_query_EXT", "CHROMIUM_image", |
4878 "CHROMIUM_copy_texture", | 4876 "CHROMIUM_copy_texture", |
4879 "CHROMIUM_pixel_transfer_buffer_object", | 4877 "CHROMIUM_pixel_transfer_buffer_object"] |
4880 "chromium_framebuffer_multisample"] | |
4881 if func.IsCoreGLFunction() or func.GetInfo("extension") in extensions: | 4878 if func.IsCoreGLFunction() or func.GetInfo("extension") in extensions: |
4882 f.write("MojoGLES2MakeCurrent(context_);"); | 4879 f.write("MojoGLES2MakeCurrent(context_);"); |
4883 func_return = "gl" + func.original_name + "(" + \ | 4880 func_return = "gl" + func.original_name + "(" + \ |
4884 func.MakeOriginalArgString("") + ");" | 4881 func.MakeOriginalArgString("") + ");" |
4885 if func.return_type == "void": | 4882 if func.return_type == "void": |
4886 f.write(func_return); | 4883 f.write(func_return); |
4887 else: | 4884 else: |
4888 f.write("return " + func_return); | 4885 f.write("return " + func_return); |
4889 else: | 4886 else: |
4890 f.write("NOTREACHED() << \"Unimplemented %s.\";\n" % | 4887 f.write("NOTREACHED() << \"Unimplemented %s.\";\n" % |
(...skipping 5561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10452 f.write(code); | 10449 f.write(code); |
10453 self.generated_cpp_filenames.append(filename) | 10450 self.generated_cpp_filenames.append(filename) |
10454 | 10451 |
10455 def WriteMojoGLES2Impl(self, filename): | 10452 def WriteMojoGLES2Impl(self, filename): |
10456 """Writes the Mojo GLES2 implementation.""" | 10453 """Writes the Mojo GLES2 implementation.""" |
10457 code = """ | 10454 code = """ |
10458 #include "mojo/gpu/mojo_gles2_impl_autogen.h" | 10455 #include "mojo/gpu/mojo_gles2_impl_autogen.h" |
10459 | 10456 |
10460 #include "base/logging.h" | 10457 #include "base/logging.h" |
10461 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_copy_texture.h" | 10458 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_copy_texture.h" |
10462 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_framebuffer_multisam
ple.h" | |
10463 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_image.h" | 10459 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_image.h" |
10464 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_miscellaneous.h" | 10460 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_miscellaneous.h" |
10465 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_pixel_transfer_buffe
r_object.h" | 10461 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_pixel_transfer_buffe
r_object.h" |
10466 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_sub_image.h" | 10462 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_sub_image.h" |
10467 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_sync_point.h" | 10463 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_sync_point.h" |
10468 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_texture_mailbox.h" | 10464 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_texture_mailbox.h" |
10469 #include "third_party/mojo/src/mojo/public/c/gles2/gles2.h" | 10465 #include "third_party/mojo/src/mojo/public/c/gles2/gles2.h" |
10470 #include "third_party/mojo/src/mojo/public/c/gles2/occlusion_query_ext.h" | 10466 #include "third_party/mojo/src/mojo/public/c/gles2/occlusion_query_ext.h" |
10471 | 10467 |
10472 namespace mojo { | 10468 namespace mojo { |
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11027 "occlusion_query_EXT") | 11023 "occlusion_query_EXT") |
11028 gen.WriteMojoGLCallVisitorForExtension( | 11024 gen.WriteMojoGLCallVisitorForExtension( |
11029 mojo_gles2_prefix + "_chromium_image_autogen.h", | 11025 mojo_gles2_prefix + "_chromium_image_autogen.h", |
11030 "CHROMIUM_image") | 11026 "CHROMIUM_image") |
11031 gen.WriteMojoGLCallVisitorForExtension( | 11027 gen.WriteMojoGLCallVisitorForExtension( |
11032 mojo_gles2_prefix + "_chromium_copy_texture_autogen.h", | 11028 mojo_gles2_prefix + "_chromium_copy_texture_autogen.h", |
11033 "CHROMIUM_copy_texture") | 11029 "CHROMIUM_copy_texture") |
11034 gen.WriteMojoGLCallVisitorForExtension( | 11030 gen.WriteMojoGLCallVisitorForExtension( |
11035 mojo_gles2_prefix + "_chromium_pixel_transfer_buffer_object_autogen.h", | 11031 mojo_gles2_prefix + "_chromium_pixel_transfer_buffer_object_autogen.h", |
11036 "CHROMIUM_pixel_transfer_buffer_object") | 11032 "CHROMIUM_pixel_transfer_buffer_object") |
11037 gen.WriteMojoGLCallVisitorForExtension( | |
11038 mojo_gles2_prefix + "_chromium_framebuffer_multisample_autogen.h", | |
11039 "chromium_framebuffer_multisample") | |
11040 | 11033 |
11041 Format(gen.generated_cpp_filenames) | 11034 Format(gen.generated_cpp_filenames) |
11042 | 11035 |
11043 if gen.errors > 0: | 11036 if gen.errors > 0: |
11044 print "%d errors" % gen.errors | 11037 print "%d errors" % gen.errors |
11045 return 1 | 11038 return 1 |
11046 return 0 | 11039 return 0 |
11047 | 11040 |
11048 | 11041 |
11049 if __name__ == '__main__': | 11042 if __name__ == '__main__': |
11050 sys.exit(main(sys.argv[1:])) | 11043 sys.exit(main(sys.argv[1:])) |
OLD | NEW |