| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # | 2 # |
| 3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 """code generator for GLES2 command buffers.""" | 7 """code generator for GLES2 command buffers.""" |
| 8 | 8 |
| 9 import os | 9 import os |
| 10 import os.path | 10 import os.path |
| (...skipping 3071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3082 """Overrriden from TypeHandler.""" | 3082 """Overrriden from TypeHandler.""" |
| 3083 file.Write("%s %s(%s) {\n" % | 3083 file.Write("%s %s(%s) {\n" % |
| 3084 (func.return_type, func.original_name, | 3084 (func.return_type, func.original_name, |
| 3085 func.MakeTypedOriginalArgString(""))) | 3085 func.MakeTypedOriginalArgString(""))) |
| 3086 func.WriteDestinationInitalizationValidation(file) | 3086 func.WriteDestinationInitalizationValidation(file) |
| 3087 self.WriteClientGLCallLog(func, file) | 3087 self.WriteClientGLCallLog(func, file) |
| 3088 for arg in func.GetOriginalArgs(): | 3088 for arg in func.GetOriginalArgs(): |
| 3089 arg.WriteClientSideValidationCode(file, func) | 3089 arg.WriteClientSideValidationCode(file, func) |
| 3090 file.Write( | 3090 file.Write( |
| 3091 " GPU_CLIENT_DCHECK(%s != 0);\n" % func.GetOriginalArgs()[-1].name) | 3091 " GPU_CLIENT_DCHECK(%s != 0);\n" % func.GetOriginalArgs()[-1].name) |
| 3092 file.Write(" DeleteProgramOrShaderHelper(%s);\n" % | 3092 file.Write(" %sHelper(%s);\n" % |
| 3093 func.GetOriginalArgs()[-1].name) | 3093 (func.original_name, func.GetOriginalArgs()[-1].name)) |
| 3094 file.Write(" helper_->%s(%s);\n" % | |
| 3095 (func.name, func.MakeCmdArgString(""))) | |
| 3096 file.Write(" Flush();\n") | |
| 3097 file.Write("}\n") | 3094 file.Write("}\n") |
| 3098 file.Write("\n") | 3095 file.Write("\n") |
| 3099 | 3096 |
| 3100 | 3097 |
| 3101 class DELnHandler(TypeHandler): | 3098 class DELnHandler(TypeHandler): |
| 3102 """Handler for glDelete___ type functions.""" | 3099 """Handler for glDelete___ type functions.""" |
| 3103 | 3100 |
| 3104 def __init__(self): | 3101 def __init__(self): |
| 3105 TypeHandler.__init__(self) | 3102 TypeHandler.__init__(self) |
| 3106 | 3103 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3215 """ % func.GetOriginalArgs()[1].name) | 3212 """ % func.GetOriginalArgs()[1].name) |
| 3216 file.Write(""" GPU_CLIENT_DCHECK_CODE_BLOCK({ | 3213 file.Write(""" GPU_CLIENT_DCHECK_CODE_BLOCK({ |
| 3217 for (GLsizei i = 0; i < n; ++i) { | 3214 for (GLsizei i = 0; i < n; ++i) { |
| 3218 GPU_DCHECK(%s[i] != 0); | 3215 GPU_DCHECK(%s[i] != 0); |
| 3219 } | 3216 } |
| 3220 }); | 3217 }); |
| 3221 """ % func.GetOriginalArgs()[1].name) | 3218 """ % func.GetOriginalArgs()[1].name) |
| 3222 for arg in func.GetOriginalArgs(): | 3219 for arg in func.GetOriginalArgs(): |
| 3223 arg.WriteClientSideValidationCode(file, func) | 3220 arg.WriteClientSideValidationCode(file, func) |
| 3224 code = """ %(name)sHelper(%(args)s); | 3221 code = """ %(name)sHelper(%(args)s); |
| 3225 helper_->%(name)sImmediate(%(args)s); | |
| 3226 Flush(); | |
| 3227 } | 3222 } |
| 3228 | 3223 |
| 3229 """ | 3224 """ |
| 3230 file.Write(code % args) | 3225 file.Write(code % args) |
| 3231 | 3226 |
| 3232 def WriteImmediateCmdComputeSize(self, func, file): | 3227 def WriteImmediateCmdComputeSize(self, func, file): |
| 3233 """Overrriden from TypeHandler.""" | 3228 """Overrriden from TypeHandler.""" |
| 3234 file.Write(" static uint32 ComputeDataSize(GLsizei n) {\n") | 3229 file.Write(" static uint32 ComputeDataSize(GLsizei n) {\n") |
| 3235 file.Write( | 3230 file.Write( |
| 3236 " return static_cast<uint32>(sizeof(GLuint) * n); // NOLINT\n") | 3231 " return static_cast<uint32>(sizeof(GLuint) * n); // NOLINT\n") |
| (...skipping 2760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5997 | 5992 |
| 5998 if options.generate_docs: | 5993 if options.generate_docs: |
| 5999 gen.WriteDocs("docs/gles2_cmd_format_docs_autogen.h") | 5994 gen.WriteDocs("docs/gles2_cmd_format_docs_autogen.h") |
| 6000 | 5995 |
| 6001 if gen.errors > 0: | 5996 if gen.errors > 0: |
| 6002 print "%d errors" % gen.errors | 5997 print "%d errors" % gen.errors |
| 6003 sys.exit(1) | 5998 sys.exit(1) |
| 6004 | 5999 |
| 6005 if __name__ == '__main__': | 6000 if __name__ == '__main__': |
| 6006 main(sys.argv[1:]) | 6001 main(sys.argv[1:]) |
| OLD | NEW |