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_image", |
piman
2015/06/15 18:14:33
nit: CHROMIUM_pixel_transfer_buffer_object
I reali
jam
2015/06/15 22:06:01
Done.
| |
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_image", |
piman
2015/06/15 18:14:33
CHROMIUM_pixel_transfer_buffer_object
jam
2015/06/15 22:06:01
Done.
| |
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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3859 'data_transfer_methods': ['shm'], | 3859 'data_transfer_methods': ['shm'], |
3860 'client_test': False, | 3860 'client_test': False, |
3861 'cmd_args': 'GLenumTextureTarget target, GLint level, ' | 3861 'cmd_args': 'GLenumTextureTarget target, GLint level, ' |
3862 'GLintTextureInternalFormat internalformat, ' | 3862 'GLintTextureInternalFormat internalformat, ' |
3863 'GLsizei width, GLsizei height, ' | 3863 'GLsizei width, GLsizei height, ' |
3864 'GLintTextureBorder border, ' | 3864 'GLintTextureBorder border, ' |
3865 'GLenumTextureFormat format, GLenumPixelType type, ' | 3865 'GLenumTextureFormat format, GLenumPixelType type, ' |
3866 'const void* pixels, ' | 3866 'const void* pixels, ' |
3867 'uint32_t async_upload_token, ' | 3867 'uint32_t async_upload_token, ' |
3868 'void* sync_data', | 3868 'void* sync_data', |
3869 'extension': True, | 3869 'extension': "CHROMIUM_image", |
piman
2015/06/15 18:14:33
nit: CHROMIUM_async_pixel_transfers (same deal).
danakj
2015/06/15 18:20:35
And, FWIW if you use_one_copy = true, you probably
jam
2015/06/15 22:06:01
set use_one_copy=true, and removed all changes tha
| |
3870 'chromium': True, | 3870 'chromium': True, |
3871 'trace_level': 2, | 3871 'trace_level': 2, |
3872 }, | 3872 }, |
3873 'AsyncTexSubImage2DCHROMIUM': { | 3873 'AsyncTexSubImage2DCHROMIUM': { |
3874 'type': 'Manual', | 3874 'type': 'Manual', |
3875 'data_transfer_methods': ['shm'], | 3875 'data_transfer_methods': ['shm'], |
3876 'client_test': False, | 3876 'client_test': False, |
3877 'cmd_args': 'GLenumTextureTarget target, GLint level, ' | 3877 'cmd_args': 'GLenumTextureTarget target, GLint level, ' |
3878 'GLint xoffset, GLint yoffset, ' | 3878 'GLint xoffset, GLint yoffset, ' |
3879 'GLsizei width, GLsizei height, ' | 3879 'GLsizei width, GLsizei height, ' |
3880 'GLenumTextureFormat format, GLenumPixelType type, ' | 3880 'GLenumTextureFormat format, GLenumPixelType type, ' |
3881 'const void* data, ' | 3881 'const void* data, ' |
3882 'uint32_t async_upload_token, ' | 3882 'uint32_t async_upload_token, ' |
3883 'void* sync_data', | 3883 'void* sync_data', |
3884 'extension': True, | 3884 'extension': "CHROMIUM_image", |
piman
2015/06/15 18:14:33
nit: CHROMIUM_async_pixel_transfers
| |
3885 'chromium': True, | 3885 'chromium': True, |
3886 'trace_level': 2, | 3886 'trace_level': 2, |
3887 }, | 3887 }, |
3888 'WaitAsyncTexImage2DCHROMIUM': { | 3888 'WaitAsyncTexImage2DCHROMIUM': { |
3889 'type': 'Manual', | 3889 'type': 'Manual', |
3890 'client_test': False, | 3890 'client_test': False, |
3891 'extension': True, | 3891 'extension': "CHROMIUM_image", |
piman
2015/06/15 18:14:33
nit: CHROMIUM_async_pixel_transfers
| |
3892 'chromium': True, | 3892 'chromium': True, |
3893 'trace_level': 1, | 3893 'trace_level': 1, |
3894 }, | 3894 }, |
3895 'WaitAllAsyncTexImage2DCHROMIUM': { | 3895 'WaitAllAsyncTexImage2DCHROMIUM': { |
3896 'type': 'Manual', | 3896 'type': 'Manual', |
3897 'client_test': False, | 3897 'client_test': False, |
3898 'extension': True, | 3898 'extension': "CHROMIUM_image", |
piman
2015/06/15 18:14:33
nit: CHROMIUM_async_pixel_transfers
| |
3899 'chromium': True, | 3899 'chromium': True, |
3900 'trace_level': 1, | 3900 'trace_level': 1, |
3901 }, | 3901 }, |
3902 'DiscardFramebufferEXT': { | 3902 'DiscardFramebufferEXT': { |
3903 'type': 'PUTn', | 3903 'type': 'PUTn', |
3904 'count': 1, | 3904 'count': 1, |
3905 'decoder_func': 'DoDiscardFramebufferEXT', | 3905 'decoder_func': 'DoDiscardFramebufferEXT', |
3906 'unit_test': False, | 3906 'unit_test': False, |
3907 'client_test': False, | 3907 'client_test': False, |
3908 'extension_flag': 'ext_discard_framebuffer', | 3908 'extension_flag': 'ext_discard_framebuffer', |
(...skipping 718 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"] | |
4638 if func.IsCoreGLFunction() or func.GetInfo("extension") in extensions: | 4639 if func.IsCoreGLFunction() or func.GetInfo("extension") in extensions: |
4639 file.Write("MojoGLES2MakeCurrent(context_);"); | 4640 file.Write("MojoGLES2MakeCurrent(context_);"); |
4640 func_return = "gl" + func.original_name + "(" + \ | 4641 func_return = "gl" + func.original_name + "(" + \ |
4641 func.MakeOriginalArgString("") + ");" | 4642 func.MakeOriginalArgString("") + ");" |
4642 if func.return_type == "void": | 4643 if func.return_type == "void": |
4643 file.Write(func_return); | 4644 file.Write(func_return); |
4644 else: | 4645 else: |
4645 file.Write("return " + func_return); | 4646 file.Write("return " + func_return); |
4646 else: | 4647 else: |
4647 file.Write("NOTREACHED() << \"Unimplemented %s.\";\n" % | 4648 file.Write("NOTREACHED() << \"Unimplemented %s.\";\n" % |
(...skipping 5816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
10464 def WriteMojoGLES2Impl(self, filename): | 10465 def WriteMojoGLES2Impl(self, filename): |
10465 """Writes the Mojo GLES2 implementation.""" | 10466 """Writes the Mojo GLES2 implementation.""" |
10466 file = CWriter(filename) | 10467 file = CWriter(filename) |
10467 file.Write(_LICENSE) | 10468 file.Write(_LICENSE) |
10468 file.Write(_DO_NOT_EDIT_WARNING) | 10469 file.Write(_DO_NOT_EDIT_WARNING) |
10469 | 10470 |
10470 code = """ | 10471 code = """ |
10471 #include "mojo/gpu/mojo_gles2_impl_autogen.h" | 10472 #include "mojo/gpu/mojo_gles2_impl_autogen.h" |
10472 | 10473 |
10473 #include "base/logging.h" | 10474 #include "base/logging.h" |
10475 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_copy_texture.h" | |
10476 #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" | 10477 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_miscellaneous.h" |
10475 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_sub_image.h" | 10478 #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" | 10479 #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" | 10480 #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" | 10481 #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" | 10482 #include "third_party/mojo/src/mojo/public/c/gles2/occlusion_query_ext.h" |
10480 | 10483 |
10481 namespace mojo { | 10484 namespace mojo { |
10482 | 10485 |
10483 """ | 10486 """ |
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11068 "CHROMIUM_sync_point") | 11071 "CHROMIUM_sync_point") |
11069 gen.WriteMojoGLCallVisitorForExtension( | 11072 gen.WriteMojoGLCallVisitorForExtension( |
11070 mojo_gles2_prefix + "_chromium_sub_image_autogen.h", | 11073 mojo_gles2_prefix + "_chromium_sub_image_autogen.h", |
11071 "CHROMIUM_sub_image") | 11074 "CHROMIUM_sub_image") |
11072 gen.WriteMojoGLCallVisitorForExtension( | 11075 gen.WriteMojoGLCallVisitorForExtension( |
11073 mojo_gles2_prefix + "_chromium_miscellaneous_autogen.h", | 11076 mojo_gles2_prefix + "_chromium_miscellaneous_autogen.h", |
11074 "CHROMIUM_miscellaneous") | 11077 "CHROMIUM_miscellaneous") |
11075 gen.WriteMojoGLCallVisitorForExtension( | 11078 gen.WriteMojoGLCallVisitorForExtension( |
11076 mojo_gles2_prefix + "_occlusion_query_ext_autogen.h", | 11079 mojo_gles2_prefix + "_occlusion_query_ext_autogen.h", |
11077 "occlusion_query_EXT") | 11080 "occlusion_query_EXT") |
11081 gen.WriteMojoGLCallVisitorForExtension( | |
11082 mojo_gles2_prefix + "_chromium_image_autogen.h", | |
11083 "CHROMIUM_image") | |
11084 gen.WriteMojoGLCallVisitorForExtension( | |
11085 mojo_gles2_prefix + "_chromium_copy_texture_autogen.h", | |
11086 "CHROMIUM_copy_texture") | |
11078 | 11087 |
11079 Format(gen.generated_cpp_filenames) | 11088 Format(gen.generated_cpp_filenames) |
11080 | 11089 |
11081 if gen.errors > 0: | 11090 if gen.errors > 0: |
11082 print "%d errors" % gen.errors | 11091 print "%d errors" % gen.errors |
11083 return 1 | 11092 return 1 |
11084 return 0 | 11093 return 0 |
11085 | 11094 |
11086 | 11095 |
11087 if __name__ == '__main__': | 11096 if __name__ == '__main__': |
11088 sys.exit(main(sys.argv[1:])) | 11097 sys.exit(main(sys.argv[1:])) |
OLD | NEW |