OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 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 3371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3382 ", ".join(["%s" % arg.name for arg in all_but_last_args])) | 3382 ", ".join(["%s" % arg.name for arg in all_but_last_args])) |
3383 all_arg_string = ( | 3383 all_arg_string = ( |
3384 ", ".join(["%s" % arg.name for arg in func.GetOriginalArgs()])) | 3384 ", ".join(["%s" % arg.name for arg in func.GetOriginalArgs()])) |
3385 code = """ if (%(func_name)sHelper(%(all_arg_string)s)) { | 3385 code = """ if (%(func_name)sHelper(%(all_arg_string)s)) { |
3386 return; | 3386 return; |
3387 } | 3387 } |
3388 typedef %(func_name)s::Result Result; | 3388 typedef %(func_name)s::Result Result; |
3389 Result* result = GetResultAs<Result*>(); | 3389 Result* result = GetResultAs<Result*>(); |
3390 result->SetNumResults(0); | 3390 result->SetNumResults(0); |
3391 helper_->%(func_name)s(%(arg_string)s, | 3391 helper_->%(func_name)s(%(arg_string)s, |
3392 result_shm_id(), result_shm_offset()); | 3392 GetResultShmId(), GetResultShmOffset()); |
3393 WaitForCmd(); | 3393 WaitForCmd(); |
3394 result->CopyResult(params); | 3394 result->CopyResult(params); |
3395 GPU_CLIENT_LOG_CODE_BLOCK({ | 3395 GPU_CLIENT_LOG_CODE_BLOCK({ |
3396 for (int32 i = 0; i < result->GetNumResults(); ++i) { | 3396 for (int32 i = 0; i < result->GetNumResults(); ++i) { |
3397 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]); | 3397 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]); |
3398 } | 3398 } |
3399 }); | 3399 }); |
3400 } | 3400 } |
3401 """ | 3401 """ |
3402 file.Write(code % { | 3402 file.Write(code % { |
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4177 func.MakeTypedOriginalArgString(""))) | 4177 func.MakeTypedOriginalArgString(""))) |
4178 func.WriteDestinationInitalizationValidation(file) | 4178 func.WriteDestinationInitalizationValidation(file) |
4179 self.WriteClientGLCallLog(func, file) | 4179 self.WriteClientGLCallLog(func, file) |
4180 file.Write(" typedef %s::Result Result;\n" % func.name) | 4180 file.Write(" typedef %s::Result Result;\n" % func.name) |
4181 file.Write(" Result* result = GetResultAs<Result*>();\n") | 4181 file.Write(" Result* result = GetResultAs<Result*>();\n") |
4182 file.Write(" *result = 0;\n") | 4182 file.Write(" *result = 0;\n") |
4183 arg_string = func.MakeOriginalArgString("") | 4183 arg_string = func.MakeOriginalArgString("") |
4184 comma = "" | 4184 comma = "" |
4185 if len(arg_string) > 0: | 4185 if len(arg_string) > 0: |
4186 comma = ", " | 4186 comma = ", " |
4187 file.Write(" helper_->%s(%s%sresult_shm_id(), result_shm_offset());\n" % | 4187 file.Write( |
| 4188 " helper_->%s(%s%sGetResultShmId(), GetResultShmOffset());\n" % |
4188 (func.name, arg_string, comma)) | 4189 (func.name, arg_string, comma)) |
4189 file.Write(" WaitForCmd();\n") | 4190 file.Write(" WaitForCmd();\n") |
4190 file.Write(' GPU_CLIENT_LOG("returned " << *result);\n') | 4191 file.Write(' GPU_CLIENT_LOG("returned " << *result);\n') |
4191 file.Write(" return *result;\n") | 4192 file.Write(" return *result;\n") |
4192 file.Write("}\n") | 4193 file.Write("}\n") |
4193 file.Write("\n") | 4194 file.Write("\n") |
4194 else: | 4195 else: |
4195 self.WriteGLES2ImplementationDeclaration(func, file) | 4196 self.WriteGLES2ImplementationDeclaration(func, file) |
4196 | 4197 |
4197 | 4198 |
(...skipping 1792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5990 gen.WriteDocs("docs/gles2_cmd_format_docs_autogen.h") | 5991 gen.WriteDocs("docs/gles2_cmd_format_docs_autogen.h") |
5991 | 5992 |
5992 if gen.errors > 0: | 5993 if gen.errors > 0: |
5993 print "%d errors" % gen.errors | 5994 print "%d errors" % gen.errors |
5994 return 1 | 5995 return 1 |
5995 return 0 | 5996 return 0 |
5996 | 5997 |
5997 | 5998 |
5998 if __name__ == '__main__': | 5999 if __name__ == '__main__': |
5999 sys.exit(main(sys.argv[1:])) | 6000 sys.exit(main(sys.argv[1:])) |
OLD | NEW |