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 6141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6152 (func.name, func.GetLastOriginalArg().name)) | 6152 (func.name, func.GetLastOriginalArg().name)) |
6153 | 6153 |
6154 def WriteImmediateHandlerImplementation(self, func, f): | 6154 def WriteImmediateHandlerImplementation(self, func, f): |
6155 """Overrriden from TypeHandler.""" | 6155 """Overrriden from TypeHandler.""" |
6156 if func.IsUnsafe() and not func.UseHelper(): | 6156 if func.IsUnsafe() and not func.UseHelper(): |
6157 f.write(""" for (GLsizei ii = 0; ii < n; ++ii) { | 6157 f.write(""" for (GLsizei ii = 0; ii < n; ++ii) { |
6158 if (group_->Get%(resource_name)sServiceId(%(last_arg_name)s[ii], NULL)) { | 6158 if (group_->Get%(resource_name)sServiceId(%(last_arg_name)s[ii], NULL)) { |
6159 return error::kInvalidArguments; | 6159 return error::kInvalidArguments; |
6160 } | 6160 } |
6161 } | 6161 } |
6162 scoped_ptr<GLuint[]> service_ids(new GLuint[n]); | 6162 std::unique_ptr<GLuint[]> service_ids(new GLuint[n]); |
6163 gl%(func_name)s(n, service_ids.get()); | 6163 gl%(func_name)s(n, service_ids.get()); |
6164 for (GLsizei ii = 0; ii < n; ++ii) { | 6164 for (GLsizei ii = 0; ii < n; ++ii) { |
6165 group_->Add%(resource_name)sId(%(last_arg_name)s[ii], service_ids[ii]); | 6165 group_->Add%(resource_name)sId(%(last_arg_name)s[ii], service_ids[ii]); |
6166 } | 6166 } |
6167 """ % { 'func_name': func.original_name, | 6167 """ % { 'func_name': func.original_name, |
6168 'last_arg_name': func.GetLastOriginalArg().name, | 6168 'last_arg_name': func.GetLastOriginalArg().name, |
6169 'resource_name': func.GetInfo('resource_type') }) | 6169 'resource_name': func.GetInfo('resource_type') }) |
6170 else: | 6170 else: |
6171 f.write(" if (!%sHelper(n, %s)) {\n" | 6171 f.write(" if (!%sHelper(n, %s)) {\n" |
6172 " return error::kInvalidArguments;\n" | 6172 " return error::kInvalidArguments;\n" |
(...skipping 5396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11569 Format(gen.generated_cpp_filenames) | 11569 Format(gen.generated_cpp_filenames) |
11570 | 11570 |
11571 if gen.errors > 0: | 11571 if gen.errors > 0: |
11572 print "%d errors" % gen.errors | 11572 print "%d errors" % gen.errors |
11573 return 1 | 11573 return 1 |
11574 return 0 | 11574 return 0 |
11575 | 11575 |
11576 | 11576 |
11577 if __name__ == '__main__': | 11577 if __name__ == '__main__': |
11578 sys.exit(main(sys.argv[1:])) | 11578 sys.exit(main(sys.argv[1:])) |
OLD | NEW |