| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # | 2 # |
| 3 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2006-2009 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 GL command buffers.""" | 7 """code generator for GL command buffers.""" |
| 8 | 8 |
| 9 import os | 9 import os |
| 10 import os.path | 10 import os.path |
| (...skipping 2431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2442 class EnumArgument(Argument): | 2442 class EnumArgument(Argument): |
| 2443 """A class that represents a GLenum argument""" | 2443 """A class that represents a GLenum argument""" |
| 2444 | 2444 |
| 2445 def __init__(self, name, type): | 2445 def __init__(self, name, type): |
| 2446 Argument.__init__(self, name, "GLenum") | 2446 Argument.__init__(self, name, "GLenum") |
| 2447 | 2447 |
| 2448 self.enum_type = type | 2448 self.enum_type = type |
| 2449 | 2449 |
| 2450 def WriteValidationCode(self, file): | 2450 def WriteValidationCode(self, file): |
| 2451 file.Write(" if (!Validate%s(%s)) {\n" % (self.enum_type, self.name)) | 2451 file.Write(" if (!Validate%s(%s)) {\n" % (self.enum_type, self.name)) |
| 2452 file.Write(" SetGLError(GL_INVALID_VALUE);\n") | 2452 file.Write(" SetGLError(GL_INVALID_ENUM);\n") |
| 2453 file.Write(" return parse_error::kParseNoError;\n") | 2453 file.Write(" return parse_error::kParseNoError;\n") |
| 2454 file.Write(" }\n") | 2454 file.Write(" }\n") |
| 2455 | 2455 |
| 2456 | 2456 |
| 2457 class IntArgument(Argument): | 2457 class IntArgument(Argument): |
| 2458 """A class for a GLint argument that can only except specific values. | 2458 """A class for a GLint argument that can only except specific values. |
| 2459 | 2459 |
| 2460 For example glTexImage2D takes a GLint for its internalformat | 2460 For example glTexImage2D takes a GLint for its internalformat |
| 2461 argument instead of a GLenum. | 2461 argument instead of a GLenum. |
| 2462 """ | 2462 """ |
| (...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3040 file.Write("#undef GLES2_CMD_OP\n") | 3040 file.Write("#undef GLES2_CMD_OP\n") |
| 3041 file.Write(" kNumCommands\n") | 3041 file.Write(" kNumCommands\n") |
| 3042 file.Write("};\n") | 3042 file.Write("};\n") |
| 3043 file.Write("\n") | 3043 file.Write("\n") |
| 3044 file.Close() | 3044 file.Close() |
| 3045 | 3045 |
| 3046 def WriteFormat(self, filename): | 3046 def WriteFormat(self, filename): |
| 3047 """Writes the command buffer format""" | 3047 """Writes the command buffer format""" |
| 3048 file = CWriter(filename) | 3048 file = CWriter(filename) |
| 3049 self.WriteHeader(file) | 3049 self.WriteHeader(file) |
| 3050 file.Write("#pragma pack(push, 1)\n") | |
| 3051 file.Write("\n") | |
| 3052 | 3050 |
| 3053 for func in self.functions: | 3051 for func in self.functions: |
| 3054 func.WriteStruct(file) | 3052 func.WriteStruct(file) |
| 3055 | 3053 |
| 3056 file.Write("#pragma pack(pop)\n") | |
| 3057 file.Write("\n") | 3054 file.Write("\n") |
| 3058 file.Close() | 3055 file.Close() |
| 3059 | 3056 |
| 3060 def WriteFormatTest(self, filename): | 3057 def WriteFormatTest(self, filename): |
| 3061 """Writes the command buffer format test.""" | 3058 """Writes the command buffer format test.""" |
| 3062 file = CWriter(filename) | 3059 file = CWriter(filename) |
| 3063 self.WriteHeader(file) | 3060 self.WriteHeader(file) |
| 3064 file.Write("// This file contains unit tests for gles2 commmands\n") | 3061 file.Write("// This file contains unit tests for gles2 commmands\n") |
| 3065 file.Write("// It is included by gles2_cmd_format_test.cc\n") | 3062 file.Write("// It is included by gles2_cmd_format_test.cc\n") |
| 3066 file.Write("\n") | 3063 file.Write("\n") |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3227 | 3224 |
| 3228 if options.generate_command_id_tests: | 3225 if options.generate_command_id_tests: |
| 3229 gen.WriteCommandIdTest("common/gles2_cmd_id_test_autogen.h") | 3226 gen.WriteCommandIdTest("common/gles2_cmd_id_test_autogen.h") |
| 3230 | 3227 |
| 3231 if gen.errors > 0: | 3228 if gen.errors > 0: |
| 3232 print "%d errors" % gen.errors | 3229 print "%d errors" % gen.errors |
| 3233 sys.exit(1) | 3230 sys.exit(1) |
| 3234 | 3231 |
| 3235 if __name__ == '__main__': | 3232 if __name__ == '__main__': |
| 3236 main(sys.argv[1:]) | 3233 main(sys.argv[1:]) |
| OLD | NEW |