| 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 1364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1375 'no_gl': True, | 1375 'no_gl': True, |
| 1376 'expectation': False, | 1376 'expectation': False, |
| 1377 }, | 1377 }, |
| 1378 'ConsumeTextureCHROMIUM': { | 1378 'ConsumeTextureCHROMIUM': { |
| 1379 'decoder_func': 'DoConsumeTextureCHROMIUM', | 1379 'decoder_func': 'DoConsumeTextureCHROMIUM', |
| 1380 'impl_func': False, | 1380 'impl_func': False, |
| 1381 'type': 'PUT', | 1381 'type': 'PUT', |
| 1382 'count': 64, # GL_MAILBOX_SIZE_CHROMIUM | 1382 'count': 64, # GL_MAILBOX_SIZE_CHROMIUM |
| 1383 'unit_test': False, | 1383 'unit_test': False, |
| 1384 'client_test': False, | 1384 'client_test': False, |
| 1385 'extension': True, | 1385 'extension': "CHROMIUM_texture_mailbox", |
| 1386 'chromium': True, | 1386 'chromium': True, |
| 1387 'trace_level': 1, | 1387 'trace_level': 1, |
| 1388 }, | 1388 }, |
| 1389 'CreateAndConsumeTextureCHROMIUM': { | 1389 'CreateAndConsumeTextureCHROMIUM': { |
| 1390 'decoder_func': 'DoCreateAndConsumeTextureCHROMIUM', | 1390 'decoder_func': 'DoCreateAndConsumeTextureCHROMIUM', |
| 1391 'impl_func': False, | 1391 'impl_func': False, |
| 1392 'type': 'HandWritten', | 1392 'type': 'HandWritten', |
| 1393 'data_transfer_methods': ['immediate'], | 1393 'data_transfer_methods': ['immediate'], |
| 1394 'unit_test': False, | 1394 'unit_test': False, |
| 1395 'client_test': False, | 1395 'client_test': False, |
| 1396 'extension': True, | 1396 'extension': "CHROMIUM_texture_mailbox", |
| 1397 'chromium': True, | 1397 'chromium': True, |
| 1398 }, | 1398 }, |
| 1399 'ClearStencil': { | 1399 'ClearStencil': { |
| 1400 'type': 'StateSet', | 1400 'type': 'StateSet', |
| 1401 'state': 'ClearStencil', | 1401 'state': 'ClearStencil', |
| 1402 }, | 1402 }, |
| 1403 'EnableFeatureCHROMIUM': { | 1403 'EnableFeatureCHROMIUM': { |
| 1404 'type': 'Custom', | 1404 'type': 'Custom', |
| 1405 'data_transfer_methods': ['shm'], | 1405 'data_transfer_methods': ['shm'], |
| 1406 'decoder_func': 'DoEnableFeatureCHROMIUM', | 1406 'decoder_func': 'DoEnableFeatureCHROMIUM', |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1641 }, | 1641 }, |
| 1642 'GenBuffers': { | 1642 'GenBuffers': { |
| 1643 'type': 'GENn', | 1643 'type': 'GENn', |
| 1644 'gl_test_func': 'glGenBuffersARB', | 1644 'gl_test_func': 'glGenBuffersARB', |
| 1645 'resource_type': 'Buffer', | 1645 'resource_type': 'Buffer', |
| 1646 'resource_types': 'Buffers', | 1646 'resource_types': 'Buffers', |
| 1647 }, | 1647 }, |
| 1648 'GenMailboxCHROMIUM': { | 1648 'GenMailboxCHROMIUM': { |
| 1649 'type': 'HandWritten', | 1649 'type': 'HandWritten', |
| 1650 'impl_func': False, | 1650 'impl_func': False, |
| 1651 'extension': True, | 1651 'extension': "CHROMIUM_texture_mailbox", |
| 1652 'chromium': True, | 1652 'chromium': True, |
| 1653 }, | 1653 }, |
| 1654 'GenFramebuffers': { | 1654 'GenFramebuffers': { |
| 1655 'type': 'GENn', | 1655 'type': 'GENn', |
| 1656 'gl_test_func': 'glGenFramebuffersEXT', | 1656 'gl_test_func': 'glGenFramebuffersEXT', |
| 1657 'resource_type': 'Framebuffer', | 1657 'resource_type': 'Framebuffer', |
| 1658 'resource_types': 'Framebuffers', | 1658 'resource_types': 'Framebuffers', |
| 1659 }, | 1659 }, |
| 1660 'GenRenderbuffers': { | 1660 'GenRenderbuffers': { |
| 1661 'type': 'GENn', 'gl_test_func': 'glGenRenderbuffersEXT', | 1661 'type': 'GENn', 'gl_test_func': 'glGenRenderbuffersEXT', |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1969 'extension': True, | 1969 'extension': True, |
| 1970 'chromium': True, | 1970 'chromium': True, |
| 1971 }, | 1971 }, |
| 1972 'ProduceTextureCHROMIUM': { | 1972 'ProduceTextureCHROMIUM': { |
| 1973 'decoder_func': 'DoProduceTextureCHROMIUM', | 1973 'decoder_func': 'DoProduceTextureCHROMIUM', |
| 1974 'impl_func': False, | 1974 'impl_func': False, |
| 1975 'type': 'PUT', | 1975 'type': 'PUT', |
| 1976 'count': 64, # GL_MAILBOX_SIZE_CHROMIUM | 1976 'count': 64, # GL_MAILBOX_SIZE_CHROMIUM |
| 1977 'unit_test': False, | 1977 'unit_test': False, |
| 1978 'client_test': False, | 1978 'client_test': False, |
| 1979 'extension': True, | 1979 'extension': "CHROMIUM_texture_mailbox", |
| 1980 'chromium': True, | 1980 'chromium': True, |
| 1981 'trace_level': 1, | 1981 'trace_level': 1, |
| 1982 }, | 1982 }, |
| 1983 'ProduceTextureDirectCHROMIUM': { | 1983 'ProduceTextureDirectCHROMIUM': { |
| 1984 'decoder_func': 'DoProduceTextureDirectCHROMIUM', | 1984 'decoder_func': 'DoProduceTextureDirectCHROMIUM', |
| 1985 'impl_func': False, | 1985 'impl_func': False, |
| 1986 'type': 'PUT', | 1986 'type': 'PUT', |
| 1987 'count': 64, # GL_MAILBOX_SIZE_CHROMIUM | 1987 'count': 64, # GL_MAILBOX_SIZE_CHROMIUM |
| 1988 'unit_test': False, | 1988 'unit_test': False, |
| 1989 'client_test': False, | 1989 'client_test': False, |
| 1990 'extension': True, | 1990 'extension': "CHROMIUM_texture_mailbox", |
| 1991 'chromium': True, | 1991 'chromium': True, |
| 1992 'trace_level': 1, | 1992 'trace_level': 1, |
| 1993 }, | 1993 }, |
| 1994 'RenderbufferStorage': { | 1994 'RenderbufferStorage': { |
| 1995 'decoder_func': 'DoRenderbufferStorage', | 1995 'decoder_func': 'DoRenderbufferStorage', |
| 1996 'gl_test_func': 'glRenderbufferStorageEXT', | 1996 'gl_test_func': 'glRenderbufferStorageEXT', |
| 1997 'expectation': False, | 1997 'expectation': False, |
| 1998 }, | 1998 }, |
| 1999 'RenderbufferStorageMultisampleCHROMIUM': { | 1999 'RenderbufferStorageMultisampleCHROMIUM': { |
| 2000 'cmd_comment': | 2000 'cmd_comment': |
| (...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2552 }, | 2552 }, |
| 2553 'LoseContextCHROMIUM': { | 2553 'LoseContextCHROMIUM': { |
| 2554 'decoder_func': 'DoLoseContextCHROMIUM', | 2554 'decoder_func': 'DoLoseContextCHROMIUM', |
| 2555 'unit_test': False, | 2555 'unit_test': False, |
| 2556 'extension': True, | 2556 'extension': True, |
| 2557 'chromium': True, | 2557 'chromium': True, |
| 2558 }, | 2558 }, |
| 2559 'InsertSyncPointCHROMIUM': { | 2559 'InsertSyncPointCHROMIUM': { |
| 2560 'type': 'HandWritten', | 2560 'type': 'HandWritten', |
| 2561 'impl_func': False, | 2561 'impl_func': False, |
| 2562 'extension': True, | 2562 'extension': "CHROMIUM_sync_point", |
| 2563 'chromium': True, | 2563 'chromium': True, |
| 2564 }, | 2564 }, |
| 2565 'WaitSyncPointCHROMIUM': { | 2565 'WaitSyncPointCHROMIUM': { |
| 2566 'type': 'Custom', | 2566 'type': 'Custom', |
| 2567 'impl_func': True, | 2567 'impl_func': True, |
| 2568 'extension': True, | 2568 'extension': "CHROMIUM_sync_point", |
| 2569 'chromium': True, | 2569 'chromium': True, |
| 2570 'trace_level': 1, | 2570 'trace_level': 1, |
| 2571 }, | 2571 }, |
| 2572 'DiscardBackbufferCHROMIUM': { | 2572 'DiscardBackbufferCHROMIUM': { |
| 2573 'type': 'Custom', | 2573 'type': 'Custom', |
| 2574 'impl_func': True, | 2574 'impl_func': True, |
| 2575 'extension': True, | 2575 'extension': True, |
| 2576 'chromium': True, | 2576 'chromium': True, |
| 2577 }, | 2577 }, |
| 2578 'ScheduleOverlayPlaneCHROMIUM': { | 2578 'ScheduleOverlayPlaneCHROMIUM': { |
| (...skipping 5639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8218 for func in self.original_functions: | 8218 for func in self.original_functions: |
| 8219 if not func.IsCoreGLFunction(): | 8219 if not func.IsCoreGLFunction(): |
| 8220 continue | 8220 continue |
| 8221 file.Write("VISIT_GL_CALL(%s, %s, (%s), (%s))\n" % | 8221 file.Write("VISIT_GL_CALL(%s, %s, (%s), (%s))\n" % |
| 8222 (func.name, func.return_type, | 8222 (func.name, func.return_type, |
| 8223 func.MakeTypedOriginalArgString(""), | 8223 func.MakeTypedOriginalArgString(""), |
| 8224 func.MakeOriginalArgString(""))) | 8224 func.MakeOriginalArgString(""))) |
| 8225 | 8225 |
| 8226 file.Close() | 8226 file.Close() |
| 8227 | 8227 |
| 8228 def WriteMojoGLCallVisitorForExtension(self, filename, extension): |
| 8229 """Provides the GL implementation for mojo for a particular extension""" |
| 8230 file = CWriter(filename) |
| 8231 file.Write(_LICENSE) |
| 8232 file.Write(_DO_NOT_EDIT_WARNING) |
| 8233 |
| 8234 for func in self.original_functions: |
| 8235 if func.GetInfo("extension") != extension: |
| 8236 continue |
| 8237 file.Write("VISIT_GL_CALL(%s, %s, (%s), (%s))\n" % |
| 8238 (func.name, func.return_type, |
| 8239 func.MakeTypedOriginalArgString(""), |
| 8240 func.MakeOriginalArgString(""))) |
| 8241 |
| 8242 file.Close() |
| 8243 |
| 8228 def Format(generated_files): | 8244 def Format(generated_files): |
| 8229 for filename in generated_files: | 8245 for filename in generated_files: |
| 8230 call(["clang-format", "-i", "-style=chromium", filename]) | 8246 call(["clang-format", "-i", "-style=chromium", filename]) |
| 8231 | 8247 |
| 8232 def main(argv): | 8248 def main(argv): |
| 8233 """This is the main function.""" | 8249 """This is the main function.""" |
| 8234 parser = OptionParser() | 8250 parser = OptionParser() |
| 8235 parser.add_option( | 8251 parser.add_option( |
| 8236 "--output-dir", | 8252 "--output-dir", |
| 8237 help="base directory for resulting files, under chrome/src. default is " | 8253 help="base directory for resulting files, under chrome/src. default is " |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8299 gen.WriteClientContextStateHeader("client/client_context_state_autogen.h") | 8315 gen.WriteClientContextStateHeader("client/client_context_state_autogen.h") |
| 8300 gen.WriteClientContextStateImpl( | 8316 gen.WriteClientContextStateImpl( |
| 8301 "client/client_context_state_impl_autogen.h") | 8317 "client/client_context_state_impl_autogen.h") |
| 8302 gen.WriteServiceUnitTests("service/gles2_cmd_decoder_unittest_%d_autogen.h") | 8318 gen.WriteServiceUnitTests("service/gles2_cmd_decoder_unittest_%d_autogen.h") |
| 8303 gen.WriteServiceUtilsHeader("service/gles2_cmd_validation_autogen.h") | 8319 gen.WriteServiceUtilsHeader("service/gles2_cmd_validation_autogen.h") |
| 8304 gen.WriteServiceUtilsImplementation( | 8320 gen.WriteServiceUtilsImplementation( |
| 8305 "service/gles2_cmd_validation_implementation_autogen.h") | 8321 "service/gles2_cmd_validation_implementation_autogen.h") |
| 8306 gen.WriteCommonUtilsHeader("common/gles2_cmd_utils_autogen.h") | 8322 gen.WriteCommonUtilsHeader("common/gles2_cmd_utils_autogen.h") |
| 8307 gen.WriteCommonUtilsImpl("common/gles2_cmd_utils_implementation_autogen.h") | 8323 gen.WriteCommonUtilsImpl("common/gles2_cmd_utils_implementation_autogen.h") |
| 8308 gen.WriteGLES2Header("../GLES2/gl2chromium_autogen.h") | 8324 gen.WriteGLES2Header("../GLES2/gl2chromium_autogen.h") |
| 8309 gen.WriteMojoGLCallVisitor( | 8325 mojo_gles2_prefix = "../../mojo/public/c/gles2/gles2_call_visitor" |
| 8310 "../../mojo/public/c/gles2/gles2_call_visitor_autogen.h") | 8326 gen.WriteMojoGLCallVisitor(mojo_gles2_prefix + "_autogen.h") |
| 8327 gen.WriteMojoGLCallVisitorForExtension( |
| 8328 mojo_gles2_prefix + "_chromium_texture_mailbox_autogen.h", |
| 8329 "CHROMIUM_texture_mailbox") |
| 8330 gen.WriteMojoGLCallVisitorForExtension( |
| 8331 mojo_gles2_prefix + "_chromium_sync_point_autogen.h", |
| 8332 "CHROMIUM_sync_point") |
| 8311 | 8333 |
| 8312 Format([ | 8334 Format([ |
| 8313 "common/gles2_cmd_format_autogen.h", | 8335 "common/gles2_cmd_format_autogen.h", |
| 8314 "common/gles2_cmd_format_test_autogen.h", | 8336 "common/gles2_cmd_format_test_autogen.h", |
| 8315 "common/gles2_cmd_ids_autogen.h", | 8337 "common/gles2_cmd_ids_autogen.h", |
| 8316 "common/gles2_cmd_utils_autogen.h", | 8338 "common/gles2_cmd_utils_autogen.h", |
| 8317 "common/gles2_cmd_utils_implementation_autogen.h", | 8339 "common/gles2_cmd_utils_implementation_autogen.h", |
| 8318 "client/client_context_state_autogen.h", | 8340 "client/client_context_state_autogen.h", |
| 8319 "client/client_context_state_impl_autogen.h", | 8341 "client/client_context_state_impl_autogen.h", |
| 8320 "client/gles2_cmd_helper_autogen.h", | 8342 "client/gles2_cmd_helper_autogen.h", |
| 8321 "client/gles2_c_lib_autogen.h", | 8343 "client/gles2_c_lib_autogen.h", |
| 8322 "client/gles2_implementation_autogen.h", | 8344 "client/gles2_implementation_autogen.h", |
| 8323 "client/gles2_implementation_impl_autogen.h", | 8345 "client/gles2_implementation_impl_autogen.h", |
| 8324 "client/gles2_implementation_unittest_autogen.h", | 8346 "client/gles2_implementation_unittest_autogen.h", |
| 8325 "client/gles2_interface_autogen.h", | 8347 "client/gles2_interface_autogen.h", |
| 8326 "client/gles2_interface_stub_autogen.h", | 8348 "client/gles2_interface_stub_autogen.h", |
| 8327 "client/gles2_interface_stub_impl_autogen.h", | 8349 "client/gles2_interface_stub_impl_autogen.h", |
| 8328 "client/gles2_trace_implementation_autogen.h", | 8350 "client/gles2_trace_implementation_autogen.h", |
| 8329 "client/gles2_trace_implementation_impl_autogen.h", | 8351 "client/gles2_trace_implementation_impl_autogen.h", |
| 8330 "service/context_state_autogen.h", | 8352 "service/context_state_autogen.h", |
| 8331 "service/context_state_impl_autogen.h", | 8353 "service/context_state_impl_autogen.h", |
| 8332 "service/gles2_cmd_decoder_autogen.h", | 8354 "service/gles2_cmd_decoder_autogen.h", |
| 8333 "service/gles2_cmd_decoder_unittest_0_autogen.h", | 8355 "service/gles2_cmd_decoder_unittest_0_autogen.h", |
| 8334 "service/gles2_cmd_decoder_unittest_1_autogen.h", | 8356 "service/gles2_cmd_decoder_unittest_1_autogen.h", |
| 8335 "service/gles2_cmd_decoder_unittest_2_autogen.h", | 8357 "service/gles2_cmd_decoder_unittest_2_autogen.h", |
| 8336 "service/gles2_cmd_decoder_unittest_3_autogen.h", | 8358 "service/gles2_cmd_decoder_unittest_3_autogen.h", |
| 8337 "service/gles2_cmd_validation_autogen.h", | 8359 "service/gles2_cmd_validation_autogen.h", |
| 8338 "service/gles2_cmd_validation_implementation_autogen.h"]) | 8360 "service/gles2_cmd_validation_implementation_autogen.h"]) |
| 8339 os.chdir("../..") | 8361 os.chdir("../..") |
| 8362 mojo_gles2_prefix = "mojo/public/c/gles2/gles2_call_visitor" |
| 8340 Format([ | 8363 Format([ |
| 8341 "gpu/GLES2/gl2chromium_autogen.h", | 8364 "gpu/GLES2/gl2chromium_autogen.h", |
| 8342 "mojo/public/c/gles2/gles2_call_visitor_autogen.h", | 8365 mojo_gles2_prefix + "_autogen.h", |
| 8366 mojo_gles2_prefix + "_chromium_texture_mailbox_autogen.h", |
| 8367 mojo_gles2_prefix + "_chromium_sync_point_autogen.h", |
| 8343 "ppapi/c/dev/ppb_opengles2ext_dev.h", | 8368 "ppapi/c/dev/ppb_opengles2ext_dev.h", |
| 8344 "ppapi/c/ppb_opengles2.h", | 8369 "ppapi/c/ppb_opengles2.h", |
| 8345 "ppapi/lib/gl/gles2/gles2.c", | 8370 "ppapi/lib/gl/gles2/gles2.c", |
| 8346 "ppapi/shared_impl/ppb_opengles2_shared.cc"]) | 8371 "ppapi/shared_impl/ppb_opengles2_shared.cc"]) |
| 8347 | 8372 |
| 8348 if gen.errors > 0: | 8373 if gen.errors > 0: |
| 8349 print "%d errors" % gen.errors | 8374 print "%d errors" % gen.errors |
| 8350 return 1 | 8375 return 1 |
| 8351 return 0 | 8376 return 0 |
| 8352 | 8377 |
| 8353 | 8378 |
| 8354 if __name__ == '__main__': | 8379 if __name__ == '__main__': |
| 8355 sys.exit(main(sys.argv[1:])) | 8380 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |