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 2694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2705 if func.GetInfo('needs_size') and not func.name.endswith('Bucket'): | 2705 if func.GetInfo('needs_size') and not func.name.endswith('Bucket'): |
2706 func.AddCmdArg(DataSizeArgument('data_size')) | 2706 func.AddCmdArg(DataSizeArgument('data_size')) |
2707 | 2707 |
2708 def AddImmediateFunction(self, generator, func): | 2708 def AddImmediateFunction(self, generator, func): |
2709 """Adds an immediate version of a function.""" | 2709 """Adds an immediate version of a function.""" |
2710 # Generate an immediate command if there is only 1 pointer arg. | 2710 # Generate an immediate command if there is only 1 pointer arg. |
2711 immediate = func.GetInfo('immediate') # can be True, False or None | 2711 immediate = func.GetInfo('immediate') # can be True, False or None |
2712 if immediate == True or immediate == None: | 2712 if immediate == True or immediate == None: |
2713 if func.num_pointer_args == 1 or immediate: | 2713 if func.num_pointer_args == 1 or immediate: |
2714 generator.AddFunction(ImmediateFunction(func)) | 2714 generator.AddFunction(ImmediateFunction(func)) |
| 2715 return True |
2715 | 2716 |
2716 def AddBucketFunction(self, generator, func): | 2717 def AddBucketFunction(self, generator, func): |
2717 """Adds a bucket version of a function.""" | 2718 """Adds a bucket version of a function.""" |
2718 # Generate an immediate command if there is only 1 pointer arg. | 2719 # Generate an immediate command if there is only 1 pointer arg. |
2719 bucket = func.GetInfo('bucket') # can be True, False or None | 2720 bucket = func.GetInfo('bucket') # can be True, False or None |
2720 if bucket: | 2721 if bucket: |
2721 generator.AddFunction(BucketFunction(func)) | 2722 generator.AddFunction(BucketFunction(func)) |
2722 | 2723 |
2723 def WriteStruct(self, func, file): | 2724 def WriteStruct(self, func, file): |
2724 """Writes a structure that matches the arguments to a function.""" | 2725 """Writes a structure that matches the arguments to a function.""" |
(...skipping 4580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7305 | 7306 |
7306 f = Function(func_name, func_info) | 7307 f = Function(func_name, func_info) |
7307 self.original_functions.append(f) | 7308 self.original_functions.append(f) |
7308 | 7309 |
7309 #for arg in f.GetOriginalArgs(): | 7310 #for arg in f.GetOriginalArgs(): |
7310 # if not isinstance(arg, EnumArgument) and arg.type == 'GLenum': | 7311 # if not isinstance(arg, EnumArgument) and arg.type == 'GLenum': |
7311 # self.Log("%s uses bare GLenum %s." % (func_name, arg.name)) | 7312 # self.Log("%s uses bare GLenum %s." % (func_name, arg.name)) |
7312 | 7313 |
7313 gen_cmd = f.GetInfo('gen_cmd') | 7314 gen_cmd = f.GetInfo('gen_cmd') |
7314 if gen_cmd == True or gen_cmd == None: | 7315 if gen_cmd == True or gen_cmd == None: |
7315 self.AddFunction(f) | 7316 if not f.type_handler.AddImmediateFunction(self, f): |
7316 f.type_handler.AddImmediateFunction(self, f) | 7317 self.AddFunction(f) |
7317 f.type_handler.AddBucketFunction(self, f) | 7318 f.type_handler.AddBucketFunction(self, f) |
7318 | 7319 |
7319 self.Log("Auto Generated Functions : %d" % | 7320 self.Log("Auto Generated Functions : %d" % |
7320 len([f for f in self.functions if f.can_auto_generate or | 7321 len([f for f in self.functions if f.can_auto_generate or |
7321 (not f.IsType('') and not f.IsType('Custom') and | 7322 (not f.IsType('') and not f.IsType('Custom') and |
7322 not f.IsType('Todo'))])) | 7323 not f.IsType('Todo'))])) |
7323 | 7324 |
7324 funcs = [f for f in self.functions if not f.can_auto_generate and | 7325 funcs = [f for f in self.functions if not f.can_auto_generate and |
7325 (f.IsType('') or f.IsType('Custom') or f.IsType('Todo'))] | 7326 (f.IsType('') or f.IsType('Custom') or f.IsType('Todo'))] |
7326 self.Log("Non Auto Generated Functions: %d" % len(funcs)) | 7327 self.Log("Non Auto Generated Functions: %d" % len(funcs)) |
(...skipping 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8337 "ppapi/shared_impl/ppb_opengles2_shared.cc"]) | 8338 "ppapi/shared_impl/ppb_opengles2_shared.cc"]) |
8338 | 8339 |
8339 if gen.errors > 0: | 8340 if gen.errors > 0: |
8340 print "%d errors" % gen.errors | 8341 print "%d errors" % gen.errors |
8341 return 1 | 8342 return 1 |
8342 return 0 | 8343 return 0 |
8343 | 8344 |
8344 | 8345 |
8345 if __name__ == '__main__': | 8346 if __name__ == '__main__': |
8346 sys.exit(main(sys.argv[1:])) | 8347 sys.exit(main(sys.argv[1:])) |
OLD | NEW |