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 1571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1582 'resource_types': 'Framebuffers', | 1582 'resource_types': 'Framebuffers', |
1583 }, | 1583 }, |
1584 'DeleteProgram': {'type': 'Delete', 'decoder_func': 'DoDeleteProgram'}, | 1584 'DeleteProgram': {'type': 'Delete', 'decoder_func': 'DoDeleteProgram'}, |
1585 'DeleteRenderbuffers': { | 1585 'DeleteRenderbuffers': { |
1586 'type': 'DELn', | 1586 'type': 'DELn', |
1587 'gl_test_func': 'glDeleteRenderbuffersEXT', | 1587 'gl_test_func': 'glDeleteRenderbuffersEXT', |
1588 'resource_type': 'Renderbuffer', | 1588 'resource_type': 'Renderbuffer', |
1589 'resource_types': 'Renderbuffers', | 1589 'resource_types': 'Renderbuffers', |
1590 }, | 1590 }, |
1591 'DeleteShader': {'type': 'Delete', 'decoder_func': 'DoDeleteShader'}, | 1591 'DeleteShader': {'type': 'Delete', 'decoder_func': 'DoDeleteShader'}, |
1592 'DeleteSharedIdsCHROMIUM': { | |
1593 'type': 'Custom', | |
1594 'decoder_func': 'DoDeleteSharedIdsCHROMIUM', | |
1595 'impl_func': False, | |
1596 'expectation': False, | |
1597 'data_transfer_methods': ['shm'], | |
1598 'extension': True, | |
1599 'chromium': True, | |
1600 }, | |
1601 'DeleteTextures': { | 1592 'DeleteTextures': { |
1602 'type': 'DELn', | 1593 'type': 'DELn', |
1603 'resource_type': 'Texture', | 1594 'resource_type': 'Texture', |
1604 'resource_types': 'Textures', | 1595 'resource_types': 'Textures', |
1605 }, | 1596 }, |
1606 'DepthRangef': { | 1597 'DepthRangef': { |
1607 'decoder_func': 'DoDepthRangef', | 1598 'decoder_func': 'DoDepthRangef', |
1608 'gl_test_func': 'glDepthRange', | 1599 'gl_test_func': 'glDepthRange', |
1609 }, | 1600 }, |
1610 'DepthMask': { | 1601 'DepthMask': { |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1699 'type': 'GENn', 'gl_test_func': 'glGenRenderbuffersEXT', | 1690 'type': 'GENn', 'gl_test_func': 'glGenRenderbuffersEXT', |
1700 'resource_type': 'Renderbuffer', | 1691 'resource_type': 'Renderbuffer', |
1701 'resource_types': 'Renderbuffers', | 1692 'resource_types': 'Renderbuffers', |
1702 }, | 1693 }, |
1703 'GenTextures': { | 1694 'GenTextures': { |
1704 'type': 'GENn', | 1695 'type': 'GENn', |
1705 'gl_test_func': 'glGenTextures', | 1696 'gl_test_func': 'glGenTextures', |
1706 'resource_type': 'Texture', | 1697 'resource_type': 'Texture', |
1707 'resource_types': 'Textures', | 1698 'resource_types': 'Textures', |
1708 }, | 1699 }, |
1709 'GenSharedIdsCHROMIUM': { | |
1710 'type': 'Custom', | |
1711 'decoder_func': 'DoGenSharedIdsCHROMIUM', | |
1712 'impl_func': False, | |
1713 'expectation': False, | |
1714 'data_transfer_methods': ['shm'], | |
1715 'extension': True, | |
1716 'chromium': True, | |
1717 }, | |
1718 'GetActiveAttrib': { | 1700 'GetActiveAttrib': { |
1719 'type': 'Custom', | 1701 'type': 'Custom', |
1720 'data_transfer_methods': ['shm'], | 1702 'data_transfer_methods': ['shm'], |
1721 'cmd_args': | 1703 'cmd_args': |
1722 'GLidProgram program, GLuint index, uint32_t name_bucket_id, ' | 1704 'GLidProgram program, GLuint index, uint32_t name_bucket_id, ' |
1723 'void* result', | 1705 'void* result', |
1724 'result': [ | 1706 'result': [ |
1725 'int32_t success', | 1707 'int32_t success', |
1726 'int32_t size', | 1708 'int32_t size', |
1727 'uint32_t type', | 1709 'uint32_t type', |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2065 'client_test': False, | 2047 'client_test': False, |
2066 'cmd_args': | 2048 'cmd_args': |
2067 'GLint x, GLint y, GLsizei width, GLsizei height, ' | 2049 'GLint x, GLint y, GLsizei width, GLsizei height, ' |
2068 'GLenumReadPixelFormat format, GLenumReadPixelType type, ' | 2050 'GLenumReadPixelFormat format, GLenumReadPixelType type, ' |
2069 'uint32_t pixels_shm_id, uint32_t pixels_shm_offset, ' | 2051 'uint32_t pixels_shm_id, uint32_t pixels_shm_offset, ' |
2070 'uint32_t result_shm_id, uint32_t result_shm_offset, ' | 2052 'uint32_t result_shm_id, uint32_t result_shm_offset, ' |
2071 'GLboolean async', | 2053 'GLboolean async', |
2072 'result': ['uint32_t'], | 2054 'result': ['uint32_t'], |
2073 'defer_reads': True, | 2055 'defer_reads': True, |
2074 }, | 2056 }, |
2075 'RegisterSharedIdsCHROMIUM': { | |
2076 'type': 'Custom', | |
2077 'decoder_func': 'DoRegisterSharedIdsCHROMIUM', | |
2078 'impl_func': False, | |
2079 'expectation': False, | |
2080 'data_transfer_methods': ['shm'], | |
2081 'extension': True, | |
2082 'chromium': True, | |
2083 }, | |
2084 'ReleaseShaderCompiler': { | 2057 'ReleaseShaderCompiler': { |
2085 'decoder_func': 'DoReleaseShaderCompiler', | 2058 'decoder_func': 'DoReleaseShaderCompiler', |
2086 'unit_test': False, | 2059 'unit_test': False, |
2087 }, | 2060 }, |
2088 'ShaderBinary': { | 2061 'ShaderBinary': { |
2089 'type': 'Custom', | 2062 'type': 'Custom', |
2090 'client_test': False, | 2063 'client_test': False, |
2091 }, | 2064 }, |
2092 'ShaderSource': { | 2065 'ShaderSource': { |
2093 'type': 'Manual', | 2066 'type': 'Manual', |
(...skipping 2069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4163 file.Write( | 4136 file.Write( |
4164 "%(return_type)s GLES2Implementation::%(name)s(%(typed_args)s) {\n" % | 4137 "%(return_type)s GLES2Implementation::%(name)s(%(typed_args)s) {\n" % |
4165 args) | 4138 args) |
4166 func.WriteDestinationInitalizationValidation(file) | 4139 func.WriteDestinationInitalizationValidation(file) |
4167 self.WriteClientGLCallLog(func, file) | 4140 self.WriteClientGLCallLog(func, file) |
4168 for arg in func.GetOriginalArgs(): | 4141 for arg in func.GetOriginalArgs(): |
4169 arg.WriteClientSideValidationCode(file, func) | 4142 arg.WriteClientSideValidationCode(file, func) |
4170 not_shared = func.GetInfo('not_shared') | 4143 not_shared = func.GetInfo('not_shared') |
4171 if not_shared: | 4144 if not_shared: |
4172 alloc_code = ( | 4145 alloc_code = ( |
4173 """ IdAllocatorInterface* id_allocator = GetIdAllocator(id_namespaces::k%s); | 4146 |
| 4147 """ IdAllocator* id_allocator = GetIdAllocator(id_namespaces::k%s); |
4174 for (GLsizei ii = 0; ii < n; ++ii) | 4148 for (GLsizei ii = 0; ii < n; ++ii) |
4175 %s[ii] = id_allocator->AllocateID();""" % | 4149 %s[ii] = id_allocator->AllocateID();""" % |
4176 (func.GetInfo('resource_types'), func.GetOriginalArgs()[1].name)) | 4150 (func.GetInfo('resource_types'), func.GetOriginalArgs()[1].name)) |
4177 else: | 4151 else: |
4178 alloc_code = (""" GetIdHandler(id_namespaces::k%(resource_types)s)-> | 4152 alloc_code = (""" GetIdHandler(id_namespaces::k%(resource_types)s)-> |
4179 MakeIds(this, 0, %(args)s);""" % args) | 4153 MakeIds(this, 0, %(args)s);""" % args) |
4180 args['alloc_code'] = alloc_code | 4154 args['alloc_code'] = alloc_code |
4181 | 4155 |
4182 code = """ GPU_CLIENT_SINGLE_THREAD_CHECK(); | 4156 code = """ GPU_CLIENT_SINGLE_THREAD_CHECK(); |
4183 %(alloc_code)s | 4157 %(alloc_code)s |
(...skipping 4460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8644 Format(gen.generated_cpp_filenames) | 8618 Format(gen.generated_cpp_filenames) |
8645 | 8619 |
8646 if gen.errors > 0: | 8620 if gen.errors > 0: |
8647 print "%d errors" % gen.errors | 8621 print "%d errors" % gen.errors |
8648 return 1 | 8622 return 1 |
8649 return 0 | 8623 return 0 |
8650 | 8624 |
8651 | 8625 |
8652 if __name__ == '__main__': | 8626 if __name__ == '__main__': |
8653 sys.exit(main(sys.argv[1:])) | 8627 sys.exit(main(sys.argv[1:])) |
OLD | NEW |