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 6511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6522 file.Write("\n") | 6522 file.Write("\n") |
6523 | 6523 |
6524 file.Write("void ContextState::Initialize() {\n") | 6524 file.Write("void ContextState::Initialize() {\n") |
6525 for state_name in sorted(_STATES.keys()): | 6525 for state_name in sorted(_STATES.keys()): |
6526 state = _STATES[state_name] | 6526 state = _STATES[state_name] |
6527 for item in state['states']: | 6527 for item in state['states']: |
6528 file.Write(" %s = %s;\n" % (item['name'], item['default'])) | 6528 file.Write(" %s = %s;\n" % (item['name'], item['default'])) |
6529 file.Write("}\n") | 6529 file.Write("}\n") |
6530 | 6530 |
6531 file.Write(""" | 6531 file.Write(""" |
6532 void ContextState::InitCapabilities() { | 6532 void ContextState::InitCapabilities() const { |
6533 """) | 6533 """) |
6534 for capability in _CAPABILITY_FLAGS: | 6534 for capability in _CAPABILITY_FLAGS: |
6535 file.Write(" EnableDisable(GL_%s, enable_flags.%s);\n" % | 6535 file.Write(" EnableDisable(GL_%s, enable_flags.%s);\n" % |
6536 (capability['name'].upper(), capability['name'])) | 6536 (capability['name'].upper(), capability['name'])) |
6537 file.Write("""} | 6537 file.Write("""} |
6538 | 6538 |
6539 void ContextState::InitState() { | 6539 void ContextState::InitState() const { |
6540 """) | 6540 """) |
6541 | 6541 |
6542 # We need to sort the keys so the expectations match | 6542 # We need to sort the keys so the expectations match |
6543 for state_name in sorted(_STATES.keys()): | 6543 for state_name in sorted(_STATES.keys()): |
6544 state = _STATES[state_name] | 6544 state = _STATES[state_name] |
6545 if state['type'] == 'FrontBack': | 6545 if state['type'] == 'FrontBack': |
6546 num_states = len(state['states']) | 6546 num_states = len(state['states']) |
6547 for ndx, group in enumerate(Grouper(num_states / 2, state['states'])): | 6547 for ndx, group in enumerate(Grouper(num_states / 2, state['states'])): |
6548 args = [] | 6548 args = [] |
6549 for item in group: | 6549 for item in group: |
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7188 gen.WriteCommonUtilsImpl("common/gles2_cmd_utils_implementation_autogen.h") | 7188 gen.WriteCommonUtilsImpl("common/gles2_cmd_utils_implementation_autogen.h") |
7189 | 7189 |
7190 if gen.errors > 0: | 7190 if gen.errors > 0: |
7191 print "%d errors" % gen.errors | 7191 print "%d errors" % gen.errors |
7192 return 1 | 7192 return 1 |
7193 return 0 | 7193 return 0 |
7194 | 7194 |
7195 | 7195 |
7196 if __name__ == '__main__': | 7196 if __name__ == '__main__': |
7197 sys.exit(main(sys.argv[1:])) | 7197 sys.exit(main(sys.argv[1:])) |
OLD | NEW |