| 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 3121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3132 file.Write("// TODO(gman): %s\n" % func.name) | 3132 file.Write("// TODO(gman): %s\n" % func.name) |
| 3133 | 3133 |
| 3134 def WriteBucketValidationCode(self, func, file): | 3134 def WriteBucketValidationCode(self, func, file): |
| 3135 """Writes the validation code for a bucket version of a command.""" | 3135 """Writes the validation code for a bucket version of a command.""" |
| 3136 file.Write("// TODO(gman): %s\n" % func.name) | 3136 file.Write("// TODO(gman): %s\n" % func.name) |
| 3137 | 3137 |
| 3138 def WriteGLES2ImplementationDeclaration(self, func, file): | 3138 def WriteGLES2ImplementationDeclaration(self, func, file): |
| 3139 """Writes the GLES2 Implemention declaration.""" | 3139 """Writes the GLES2 Implemention declaration.""" |
| 3140 impl_decl = func.GetInfo('impl_decl') | 3140 impl_decl = func.GetInfo('impl_decl') |
| 3141 if impl_decl == None or impl_decl == True: | 3141 if impl_decl == None or impl_decl == True: |
| 3142 file.Write("virtual %s %s(%s) override;\n" % | 3142 file.Write("%s %s(%s) override;\n" % |
| 3143 (func.return_type, func.original_name, | 3143 (func.return_type, func.original_name, |
| 3144 func.MakeTypedOriginalArgString(""))) | 3144 func.MakeTypedOriginalArgString(""))) |
| 3145 file.Write("\n") | 3145 file.Write("\n") |
| 3146 | 3146 |
| 3147 def WriteGLES2CLibImplementation(self, func, file): | 3147 def WriteGLES2CLibImplementation(self, func, file): |
| 3148 file.Write("%s GLES2%s(%s) {\n" % | 3148 file.Write("%s GLES2%s(%s) {\n" % |
| 3149 (func.return_type, func.name, | 3149 (func.return_type, func.name, |
| 3150 func.MakeTypedOriginalArgString(""))) | 3150 func.MakeTypedOriginalArgString(""))) |
| 3151 result_string = "return " | 3151 result_string = "return " |
| 3152 if func.return_type == "void": | 3152 if func.return_type == "void": |
| (...skipping 20 matching lines...) Expand all Loading... |
| 3173 """Writes the return value logging code.""" | 3173 """Writes the return value logging code.""" |
| 3174 if func.return_type != "void": | 3174 if func.return_type != "void": |
| 3175 file.Write(' GPU_CLIENT_LOG("return:" << result)\n') | 3175 file.Write(' GPU_CLIENT_LOG("return:" << result)\n') |
| 3176 | 3176 |
| 3177 def WriteGLES2ImplementationHeader(self, func, file): | 3177 def WriteGLES2ImplementationHeader(self, func, file): |
| 3178 """Writes the GLES2 Implemention.""" | 3178 """Writes the GLES2 Implemention.""" |
| 3179 self.WriteGLES2ImplementationDeclaration(func, file) | 3179 self.WriteGLES2ImplementationDeclaration(func, file) |
| 3180 | 3180 |
| 3181 def WriteGLES2TraceImplementationHeader(self, func, file): | 3181 def WriteGLES2TraceImplementationHeader(self, func, file): |
| 3182 """Writes the GLES2 Trace Implemention header.""" | 3182 """Writes the GLES2 Trace Implemention header.""" |
| 3183 file.Write("virtual %s %s(%s) override;\n" % | 3183 file.Write("%s %s(%s) override;\n" % |
| 3184 (func.return_type, func.original_name, | 3184 (func.return_type, func.original_name, |
| 3185 func.MakeTypedOriginalArgString(""))) | 3185 func.MakeTypedOriginalArgString(""))) |
| 3186 | 3186 |
| 3187 def WriteGLES2TraceImplementation(self, func, file): | 3187 def WriteGLES2TraceImplementation(self, func, file): |
| 3188 """Writes the GLES2 Trace Implemention.""" | 3188 """Writes the GLES2 Trace Implemention.""" |
| 3189 file.Write("%s GLES2TraceImplementation::%s(%s) {\n" % | 3189 file.Write("%s GLES2TraceImplementation::%s(%s) {\n" % |
| 3190 (func.return_type, func.original_name, | 3190 (func.return_type, func.original_name, |
| 3191 func.MakeTypedOriginalArgString(""))) | 3191 func.MakeTypedOriginalArgString(""))) |
| 3192 result_string = "return " | 3192 result_string = "return " |
| 3193 if func.return_type == "void": | 3193 if func.return_type == "void": |
| (...skipping 30 matching lines...) Expand all Loading... |
| 3224 file.Write("\n") | 3224 file.Write("\n") |
| 3225 | 3225 |
| 3226 def WriteGLES2InterfaceHeader(self, func, file): | 3226 def WriteGLES2InterfaceHeader(self, func, file): |
| 3227 """Writes the GLES2 Interface.""" | 3227 """Writes the GLES2 Interface.""" |
| 3228 file.Write("virtual %s %s(%s) = 0;\n" % | 3228 file.Write("virtual %s %s(%s) = 0;\n" % |
| 3229 (func.return_type, func.original_name, | 3229 (func.return_type, func.original_name, |
| 3230 func.MakeTypedOriginalArgString(""))) | 3230 func.MakeTypedOriginalArgString(""))) |
| 3231 | 3231 |
| 3232 def WriteGLES2InterfaceStub(self, func, file): | 3232 def WriteGLES2InterfaceStub(self, func, file): |
| 3233 """Writes the GLES2 Interface stub declaration.""" | 3233 """Writes the GLES2 Interface stub declaration.""" |
| 3234 file.Write("virtual %s %s(%s) override;\n" % | 3234 file.Write("%s %s(%s) override;\n" % |
| 3235 (func.return_type, func.original_name, | 3235 (func.return_type, func.original_name, |
| 3236 func.MakeTypedOriginalArgString(""))) | 3236 func.MakeTypedOriginalArgString(""))) |
| 3237 | 3237 |
| 3238 def WriteGLES2InterfaceStubImpl(self, func, file): | 3238 def WriteGLES2InterfaceStubImpl(self, func, file): |
| 3239 """Writes the GLES2 Interface stub declaration.""" | 3239 """Writes the GLES2 Interface stub declaration.""" |
| 3240 args = func.GetOriginalArgs() | 3240 args = func.GetOriginalArgs() |
| 3241 arg_string = ", ".join( | 3241 arg_string = ", ".join( |
| 3242 ["%s /* %s */" % (arg.type, arg.name) for arg in args]) | 3242 ["%s /* %s */" % (arg.type, arg.name) for arg in args]) |
| 3243 file.Write("%s GLES2InterfaceStub::%s(%s) {\n" % | 3243 file.Write("%s GLES2InterfaceStub::%s(%s) {\n" % |
| 3244 (func.return_type, func.original_name, arg_string)) | 3244 (func.return_type, func.original_name, arg_string)) |
| (...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3821 """Overrriden from TypeHandler.""" | 3821 """Overrriden from TypeHandler.""" |
| 3822 file.Write("// TODO(gman): Implement test for %s\n" % func.name) | 3822 file.Write("// TODO(gman): Implement test for %s\n" % func.name) |
| 3823 | 3823 |
| 3824 def WriteGLES2Implementation(self, func, file): | 3824 def WriteGLES2Implementation(self, func, file): |
| 3825 """Overrriden from TypeHandler.""" | 3825 """Overrriden from TypeHandler.""" |
| 3826 if func.GetInfo('impl_func'): | 3826 if func.GetInfo('impl_func'): |
| 3827 super(ManualHandler, self).WriteGLES2Implementation(func, file) | 3827 super(ManualHandler, self).WriteGLES2Implementation(func, file) |
| 3828 | 3828 |
| 3829 def WriteGLES2ImplementationHeader(self, func, file): | 3829 def WriteGLES2ImplementationHeader(self, func, file): |
| 3830 """Overrriden from TypeHandler.""" | 3830 """Overrriden from TypeHandler.""" |
| 3831 file.Write("virtual %s %s(%s) override;\n" % | 3831 file.Write("%s %s(%s) override;\n" % |
| 3832 (func.return_type, func.original_name, | 3832 (func.return_type, func.original_name, |
| 3833 func.MakeTypedOriginalArgString(""))) | 3833 func.MakeTypedOriginalArgString(""))) |
| 3834 file.Write("\n") | 3834 file.Write("\n") |
| 3835 | 3835 |
| 3836 def WriteImmediateCmdGetTotalSize(self, func, file): | 3836 def WriteImmediateCmdGetTotalSize(self, func, file): |
| 3837 """Overrriden from TypeHandler.""" | 3837 """Overrriden from TypeHandler.""" |
| 3838 # TODO(gman): Move this data to _FUNCTION_INFO? | 3838 # TODO(gman): Move this data to _FUNCTION_INFO? |
| 3839 CustomHandler.WriteImmediateCmdGetTotalSize(self, func, file) | 3839 CustomHandler.WriteImmediateCmdGetTotalSize(self, func, file) |
| 3840 | 3840 |
| 3841 | 3841 |
| (...skipping 4784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8626 Format(gen.generated_cpp_filenames) | 8626 Format(gen.generated_cpp_filenames) |
| 8627 | 8627 |
| 8628 if gen.errors > 0: | 8628 if gen.errors > 0: |
| 8629 print "%d errors" % gen.errors | 8629 print "%d errors" % gen.errors |
| 8630 return 1 | 8630 return 1 |
| 8631 return 0 | 8631 return 0 |
| 8632 | 8632 |
| 8633 | 8633 |
| 8634 if __name__ == '__main__': | 8634 if __name__ == '__main__': |
| 8635 sys.exit(main(sys.argv[1:])) | 8635 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |