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 2291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2302 }, | 2302 }, |
2303 'CreateImageCHROMIUM': { | 2303 'CreateImageCHROMIUM': { |
2304 'type': 'Manual', | 2304 'type': 'Manual', |
2305 'cmd_args': | 2305 'cmd_args': |
2306 'ClientBuffer buffer, GLsizei width, GLsizei height, ' | 2306 'ClientBuffer buffer, GLsizei width, GLsizei height, ' |
2307 'GLenum internalformat', | 2307 'GLenum internalformat', |
2308 'result': ['GLuint'], | 2308 'result': ['GLuint'], |
2309 'client_test': False, | 2309 'client_test': False, |
2310 'gen_cmd': False, | 2310 'gen_cmd': False, |
2311 'expectation': False, | 2311 'expectation': False, |
2312 'extension': True, | 2312 'extension': "CHROMIUM_image", |
2313 'chromium': True, | 2313 'chromium': True, |
2314 'trace_level': 1, | 2314 'trace_level': 1, |
2315 }, | 2315 }, |
2316 'DestroyImageCHROMIUM': { | 2316 'DestroyImageCHROMIUM': { |
2317 'type': 'Manual', | 2317 'type': 'Manual', |
2318 'client_test': False, | 2318 'client_test': False, |
2319 'gen_cmd': False, | 2319 'gen_cmd': False, |
2320 'extension': True, | 2320 'extension': "CHROMIUM_image", |
2321 'chromium': True, | 2321 'chromium': True, |
2322 'trace_level': 1, | 2322 'trace_level': 1, |
2323 }, | 2323 }, |
2324 'CreateGpuMemoryBufferImageCHROMIUM': { | 2324 'CreateGpuMemoryBufferImageCHROMIUM': { |
2325 'type': 'Manual', | 2325 'type': 'Manual', |
2326 'cmd_args': | 2326 'cmd_args': |
2327 'GLsizei width, GLsizei height, GLenum internalformat, GLenum usage', | 2327 'GLsizei width, GLsizei height, GLenum internalformat, GLenum usage', |
2328 'result': ['GLuint'], | 2328 'result': ['GLuint'], |
2329 'client_test': False, | 2329 'client_test': False, |
2330 'gen_cmd': False, | 2330 'gen_cmd': False, |
2331 'expectation': False, | 2331 'expectation': False, |
2332 'extension': True, | 2332 'extension': "CHROMIUM_image", |
2333 'chromium': True, | 2333 'chromium': True, |
2334 'trace_level': 1, | 2334 'trace_level': 1, |
2335 }, | 2335 }, |
2336 'CreateProgram': { | 2336 'CreateProgram': { |
2337 'type': 'Create', | 2337 'type': 'Create', |
2338 'client_test': False, | 2338 'client_test': False, |
2339 }, | 2339 }, |
2340 'CreateShader': { | 2340 'CreateShader': { |
2341 'type': 'Create', | 2341 'type': 'Create', |
2342 'client_test': False, | 2342 'client_test': False, |
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3048 'expectation': False, | 3048 'expectation': False, |
3049 'unsafe': True, | 3049 'unsafe': True, |
3050 }, | 3050 }, |
3051 'LinkProgram': { | 3051 'LinkProgram': { |
3052 'decoder_func': 'DoLinkProgram', | 3052 'decoder_func': 'DoLinkProgram', |
3053 'impl_func': False, | 3053 'impl_func': False, |
3054 'trace_level': 1, | 3054 'trace_level': 1, |
3055 }, | 3055 }, |
3056 'MapBufferCHROMIUM': { | 3056 'MapBufferCHROMIUM': { |
3057 'gen_cmd': False, | 3057 'gen_cmd': False, |
3058 'extension': True, | 3058 'extension': "CHROMIUM_pixel_transfer_buffer_object", |
3059 'chromium': True, | 3059 'chromium': True, |
3060 'client_test': False, | 3060 'client_test': False, |
3061 'trace_level': 1, | 3061 'trace_level': 1, |
3062 }, | 3062 }, |
3063 'MapBufferSubDataCHROMIUM': { | 3063 'MapBufferSubDataCHROMIUM': { |
3064 'gen_cmd': False, | 3064 'gen_cmd': False, |
3065 'extension': True, | 3065 'extension': True, |
3066 'chromium': True, | 3066 'chromium': True, |
3067 'client_test': False, | 3067 'client_test': False, |
3068 'pepper_interface': 'ChromiumMapSub', | 3068 'pepper_interface': 'ChromiumMapSub', |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3464 'count': 12, | 3464 'count': 12, |
3465 'unsafe': True, | 3465 'unsafe': True, |
3466 }, | 3466 }, |
3467 'UniformBlockBinding': { | 3467 'UniformBlockBinding': { |
3468 'type': 'Custom', | 3468 'type': 'Custom', |
3469 'impl_func': False, | 3469 'impl_func': False, |
3470 'unsafe': True, | 3470 'unsafe': True, |
3471 }, | 3471 }, |
3472 'UnmapBufferCHROMIUM': { | 3472 'UnmapBufferCHROMIUM': { |
3473 'gen_cmd': False, | 3473 'gen_cmd': False, |
3474 'extension': True, | 3474 'extension': "CHROMIUM_pixel_transfer_buffer_object", |
3475 'chromium': True, | 3475 'chromium': True, |
3476 'client_test': False, | 3476 'client_test': False, |
3477 'trace_level': 1, | 3477 'trace_level': 1, |
3478 }, | 3478 }, |
3479 'UnmapBufferSubDataCHROMIUM': { | 3479 'UnmapBufferSubDataCHROMIUM': { |
3480 'gen_cmd': False, | 3480 'gen_cmd': False, |
3481 'extension': True, | 3481 'extension': True, |
3482 'chromium': True, | 3482 'chromium': True, |
3483 'client_test': False, | 3483 'client_test': False, |
3484 'pepper_interface': 'ChromiumMapSub', | 3484 'pepper_interface': 'ChromiumMapSub', |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3617 'TexImageIOSurface2DCHROMIUM': { | 3617 'TexImageIOSurface2DCHROMIUM': { |
3618 'decoder_func': 'DoTexImageIOSurface2DCHROMIUM', | 3618 'decoder_func': 'DoTexImageIOSurface2DCHROMIUM', |
3619 'unit_test': False, | 3619 'unit_test': False, |
3620 'extension': True, | 3620 'extension': True, |
3621 'chromium': True, | 3621 'chromium': True, |
3622 'trace_level': 1, | 3622 'trace_level': 1, |
3623 }, | 3623 }, |
3624 'CopyTextureCHROMIUM': { | 3624 'CopyTextureCHROMIUM': { |
3625 'decoder_func': 'DoCopyTextureCHROMIUM', | 3625 'decoder_func': 'DoCopyTextureCHROMIUM', |
3626 'unit_test': False, | 3626 'unit_test': False, |
3627 'extension': True, | 3627 'extension': "CHROMIUM_copy_texture", |
3628 'chromium': True, | 3628 'chromium': True, |
3629 'trace_level': 2, | 3629 'trace_level': 2, |
3630 }, | 3630 }, |
3631 'CopySubTextureCHROMIUM': { | 3631 'CopySubTextureCHROMIUM': { |
3632 'decoder_func': 'DoCopySubTextureCHROMIUM', | 3632 'decoder_func': 'DoCopySubTextureCHROMIUM', |
3633 'unit_test': False, | 3633 'unit_test': False, |
3634 'extension': True, | 3634 'extension': "CHROMIUM_copy_texture", |
3635 'chromium': True, | 3635 'chromium': True, |
3636 'trace_level': 2, | 3636 'trace_level': 2, |
3637 }, | 3637 }, |
3638 'TexStorage2DEXT': { | 3638 'TexStorage2DEXT': { |
3639 'unit_test': False, | 3639 'unit_test': False, |
3640 'extension': True, | 3640 'extension': True, |
3641 'decoder_func': 'DoTexStorage2DEXT', | 3641 'decoder_func': 'DoTexStorage2DEXT', |
3642 'trace_level': 2, | 3642 'trace_level': 2, |
3643 }, | 3643 }, |
3644 'DrawArraysInstancedANGLE': { | 3644 'DrawArraysInstancedANGLE': { |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3801 'extension': True, | 3801 'extension': True, |
3802 'gl_test_func': 'glIsVertexArrayOES', | 3802 'gl_test_func': 'glIsVertexArrayOES', |
3803 'decoder_func': 'DoIsVertexArrayOES', | 3803 'decoder_func': 'DoIsVertexArrayOES', |
3804 'expectation': False, | 3804 'expectation': False, |
3805 'unit_test': False, | 3805 'unit_test': False, |
3806 'pepper_interface': 'VertexArrayObject', | 3806 'pepper_interface': 'VertexArrayObject', |
3807 }, | 3807 }, |
3808 'BindTexImage2DCHROMIUM': { | 3808 'BindTexImage2DCHROMIUM': { |
3809 'decoder_func': 'DoBindTexImage2DCHROMIUM', | 3809 'decoder_func': 'DoBindTexImage2DCHROMIUM', |
3810 'unit_test': False, | 3810 'unit_test': False, |
3811 'extension': True, | 3811 'extension': "CHROMIUM_image", |
3812 'chromium': True, | 3812 'chromium': True, |
3813 }, | 3813 }, |
3814 'ReleaseTexImage2DCHROMIUM': { | 3814 'ReleaseTexImage2DCHROMIUM': { |
3815 'decoder_func': 'DoReleaseTexImage2DCHROMIUM', | 3815 'decoder_func': 'DoReleaseTexImage2DCHROMIUM', |
3816 'unit_test': False, | 3816 'unit_test': False, |
3817 'extension': True, | 3817 'extension': "CHROMIUM_image", |
3818 'chromium': True, | 3818 'chromium': True, |
3819 }, | 3819 }, |
3820 'ShallowFinishCHROMIUM': { | 3820 'ShallowFinishCHROMIUM': { |
3821 'impl_func': False, | 3821 'impl_func': False, |
3822 'gen_cmd': False, | 3822 'gen_cmd': False, |
3823 'extension': True, | 3823 'extension': True, |
3824 'chromium': True, | 3824 'chromium': True, |
3825 'client_test': False, | 3825 'client_test': False, |
3826 }, | 3826 }, |
3827 'ShallowFlushCHROMIUM': { | 3827 'ShallowFlushCHROMIUM': { |
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4627 (func.return_type, func.original_name, | 4627 (func.return_type, func.original_name, |
4628 func.MakeTypedOriginalArgString(""))) | 4628 func.MakeTypedOriginalArgString(""))) |
4629 | 4629 |
4630 def WriteMojoGLES2Impl(self, func, file): | 4630 def WriteMojoGLES2Impl(self, func, file): |
4631 """Writes the Mojo GLES2 implementation.""" | 4631 """Writes the Mojo GLES2 implementation.""" |
4632 file.Write("%s MojoGLES2Impl::%s(%s) {\n" % | 4632 file.Write("%s MojoGLES2Impl::%s(%s) {\n" % |
4633 (func.return_type, func.original_name, | 4633 (func.return_type, func.original_name, |
4634 func.MakeTypedOriginalArgString(""))) | 4634 func.MakeTypedOriginalArgString(""))) |
4635 extensions = ["CHROMIUM_sync_point", "CHROMIUM_texture_mailbox", | 4635 extensions = ["CHROMIUM_sync_point", "CHROMIUM_texture_mailbox", |
4636 "CHROMIUM_sub_image", "CHROMIUM_miscellaneous", | 4636 "CHROMIUM_sub_image", "CHROMIUM_miscellaneous", |
4637 "occlusion_query_EXT"] | 4637 "occlusion_query_EXT", "CHROMIUM_image", |
| 4638 "CHROMIUM_copy_texture", |
| 4639 "CHROMIUM_pixel_transfer_buffer_object"] |
4638 if func.IsCoreGLFunction() or func.GetInfo("extension") in extensions: | 4640 if func.IsCoreGLFunction() or func.GetInfo("extension") in extensions: |
4639 file.Write("MojoGLES2MakeCurrent(context_);"); | 4641 file.Write("MojoGLES2MakeCurrent(context_);"); |
4640 func_return = "gl" + func.original_name + "(" + \ | 4642 func_return = "gl" + func.original_name + "(" + \ |
4641 func.MakeOriginalArgString("") + ");" | 4643 func.MakeOriginalArgString("") + ");" |
4642 if func.return_type == "void": | 4644 if func.return_type == "void": |
4643 file.Write(func_return); | 4645 file.Write(func_return); |
4644 else: | 4646 else: |
4645 file.Write("return " + func_return); | 4647 file.Write("return " + func_return); |
4646 else: | 4648 else: |
4647 file.Write("NOTREACHED() << \"Unimplemented %s.\";\n" % | 4649 file.Write("NOTREACHED() << \"Unimplemented %s.\";\n" % |
(...skipping 5816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10464 def WriteMojoGLES2Impl(self, filename): | 10466 def WriteMojoGLES2Impl(self, filename): |
10465 """Writes the Mojo GLES2 implementation.""" | 10467 """Writes the Mojo GLES2 implementation.""" |
10466 file = CWriter(filename) | 10468 file = CWriter(filename) |
10467 file.Write(_LICENSE) | 10469 file.Write(_LICENSE) |
10468 file.Write(_DO_NOT_EDIT_WARNING) | 10470 file.Write(_DO_NOT_EDIT_WARNING) |
10469 | 10471 |
10470 code = """ | 10472 code = """ |
10471 #include "mojo/gpu/mojo_gles2_impl_autogen.h" | 10473 #include "mojo/gpu/mojo_gles2_impl_autogen.h" |
10472 | 10474 |
10473 #include "base/logging.h" | 10475 #include "base/logging.h" |
| 10476 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_copy_texture.h" |
| 10477 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_image.h" |
10474 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_miscellaneous.h" | 10478 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_miscellaneous.h" |
| 10479 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_pixel_transfer_buffe
r_object.h" |
10475 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_sub_image.h" | 10480 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_sub_image.h" |
10476 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_sync_point.h" | 10481 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_sync_point.h" |
10477 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_texture_mailbox.h" | 10482 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_texture_mailbox.h" |
10478 #include "third_party/mojo/src/mojo/public/c/gles2/gles2.h" | 10483 #include "third_party/mojo/src/mojo/public/c/gles2/gles2.h" |
10479 #include "third_party/mojo/src/mojo/public/c/gles2/occlusion_query_ext.h" | 10484 #include "third_party/mojo/src/mojo/public/c/gles2/occlusion_query_ext.h" |
10480 | 10485 |
10481 namespace mojo { | 10486 namespace mojo { |
10482 | 10487 |
10483 """ | 10488 """ |
10484 file.Write(code); | 10489 file.Write(code); |
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11068 "CHROMIUM_sync_point") | 11073 "CHROMIUM_sync_point") |
11069 gen.WriteMojoGLCallVisitorForExtension( | 11074 gen.WriteMojoGLCallVisitorForExtension( |
11070 mojo_gles2_prefix + "_chromium_sub_image_autogen.h", | 11075 mojo_gles2_prefix + "_chromium_sub_image_autogen.h", |
11071 "CHROMIUM_sub_image") | 11076 "CHROMIUM_sub_image") |
11072 gen.WriteMojoGLCallVisitorForExtension( | 11077 gen.WriteMojoGLCallVisitorForExtension( |
11073 mojo_gles2_prefix + "_chromium_miscellaneous_autogen.h", | 11078 mojo_gles2_prefix + "_chromium_miscellaneous_autogen.h", |
11074 "CHROMIUM_miscellaneous") | 11079 "CHROMIUM_miscellaneous") |
11075 gen.WriteMojoGLCallVisitorForExtension( | 11080 gen.WriteMojoGLCallVisitorForExtension( |
11076 mojo_gles2_prefix + "_occlusion_query_ext_autogen.h", | 11081 mojo_gles2_prefix + "_occlusion_query_ext_autogen.h", |
11077 "occlusion_query_EXT") | 11082 "occlusion_query_EXT") |
| 11083 gen.WriteMojoGLCallVisitorForExtension( |
| 11084 mojo_gles2_prefix + "_chromium_image_autogen.h", |
| 11085 "CHROMIUM_image") |
| 11086 gen.WriteMojoGLCallVisitorForExtension( |
| 11087 mojo_gles2_prefix + "_chromium_copy_texture_autogen.h", |
| 11088 "CHROMIUM_copy_texture") |
| 11089 gen.WriteMojoGLCallVisitorForExtension( |
| 11090 mojo_gles2_prefix + "_chromium_pixel_transfer_buffer_object_autogen.h", |
| 11091 "CHROMIUM_pixel_transfer_buffer_object") |
11078 | 11092 |
11079 Format(gen.generated_cpp_filenames) | 11093 Format(gen.generated_cpp_filenames) |
11080 | 11094 |
11081 if gen.errors > 0: | 11095 if gen.errors > 0: |
11082 print "%d errors" % gen.errors | 11096 print "%d errors" % gen.errors |
11083 return 1 | 11097 return 1 |
11084 return 0 | 11098 return 0 |
11085 | 11099 |
11086 | 11100 |
11087 if __name__ == '__main__': | 11101 if __name__ == '__main__': |
11088 sys.exit(main(sys.argv[1:])) | 11102 sys.exit(main(sys.argv[1:])) |
OLD | NEW |