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 3054 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3065 func.WriteDestinationInitalizationValidation(file) | 3065 func.WriteDestinationInitalizationValidation(file) |
3066 self.WriteClientGLCallLog(func, file) | 3066 self.WriteClientGLCallLog(func, file) |
3067 for arg in func.GetOriginalArgs(): | 3067 for arg in func.GetOriginalArgs(): |
3068 arg.WriteClientSideValidationCode(file, func) | 3068 arg.WriteClientSideValidationCode(file, func) |
3069 file.Write( | 3069 file.Write( |
3070 " GPU_CLIENT_DCHECK(%s != 0);\n" % func.GetOriginalArgs()[-1].name) | 3070 " GPU_CLIENT_DCHECK(%s != 0);\n" % func.GetOriginalArgs()[-1].name) |
3071 file.Write(" program_and_shader_id_handler_->FreeIds(1, &%s);\n" % | 3071 file.Write(" program_and_shader_id_handler_->FreeIds(1, &%s);\n" % |
3072 func.GetOriginalArgs()[-1].name) | 3072 func.GetOriginalArgs()[-1].name) |
3073 file.Write(" helper_->%s(%s);\n" % | 3073 file.Write(" helper_->%s(%s);\n" % |
3074 (func.name, func.MakeCmdArgString(""))) | 3074 (func.name, func.MakeCmdArgString(""))) |
| 3075 file.Write(" Flush();\n") |
3075 file.Write("}\n") | 3076 file.Write("}\n") |
3076 file.Write("\n") | 3077 file.Write("\n") |
3077 | 3078 |
3078 | 3079 |
3079 class DELnHandler(TypeHandler): | 3080 class DELnHandler(TypeHandler): |
3080 """Handler for glDelete___ type functions.""" | 3081 """Handler for glDelete___ type functions.""" |
3081 | 3082 |
3082 def __init__(self): | 3083 def __init__(self): |
3083 TypeHandler.__init__(self) | 3084 TypeHandler.__init__(self) |
3084 | 3085 |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3194 file.Write(""" GPU_CLIENT_DCHECK_CODE_BLOCK({ | 3195 file.Write(""" GPU_CLIENT_DCHECK_CODE_BLOCK({ |
3195 for (GLsizei i = 0; i < n; ++i) { | 3196 for (GLsizei i = 0; i < n; ++i) { |
3196 GPU_DCHECK(%s[i] != 0); | 3197 GPU_DCHECK(%s[i] != 0); |
3197 } | 3198 } |
3198 }); | 3199 }); |
3199 """ % func.GetOriginalArgs()[1].name) | 3200 """ % func.GetOriginalArgs()[1].name) |
3200 for arg in func.GetOriginalArgs(): | 3201 for arg in func.GetOriginalArgs(): |
3201 arg.WriteClientSideValidationCode(file, func) | 3202 arg.WriteClientSideValidationCode(file, func) |
3202 code = """ %(name)sHelper(%(args)s); | 3203 code = """ %(name)sHelper(%(args)s); |
3203 helper_->%(name)sImmediate(%(args)s); | 3204 helper_->%(name)sImmediate(%(args)s); |
| 3205 Flush(); |
3204 } | 3206 } |
3205 | 3207 |
3206 """ | 3208 """ |
3207 file.Write(code % args) | 3209 file.Write(code % args) |
3208 | 3210 |
3209 def WriteImmediateCmdComputeSize(self, func, file): | 3211 def WriteImmediateCmdComputeSize(self, func, file): |
3210 """Overrriden from TypeHandler.""" | 3212 """Overrriden from TypeHandler.""" |
3211 file.Write(" static uint32 ComputeDataSize(GLsizei n) {\n") | 3213 file.Write(" static uint32 ComputeDataSize(GLsizei n) {\n") |
3212 file.Write( | 3214 file.Write( |
3213 " return static_cast<uint32>(sizeof(GLuint) * n); // NOLINT\n") | 3215 " return static_cast<uint32>(sizeof(GLuint) * n); // NOLINT\n") |
(...skipping 2730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5944 | 5946 |
5945 if options.generate_docs: | 5947 if options.generate_docs: |
5946 gen.WriteDocs("docs/gles2_cmd_format_docs_autogen.h") | 5948 gen.WriteDocs("docs/gles2_cmd_format_docs_autogen.h") |
5947 | 5949 |
5948 if gen.errors > 0: | 5950 if gen.errors > 0: |
5949 print "%d errors" % gen.errors | 5951 print "%d errors" % gen.errors |
5950 sys.exit(1) | 5952 sys.exit(1) |
5951 | 5953 |
5952 if __name__ == '__main__': | 5954 if __name__ == '__main__': |
5953 main(sys.argv[1:]) | 5955 main(sys.argv[1:]) |
OLD | NEW |