Chromium Code Reviews| 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 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 502 'default': [ | 502 'default': [ |
| 503 '1.0f', '0.0f','0.0f','0.0f', | 503 '1.0f', '0.0f','0.0f','0.0f', |
| 504 '0.0f', '1.0f','0.0f','0.0f', | 504 '0.0f', '1.0f','0.0f','0.0f', |
| 505 '0.0f', '0.0f','1.0f','0.0f', | 505 '0.0f', '0.0f','1.0f','0.0f', |
| 506 '0.0f', '0.0f','0.0f','1.0f', | 506 '0.0f', '0.0f','0.0f','1.0f', |
| 507 ], | 507 ], |
| 508 'extension_flag': 'chromium_path_rendering', | 508 'extension_flag': 'chromium_path_rendering', |
| 509 }, | 509 }, |
| 510 ], | 510 ], |
| 511 }, | 511 }, |
| 512 'PathStencilFuncCHROMIUM': { | |
| 513 'type': 'Normal', | |
| 514 'func': 'PathStencilFuncNV', | |
| 515 'extension_flag': 'chromium_path_rendering', | |
| 516 'states': [ | |
| 517 { | |
| 518 'name': 'stencil_path_func', | |
| 519 'type': 'GLenum', | |
| 520 'enum': 'GL_PATH_STENCIL_FUNC_CHROMIUM', | |
| 521 'default': 'GL_ALWAYS', | |
| 522 }, | |
| 523 { | |
| 524 'name': 'stencil_path_ref', | |
| 525 'type': 'GLint', | |
| 526 'enum': 'GL_PATH_STENCIL_REF_CHROMIUM', | |
| 527 'default': '0', | |
| 528 }, | |
| 529 { | |
| 530 'name': 'stencil_path_mask', | |
| 531 'type': 'GLuint', | |
| 532 'enum': 'GL_PATH_STENCIL_VALUE_MASK_CHROMIUM', | |
| 533 'default': '0xFFFFFFFFU', | |
| 534 }, | |
| 535 ], | |
| 536 }, | |
| 512 } | 537 } |
| 513 | 538 |
| 514 # This is a list of enum names and their valid values. It is used to map | 539 # This is a list of enum names and their valid values. It is used to map |
| 515 # GLenum arguments to a specific set of valid values. | 540 # GLenum arguments to a specific set of valid values. |
| 516 _ENUM_LISTS = { | 541 _ENUM_LISTS = { |
| 517 'BlitFilter': { | 542 'BlitFilter': { |
| 518 'type': 'GLenum', | 543 'type': 'GLenum', |
| 519 'valid': [ | 544 'valid': [ |
| 520 'GL_NEAREST', | 545 'GL_NEAREST', |
| 521 'GL_LINEAR', | 546 'GL_LINEAR', |
| (...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1058 'GL_UNSIGNED_BYTE', | 1083 'GL_UNSIGNED_BYTE', |
| 1059 'GL_UNSIGNED_SHORT_5_6_5', | 1084 'GL_UNSIGNED_SHORT_5_6_5', |
| 1060 'GL_UNSIGNED_SHORT_4_4_4_4', | 1085 'GL_UNSIGNED_SHORT_4_4_4_4', |
| 1061 'GL_UNSIGNED_SHORT_5_5_5_1', | 1086 'GL_UNSIGNED_SHORT_5_5_5_1', |
| 1062 ], | 1087 ], |
| 1063 'invalid': [ | 1088 'invalid': [ |
| 1064 'GL_SHORT', | 1089 'GL_SHORT', |
| 1065 'GL_INT', | 1090 'GL_INT', |
| 1066 ], | 1091 ], |
| 1067 }, | 1092 }, |
| 1093 'PathCoordType': { | |
| 1094 'type': 'GLenum', | |
| 1095 'valid': [ | |
| 1096 'GL_FLOAT', | |
| 1097 ], | |
| 1098 }, | |
| 1099 'PathCoverMode': { | |
| 1100 'type': 'GLenum', | |
| 1101 'valid': [ | |
| 1102 'GL_BOUNDING_BOX_CHROMIUM', | |
| 1103 ], | |
| 1104 }, | |
| 1105 'PathCoverModeInstanced': { | |
| 1106 'type': 'GLenum', | |
| 1107 'valid': [ | |
| 1108 'GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM', | |
| 1109 ], | |
| 1110 }, | |
| 1111 'PathFillMode': { | |
| 1112 'type': 'GLenum', | |
| 1113 'valid': [ | |
| 1114 'GL_INVERT', | |
| 1115 'GL_COUNT_UP_CHROMIUM', | |
| 1116 'GL_COUNT_DOWN_CHROMIUM', | |
| 1117 ], | |
| 1118 }, | |
| 1119 'PathGenMode': { | |
| 1120 'type': 'GLenum', | |
| 1121 'valid': [ | |
| 1122 'GL_OBJECT_LINEAR_CHROMIUM', | |
| 1123 'GL_EYE_LINEAR_CHROMIUM', | |
| 1124 ], | |
| 1125 }, | |
| 1126 'PathNameType': { | |
| 1127 'type': 'GLenum', | |
| 1128 'valid': [ | |
| 1129 'GL_UNSIGNED_INT' | |
| 1130 ], | |
| 1131 }, | |
| 1132 'PathParameter': { | |
| 1133 'type': 'GLenum', | |
| 1134 'valid': [ | |
| 1135 'GL_PATH_STROKE_WIDTH_CHROMIUM', | |
| 1136 'GL_PATH_INITIAL_END_CAP_CHROMIUM', | |
| 1137 'GL_PATH_TERMINAL_END_CAP_CHROMIUM', | |
| 1138 'GL_PATH_JOIN_STYLE_CHROMIUM', | |
| 1139 'GL_PATH_MITER_LIMIT_CHROMIUM', | |
| 1140 ] | |
| 1141 }, | |
| 1142 'PathTransformType': { | |
| 1143 'type': 'GLenum', | |
| 1144 'valid': [ | |
| 1145 'GL_NONE', | |
| 1146 'GL_TRANSLATE_X_CHROMIUM', | |
| 1147 'GL_TRANSLATE_Y_CHROMIUM', | |
| 1148 'GL_TRANSLATE_2D_CHROMIUM', | |
| 1149 'GL_TRANSLATE_3D_CHROMIUM', | |
| 1150 'GL_AFFINE_2D_CHROMIUM', | |
| 1151 'GL_AFFINE_3D_CHROMIUM', | |
| 1152 'GL_TRANSPOSE_AFFINE_2D_CHROMIUM', | |
| 1153 'GL_TRANSPOSE_AFFINE_3D_CHROMIUM', | |
| 1154 ], | |
| 1155 }, | |
| 1068 'ReadPixelType': { | 1156 'ReadPixelType': { |
| 1069 'type': 'GLenum', | 1157 'type': 'GLenum', |
| 1070 'valid': [ | 1158 'valid': [ |
| 1071 'GL_UNSIGNED_BYTE', | 1159 'GL_UNSIGNED_BYTE', |
| 1072 'GL_UNSIGNED_SHORT_5_6_5', | 1160 'GL_UNSIGNED_SHORT_5_6_5', |
| 1073 'GL_UNSIGNED_SHORT_4_4_4_4', | 1161 'GL_UNSIGNED_SHORT_4_4_4_4', |
| 1074 'GL_UNSIGNED_SHORT_5_5_5_1', | 1162 'GL_UNSIGNED_SHORT_5_5_5_1', |
| 1075 ], | 1163 ], |
| 1076 'invalid': [ | 1164 'invalid': [ |
| 1077 'GL_SHORT', | 1165 'GL_SHORT', |
| (...skipping 1514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2592 'unit_test': False, | 2680 'unit_test': False, |
| 2593 'chromium': True, | 2681 'chromium': True, |
| 2594 'extension': True, | 2682 'extension': True, |
| 2595 }, | 2683 }, |
| 2596 'MatrixLoadIdentityCHROMIUM': { | 2684 'MatrixLoadIdentityCHROMIUM': { |
| 2597 'decoder_func': 'DoMatrixLoadIdentityCHROMIUM', | 2685 'decoder_func': 'DoMatrixLoadIdentityCHROMIUM', |
| 2598 'unit_test': False, | 2686 'unit_test': False, |
| 2599 'chromium': True, | 2687 'chromium': True, |
| 2600 'extension': True, | 2688 'extension': True, |
| 2601 }, | 2689 }, |
| 2690 'GenPathsCHROMIUM': { | |
| 2691 'type': 'Custom', | |
| 2692 'cmd_args': | |
| 2693 'GLsizei range, GLuint* client_ids', | |
| 2694 'immediate': False, # FIXME: cannot create immediate command | |
|
piman
2014/04/24 22:26:36
nit: in chromium code, we use TODO rather than FIX
| |
| 2695 # because it will use original args instead of | |
| 2696 # cmd_args | |
| 2697 'unit_test': False, # FIXME: see above | |
| 2698 'chromium': True, | |
| 2699 'extension': True, | |
| 2700 }, | |
| 2701 'DeletePathsCHROMIUM': { | |
| 2702 'decoder_func': 'DeletePathsCHROMIUMHelper', | |
| 2703 'unit_test': False, # FIXME: see above | |
| 2704 'chromium': True, | |
| 2705 'extension': True, | |
| 2706 }, | |
| 2707 'PathCommandsCHROMIUM': { | |
| 2708 'type': 'Manual', | |
| 2709 'immediate': False, | |
| 2710 'chromium': True, | |
| 2711 'extension': True, | |
| 2712 }, | |
| 2713 'PathParameterfCHROMIUM': { | |
| 2714 'type': 'Custom', | |
| 2715 'chromium': True, | |
| 2716 'extension': True, | |
| 2717 }, | |
| 2718 'PathParameteriCHROMIUM': { | |
| 2719 'type': 'Custom', | |
| 2720 'chromium': True, | |
| 2721 'extension': True, | |
| 2722 }, | |
| 2723 'PathStencilFuncCHROMIUM': { | |
| 2724 'type': 'StateSet', | |
| 2725 'state': 'PathStencilFuncCHROMIUM', | |
| 2726 'decoder_func': 'glPathStencilFuncNV', | |
| 2727 'chromium': True, | |
| 2728 'extension': True, | |
| 2729 }, | |
| 2730 'StencilFillPathCHROMIUM': { | |
| 2731 'type': 'Custom', | |
| 2732 'chromium': True, | |
| 2733 'extension': True, | |
| 2734 }, | |
| 2735 'StencilFillPathInstancedCHROMIUM': { | |
| 2736 'type': 'Custom', | |
| 2737 'chromium': True, | |
| 2738 'extension': True, | |
| 2739 }, | |
| 2740 'StencilStrokePathCHROMIUM': { | |
| 2741 'type': 'Custom', | |
| 2742 'chromium': True, | |
| 2743 'extension': True, | |
| 2744 }, | |
| 2745 'StencilStrokePathInstancedCHROMIUM': { | |
| 2746 'type': 'Custom', | |
| 2747 'chromium': True, | |
| 2748 'extension': True, | |
| 2749 }, | |
| 2750 'PathTexGenCHROMIUM': { | |
| 2751 'type': 'Manual', | |
| 2752 'immediate': False, | |
| 2753 'chromium': True, | |
| 2754 'extension': True, | |
| 2755 }, | |
| 2756 'CoverFillPathCHROMIUM': { | |
| 2757 'type': 'Custom', | |
| 2758 'chromium': True, | |
| 2759 'extension': True, | |
| 2760 }, | |
| 2761 'CoverFillPathInstancedCHROMIUM': { | |
| 2762 'type': 'Custom', | |
| 2763 'chromium': True, | |
| 2764 'extension': True, | |
| 2765 }, | |
| 2766 'CoverStrokePathCHROMIUM': { | |
| 2767 'type': 'Custom', | |
| 2768 'chromium': True, | |
| 2769 'extension': True, | |
| 2770 }, | |
| 2771 'CoverStrokePathInstancedCHROMIUM': { | |
| 2772 'type': 'Custom', | |
| 2773 'chromium': True, | |
| 2774 'extension': True, | |
| 2775 }, | |
| 2602 } | 2776 } |
| 2603 | 2777 |
| 2604 def Grouper(n, iterable, fillvalue=None): | 2778 def Grouper(n, iterable, fillvalue=None): |
| 2605 """Collect data into fixed-length chunks or blocks""" | 2779 """Collect data into fixed-length chunks or blocks""" |
| 2606 args = [iter(iterable)] * n | 2780 args = [iter(iterable)] * n |
| 2607 return itertools.izip_longest(fillvalue=fillvalue, *args) | 2781 return itertools.izip_longest(fillvalue=fillvalue, *args) |
| 2608 | 2782 |
| 2609 | 2783 |
| 2610 def SplitWords(input_string): | 2784 def SplitWords(input_string): |
| 2611 """Transforms a input_string into a list of lower-case components. | 2785 """Transforms a input_string into a list of lower-case components. |
| (...skipping 5457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8069 "ppapi/shared_impl/ppb_opengles2_shared.cc"]) | 8243 "ppapi/shared_impl/ppb_opengles2_shared.cc"]) |
| 8070 | 8244 |
| 8071 if gen.errors > 0: | 8245 if gen.errors > 0: |
| 8072 print "%d errors" % gen.errors | 8246 print "%d errors" % gen.errors |
| 8073 return 1 | 8247 return 1 |
| 8074 return 0 | 8248 return 0 |
| 8075 | 8249 |
| 8076 | 8250 |
| 8077 if __name__ == '__main__': | 8251 if __name__ == '__main__': |
| 8078 sys.exit(main(sys.argv[1:])) | 8252 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |