| 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 os | 8 import os |
| 9 import os.path | 9 import os.path |
| 10 import sys | 10 import sys |
| (...skipping 4828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4839 | 4839 |
| 4840 self.local_type = type | 4840 self.local_type = type |
| 4841 self.gl_error = gl_error | 4841 self.gl_error = gl_error |
| 4842 name = type[len(gl_type):] | 4842 name = type[len(gl_type):] |
| 4843 self.type_name = name | 4843 self.type_name = name |
| 4844 self.enum_info = _ENUM_LISTS[name] | 4844 self.enum_info = _ENUM_LISTS[name] |
| 4845 | 4845 |
| 4846 def WriteValidationCode(self, file, func): | 4846 def WriteValidationCode(self, file, func): |
| 4847 file.Write(" if (!validators_->%s.IsValid(%s)) {\n" % | 4847 file.Write(" if (!validators_->%s.IsValid(%s)) {\n" % |
| 4848 (ToUnderscore(self.type_name), self.name)) | 4848 (ToUnderscore(self.type_name), self.name)) |
| 4849 file.Write(" SetGLError(%s, \"gl%s\", \"%s %s\");\n" % | 4849 if self.gl_error == "GL_INVALID_ENUM": |
| 4850 (self.gl_error, func.original_name, self.name, self.gl_error)) | 4850 file.Write( |
| 4851 " SetGLErrorInvalidEnum(\"gl%s\", %s, \"%s\");\n" % |
| 4852 (func.original_name, self.name, self.name)) |
| 4853 else: |
| 4854 file.Write( |
| 4855 " SetGLError(%s, \"gl%s\", \"%s %s\");\n" % |
| 4856 (self.gl_error, func.original_name, self.name, self.gl_error)) |
| 4851 file.Write(" return error::kNoError;\n") | 4857 file.Write(" return error::kNoError;\n") |
| 4852 file.Write(" }\n") | 4858 file.Write(" }\n") |
| 4853 | 4859 |
| 4854 def GetValidArg(self, func, offset, index): | 4860 def GetValidArg(self, func, offset, index): |
| 4855 valid_arg = func.GetValidArg(offset) | 4861 valid_arg = func.GetValidArg(offset) |
| 4856 if valid_arg != None: | 4862 if valid_arg != None: |
| 4857 return valid_arg | 4863 return valid_arg |
| 4858 if 'valid' in self.enum_info: | 4864 if 'valid' in self.enum_info: |
| 4859 valid = self.enum_info['valid'] | 4865 valid = self.enum_info['valid'] |
| 4860 num_valid = len(valid) | 4866 num_valid = len(valid) |
| (...skipping 1481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6342 gen.WriteCommonUtilsImpl("common/gles2_cmd_utils_implementation_autogen.h") | 6348 gen.WriteCommonUtilsImpl("common/gles2_cmd_utils_implementation_autogen.h") |
| 6343 | 6349 |
| 6344 if gen.errors > 0: | 6350 if gen.errors > 0: |
| 6345 print "%d errors" % gen.errors | 6351 print "%d errors" % gen.errors |
| 6346 return 1 | 6352 return 1 |
| 6347 return 0 | 6353 return 0 |
| 6348 | 6354 |
| 6349 | 6355 |
| 6350 if __name__ == '__main__': | 6356 if __name__ == '__main__': |
| 6351 sys.exit(main(sys.argv[1:])) | 6357 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |