| 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 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 'default': '0', | 494 'default': '0', |
| 495 'es3': True, | 495 'es3': True, |
| 496 'manual': True, | 496 'manual': True, |
| 497 } | 497 } |
| 498 ], | 498 ], |
| 499 }, | 499 }, |
| 500 # TODO: Consider implemenenting these states | 500 # TODO: Consider implemenenting these states |
| 501 # GL_ACTIVE_TEXTURE | 501 # GL_ACTIVE_TEXTURE |
| 502 'LineWidth': { | 502 'LineWidth': { |
| 503 'type': 'Normal', | 503 'type': 'Normal', |
| 504 'func': 'LineWidth', | 504 'custom_function' : True, |
| 505 'func': 'DoLineWidth', |
| 505 'enum': 'GL_LINE_WIDTH', | 506 'enum': 'GL_LINE_WIDTH', |
| 506 'states': [ | 507 'states': [ |
| 507 { | 508 { |
| 508 'name': 'line_width', | 509 'name': 'line_width', |
| 509 'type': 'GLfloat', | 510 'type': 'GLfloat', |
| 510 'default': '1.0f', | 511 'default': '1.0f', |
| 511 'range_checks': [{'check': "<= 0.0f", 'test_value': "0.0f"}], | 512 'range_checks': [{'check': "<= 0.0f", 'test_value': "0.0f"}], |
| 512 'nan_check': True, | 513 'nan_check': True, |
| 513 }], | 514 }], |
| 514 }, | 515 }, |
| (...skipping 9751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10266 for place, item in enumerate(state['states']): | 10267 for place, item in enumerate(state['states']): |
| 10267 item_name = CachedStateName(item) | 10268 item_name = CachedStateName(item) |
| 10268 args.append('%s' % item_name) | 10269 args.append('%s' % item_name) |
| 10269 if test_prev: | 10270 if test_prev: |
| 10270 if place > 0: | 10271 if place > 0: |
| 10271 f.write(' ||\n') | 10272 f.write(' ||\n') |
| 10272 f.write("(%s != prev_state->%s)" % | 10273 f.write("(%s != prev_state->%s)" % |
| 10273 (item_name, item_name)) | 10274 (item_name, item_name)) |
| 10274 if test_prev: | 10275 if test_prev: |
| 10275 f.write(" )\n") | 10276 f.write(" )\n") |
| 10276 f.write(" gl%s(%s);\n" % (state['func'], ", ".join(args))) | 10277 if 'custom_function' in state: |
| 10278 f.write(" %s(%s);\n" % (state['func'], ", ".join(args))) |
| 10279 else: |
| 10280 f.write(" gl%s(%s);\n" % (state['func'], ", ".join(args))) |
| 10277 | 10281 |
| 10278 f.write(" if (prev_state) {") | 10282 f.write(" if (prev_state) {") |
| 10279 WriteStates(True) | 10283 WriteStates(True) |
| 10280 f.write(" } else {") | 10284 f.write(" } else {") |
| 10281 WriteStates(False) | 10285 WriteStates(False) |
| 10282 f.write(" }") | 10286 f.write(" }") |
| 10283 f.write(" InitStateManual(prev_state);") | 10287 f.write(" InitStateManual(prev_state);") |
| 10284 f.write("}\n") | 10288 f.write("}\n") |
| 10285 | 10289 |
| 10286 f.write("""bool ContextState::GetEnabled(GLenum cap) const { | 10290 f.write("""bool ContextState::GetEnabled(GLenum cap) const { |
| (...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11175 Format(gen.generated_cpp_filenames) | 11179 Format(gen.generated_cpp_filenames) |
| 11176 | 11180 |
| 11177 if gen.errors > 0: | 11181 if gen.errors > 0: |
| 11178 print "%d errors" % gen.errors | 11182 print "%d errors" % gen.errors |
| 11179 return 1 | 11183 return 1 |
| 11180 return 0 | 11184 return 0 |
| 11181 | 11185 |
| 11182 | 11186 |
| 11183 if __name__ == '__main__': | 11187 if __name__ == '__main__': |
| 11184 sys.exit(main(sys.argv[1:])) | 11188 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |