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 2010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2021 'data_transfer_methods': ['shm'], | 2021 'data_transfer_methods': ['shm'], |
2022 'cmd_args': 'GLidProgram program, void* result, uint32_t result_size', | 2022 'cmd_args': 'GLidProgram program, void* result, uint32_t result_size', |
2023 'result': ['SizedResult<GLuint>'], | 2023 'result': ['SizedResult<GLuint>'], |
2024 }, | 2024 }, |
2025 'GetAttribLocation': { | 2025 'GetAttribLocation': { |
2026 'type': 'Custom', | 2026 'type': 'Custom', |
2027 'data_transfer_methods': ['shm'], | 2027 'data_transfer_methods': ['shm'], |
2028 'cmd_args': | 2028 'cmd_args': |
2029 'GLidProgram program, uint32_t name_bucket_id, GLint* location', | 2029 'GLidProgram program, uint32_t name_bucket_id, GLint* location', |
2030 'result': ['GLint'], | 2030 'result': ['GLint'], |
2031 'error_return': -1, # http://www.opengl.org/sdk/docs/man/xhtml/glGetAttribLo
cation.xml | 2031 'error_return': -1, |
| 2032 }, |
| 2033 'GetFragDataLocation': { |
| 2034 'type': 'Custom', |
| 2035 'data_transfer_methods': ['shm'], |
| 2036 'cmd_args': |
| 2037 'GLidProgram program, uint32_t name_bucket_id, GLint* location', |
| 2038 'result': ['GLint'], |
| 2039 'error_return': -1, |
| 2040 'unsafe': True, |
2032 }, | 2041 }, |
2033 'GetBooleanv': { | 2042 'GetBooleanv': { |
2034 'type': 'GETn', | 2043 'type': 'GETn', |
2035 'result': ['SizedResult<GLboolean>'], | 2044 'result': ['SizedResult<GLboolean>'], |
2036 'decoder_func': 'DoGetBooleanv', | 2045 'decoder_func': 'DoGetBooleanv', |
2037 'gl_test_func': 'glGetBooleanv', | 2046 'gl_test_func': 'glGetBooleanv', |
2038 }, | 2047 }, |
2039 'GetBufferParameteriv': { | 2048 'GetBufferParameteriv': { |
2040 'type': 'GETn', | 2049 'type': 'GETn', |
2041 'result': ['SizedResult<GLint>'], | 2050 'result': ['SizedResult<GLint>'], |
(...skipping 1789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3831 gl_arg_strings.append(arg.GetValidClientSideArg(func)) | 3840 gl_arg_strings.append(arg.GetValidClientSideArg(func)) |
3832 | 3841 |
3833 file.Write(code % { | 3842 file.Write(code % { |
3834 'name': func.name, | 3843 'name': func.name, |
3835 'invalid_index': func.GetOriginalArgs().index(invalid_arg), | 3844 'invalid_index': func.GetOriginalArgs().index(invalid_arg), |
3836 'args': ", ".join(gl_arg_strings), | 3845 'args': ", ".join(gl_arg_strings), |
3837 'gl_error': invalid[2], | 3846 'gl_error': invalid[2], |
3838 }) | 3847 }) |
3839 else: | 3848 else: |
3840 if client_test != False: | 3849 if client_test != False: |
3841 file.Write("// TODO: Implement unit test for %s\n" % func.name) | 3850 file.Write("// TODO(zmo): Implement unit test for %s\n" % func.name) |
3842 | 3851 |
3843 def WriteDestinationInitalizationValidation(self, func, file): | 3852 def WriteDestinationInitalizationValidation(self, func, file): |
3844 """Writes the client side destintion initialization validation.""" | 3853 """Writes the client side destintion initialization validation.""" |
3845 for arg in func.GetOriginalArgs(): | 3854 for arg in func.GetOriginalArgs(): |
3846 arg.WriteDestinationInitalizationValidation(file, func) | 3855 arg.WriteDestinationInitalizationValidation(file, func) |
3847 | 3856 |
3848 def WriteTraceEvent(self, func, file): | 3857 def WriteTraceEvent(self, func, file): |
3849 file.Write(' TRACE_EVENT0("gpu", "GLES2Implementation::%s");\n' % | 3858 file.Write(' TRACE_EVENT0("gpu", "GLES2Implementation::%s");\n' % |
3850 func.original_name) | 3859 func.original_name) |
3851 | 3860 |
(...skipping 6200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10052 Format(gen.generated_cpp_filenames) | 10061 Format(gen.generated_cpp_filenames) |
10053 | 10062 |
10054 if gen.errors > 0: | 10063 if gen.errors > 0: |
10055 print "%d errors" % gen.errors | 10064 print "%d errors" % gen.errors |
10056 return 1 | 10065 return 1 |
10057 return 0 | 10066 return 0 |
10058 | 10067 |
10059 | 10068 |
10060 if __name__ == '__main__': | 10069 if __name__ == '__main__': |
10061 sys.exit(main(sys.argv[1:])) | 10070 sys.exit(main(sys.argv[1:])) |
OLD | NEW |