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 3140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3151 file.Write("// TODO(gman): %s\n" % func.name) | 3151 file.Write("// TODO(gman): %s\n" % func.name) |
3152 | 3152 |
3153 def WriteBucketValidationCode(self, func, file): | 3153 def WriteBucketValidationCode(self, func, file): |
3154 """Writes the validation code for a bucket version of a command.""" | 3154 """Writes the validation code for a bucket version of a command.""" |
3155 file.Write("// TODO(gman): %s\n" % func.name) | 3155 file.Write("// TODO(gman): %s\n" % func.name) |
3156 | 3156 |
3157 def WriteGLES2ImplementationDeclaration(self, func, file): | 3157 def WriteGLES2ImplementationDeclaration(self, func, file): |
3158 """Writes the GLES2 Implemention declaration.""" | 3158 """Writes the GLES2 Implemention declaration.""" |
3159 impl_decl = func.GetInfo('impl_decl') | 3159 impl_decl = func.GetInfo('impl_decl') |
3160 if impl_decl == None or impl_decl == True: | 3160 if impl_decl == None or impl_decl == True: |
3161 file.Write("virtual %s %s(%s) OVERRIDE;\n" % | 3161 file.Write("virtual %s %s(%s) override;\n" % |
3162 (func.return_type, func.original_name, | 3162 (func.return_type, func.original_name, |
3163 func.MakeTypedOriginalArgString(""))) | 3163 func.MakeTypedOriginalArgString(""))) |
3164 file.Write("\n") | 3164 file.Write("\n") |
3165 | 3165 |
3166 def WriteGLES2CLibImplementation(self, func, file): | 3166 def WriteGLES2CLibImplementation(self, func, file): |
3167 file.Write("%s GLES2%s(%s) {\n" % | 3167 file.Write("%s GLES2%s(%s) {\n" % |
3168 (func.return_type, func.name, | 3168 (func.return_type, func.name, |
3169 func.MakeTypedOriginalArgString(""))) | 3169 func.MakeTypedOriginalArgString(""))) |
3170 result_string = "return " | 3170 result_string = "return " |
3171 if func.return_type == "void": | 3171 if func.return_type == "void": |
(...skipping 20 matching lines...) Expand all Loading... |
3192 """Writes the return value logging code.""" | 3192 """Writes the return value logging code.""" |
3193 if func.return_type != "void": | 3193 if func.return_type != "void": |
3194 file.Write(' GPU_CLIENT_LOG("return:" << result)\n') | 3194 file.Write(' GPU_CLIENT_LOG("return:" << result)\n') |
3195 | 3195 |
3196 def WriteGLES2ImplementationHeader(self, func, file): | 3196 def WriteGLES2ImplementationHeader(self, func, file): |
3197 """Writes the GLES2 Implemention.""" | 3197 """Writes the GLES2 Implemention.""" |
3198 self.WriteGLES2ImplementationDeclaration(func, file) | 3198 self.WriteGLES2ImplementationDeclaration(func, file) |
3199 | 3199 |
3200 def WriteGLES2TraceImplementationHeader(self, func, file): | 3200 def WriteGLES2TraceImplementationHeader(self, func, file): |
3201 """Writes the GLES2 Trace Implemention header.""" | 3201 """Writes the GLES2 Trace Implemention header.""" |
3202 file.Write("virtual %s %s(%s) OVERRIDE;\n" % | 3202 file.Write("virtual %s %s(%s) override;\n" % |
3203 (func.return_type, func.original_name, | 3203 (func.return_type, func.original_name, |
3204 func.MakeTypedOriginalArgString(""))) | 3204 func.MakeTypedOriginalArgString(""))) |
3205 | 3205 |
3206 def WriteGLES2TraceImplementation(self, func, file): | 3206 def WriteGLES2TraceImplementation(self, func, file): |
3207 """Writes the GLES2 Trace Implemention.""" | 3207 """Writes the GLES2 Trace Implemention.""" |
3208 file.Write("%s GLES2TraceImplementation::%s(%s) {\n" % | 3208 file.Write("%s GLES2TraceImplementation::%s(%s) {\n" % |
3209 (func.return_type, func.original_name, | 3209 (func.return_type, func.original_name, |
3210 func.MakeTypedOriginalArgString(""))) | 3210 func.MakeTypedOriginalArgString(""))) |
3211 result_string = "return " | 3211 result_string = "return " |
3212 if func.return_type == "void": | 3212 if func.return_type == "void": |
(...skipping 30 matching lines...) Expand all Loading... |
3243 file.Write("\n") | 3243 file.Write("\n") |
3244 | 3244 |
3245 def WriteGLES2InterfaceHeader(self, func, file): | 3245 def WriteGLES2InterfaceHeader(self, func, file): |
3246 """Writes the GLES2 Interface.""" | 3246 """Writes the GLES2 Interface.""" |
3247 file.Write("virtual %s %s(%s) = 0;\n" % | 3247 file.Write("virtual %s %s(%s) = 0;\n" % |
3248 (func.return_type, func.original_name, | 3248 (func.return_type, func.original_name, |
3249 func.MakeTypedOriginalArgString(""))) | 3249 func.MakeTypedOriginalArgString(""))) |
3250 | 3250 |
3251 def WriteGLES2InterfaceStub(self, func, file): | 3251 def WriteGLES2InterfaceStub(self, func, file): |
3252 """Writes the GLES2 Interface stub declaration.""" | 3252 """Writes the GLES2 Interface stub declaration.""" |
3253 file.Write("virtual %s %s(%s) OVERRIDE;\n" % | 3253 file.Write("virtual %s %s(%s) override;\n" % |
3254 (func.return_type, func.original_name, | 3254 (func.return_type, func.original_name, |
3255 func.MakeTypedOriginalArgString(""))) | 3255 func.MakeTypedOriginalArgString(""))) |
3256 | 3256 |
3257 def WriteGLES2InterfaceStubImpl(self, func, file): | 3257 def WriteGLES2InterfaceStubImpl(self, func, file): |
3258 """Writes the GLES2 Interface stub declaration.""" | 3258 """Writes the GLES2 Interface stub declaration.""" |
3259 args = func.GetOriginalArgs() | 3259 args = func.GetOriginalArgs() |
3260 arg_string = ", ".join( | 3260 arg_string = ", ".join( |
3261 ["%s /* %s */" % (arg.type, arg.name) for arg in args]) | 3261 ["%s /* %s */" % (arg.type, arg.name) for arg in args]) |
3262 file.Write("%s GLES2InterfaceStub::%s(%s) {\n" % | 3262 file.Write("%s GLES2InterfaceStub::%s(%s) {\n" % |
3263 (func.return_type, func.original_name, arg_string)) | 3263 (func.return_type, func.original_name, arg_string)) |
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3840 """Overrriden from TypeHandler.""" | 3840 """Overrriden from TypeHandler.""" |
3841 file.Write("// TODO(gman): Implement test for %s\n" % func.name) | 3841 file.Write("// TODO(gman): Implement test for %s\n" % func.name) |
3842 | 3842 |
3843 def WriteGLES2Implementation(self, func, file): | 3843 def WriteGLES2Implementation(self, func, file): |
3844 """Overrriden from TypeHandler.""" | 3844 """Overrriden from TypeHandler.""" |
3845 if func.GetInfo('impl_func'): | 3845 if func.GetInfo('impl_func'): |
3846 super(ManualHandler, self).WriteGLES2Implementation(func, file) | 3846 super(ManualHandler, self).WriteGLES2Implementation(func, file) |
3847 | 3847 |
3848 def WriteGLES2ImplementationHeader(self, func, file): | 3848 def WriteGLES2ImplementationHeader(self, func, file): |
3849 """Overrriden from TypeHandler.""" | 3849 """Overrriden from TypeHandler.""" |
3850 file.Write("virtual %s %s(%s) OVERRIDE;\n" % | 3850 file.Write("virtual %s %s(%s) override;\n" % |
3851 (func.return_type, func.original_name, | 3851 (func.return_type, func.original_name, |
3852 func.MakeTypedOriginalArgString(""))) | 3852 func.MakeTypedOriginalArgString(""))) |
3853 file.Write("\n") | 3853 file.Write("\n") |
3854 | 3854 |
3855 def WriteImmediateCmdGetTotalSize(self, func, file): | 3855 def WriteImmediateCmdGetTotalSize(self, func, file): |
3856 """Overrriden from TypeHandler.""" | 3856 """Overrriden from TypeHandler.""" |
3857 # TODO(gman): Move this data to _FUNCTION_INFO? | 3857 # TODO(gman): Move this data to _FUNCTION_INFO? |
3858 CustomHandler.WriteImmediateCmdGetTotalSize(self, func, file) | 3858 CustomHandler.WriteImmediateCmdGetTotalSize(self, func, file) |
3859 | 3859 |
3860 | 3860 |
(...skipping 4782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8643 Format(gen.generated_cpp_filenames) | 8643 Format(gen.generated_cpp_filenames) |
8644 | 8644 |
8645 if gen.errors > 0: | 8645 if gen.errors > 0: |
8646 print "%d errors" % gen.errors | 8646 print "%d errors" % gen.errors |
8647 return 1 | 8647 return 1 |
8648 return 0 | 8648 return 0 |
8649 | 8649 |
8650 | 8650 |
8651 if __name__ == '__main__': | 8651 if __name__ == '__main__': |
8652 sys.exit(main(sys.argv[1:])) | 8652 sys.exit(main(sys.argv[1:])) |
OLD | NEW |