Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Side by Side Diff: gpu/command_buffer/build_gles2_cmd_buffer.py

Issue 169403005: command_buffer: Implement path rendering functions for CHROMIUM_path_rendering (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@nv-pr-02-texgen
Patch Set: rebase and cleanup ids Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 'default': [ 529 'default': [
530 '1.0f', '0.0f','0.0f','0.0f', 530 '1.0f', '0.0f','0.0f','0.0f',
531 '0.0f', '1.0f','0.0f','0.0f', 531 '0.0f', '1.0f','0.0f','0.0f',
532 '0.0f', '0.0f','1.0f','0.0f', 532 '0.0f', '0.0f','1.0f','0.0f',
533 '0.0f', '0.0f','0.0f','1.0f', 533 '0.0f', '0.0f','0.0f','1.0f',
534 ], 534 ],
535 'extension_flag': 'chromium_path_rendering', 535 'extension_flag': 'chromium_path_rendering',
536 }, 536 },
537 ], 537 ],
538 }, 538 },
539 'PathStencilFuncCHROMIUM': {
540 'type': 'Normal',
541 'func': 'PathStencilFuncNV',
542 'extension_flag': 'chromium_path_rendering',
543 'states': [
544 {
545 'name': 'stencil_path_func',
546 'type': 'GLenum',
547 'enum': 'GL_PATH_STENCIL_FUNC_CHROMIUM',
548 'default': 'GL_ALWAYS',
549 },
550 {
551 'name': 'stencil_path_ref',
552 'type': 'GLint',
553 'enum': 'GL_PATH_STENCIL_REF_CHROMIUM',
554 'default': '0',
555 },
556 {
557 'name': 'stencil_path_mask',
558 'type': 'GLuint',
559 'enum': 'GL_PATH_STENCIL_VALUE_MASK_CHROMIUM',
560 'default': '0xFFFFFFFFU',
561 },
562 ],
563 },
539 } 564 }
540 565
541 # Named type info object represents a named type that is used in OpenGL call 566 # Named type info object represents a named type that is used in OpenGL call
542 # arguments. Each named type defines a set of valid OpenGL call arguments. The 567 # arguments. Each named type defines a set of valid OpenGL call arguments. The
543 # named types are used in 'cmd_buffer_functions.txt'. 568 # named types are used in 'cmd_buffer_functions.txt'.
544 # type: The actual GL type of the named type. 569 # type: The actual GL type of the named type.
545 # valid: The list of values that are valid for both the client and the service. 570 # valid: The list of values that are valid for both the client and the service.
546 # invalid: Examples of invalid values for the type. At least these values 571 # invalid: Examples of invalid values for the type. At least these values
547 # should be tested to be invalid. 572 # should be tested to be invalid.
548 # is_complete: The list of valid values of type are final and will not be 573 # is_complete: The list of valid values of type are final and will not be
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
1092 'GL_UNSIGNED_BYTE', 1117 'GL_UNSIGNED_BYTE',
1093 'GL_UNSIGNED_SHORT_5_6_5', 1118 'GL_UNSIGNED_SHORT_5_6_5',
1094 'GL_UNSIGNED_SHORT_4_4_4_4', 1119 'GL_UNSIGNED_SHORT_4_4_4_4',
1095 'GL_UNSIGNED_SHORT_5_5_5_1', 1120 'GL_UNSIGNED_SHORT_5_5_5_1',
1096 ], 1121 ],
1097 'invalid': [ 1122 'invalid': [
1098 'GL_SHORT', 1123 'GL_SHORT',
1099 'GL_INT', 1124 'GL_INT',
1100 ], 1125 ],
1101 }, 1126 },
1127 'PathFillMode': {
1128 'type': 'GLenum',
1129 'valid': [
1130 'GL_INVERT',
1131 'GL_COUNT_UP_CHROMIUM',
1132 'GL_COUNT_DOWN_CHROMIUM',
1133 ],
1134 },
1135 'PathParameter': {
1136 'type': 'GLenum',
1137 'valid': [
1138 'GL_PATH_STROKE_WIDTH_CHROMIUM',
1139 'GL_PATH_INITIAL_END_CAP_CHROMIUM',
1140 'GL_PATH_TERMINAL_END_CAP_CHROMIUM',
1141 'GL_PATH_JOIN_STYLE_CHROMIUM',
1142 'GL_PATH_MITER_LIMIT_CHROMIUM',
1143 ]
1144 },
1145 'PathParameterCapValues': {
1146 'type': 'GLint',
1147 'valid': [
1148 'GL_FLAT',
1149 'GL_SQUARE_CHROMIUM',
1150 'GL_ROUND_CHROMIUM',
1151 ]
1152 },
1153 'PathParameterJoinValues': {
1154 'type': 'GLint',
1155 'valid': [
1156 'GL_MITER_REVERT_CHROMIUM',
1157 'GL_BEVEL_CHROMIUM',
1158 'GL_ROUND_CHROMIUM',
1159 ]
1160 },
1102 'ReadPixelType': { 1161 'ReadPixelType': {
1103 'type': 'GLenum', 1162 'type': 'GLenum',
1104 'valid': [ 1163 'valid': [
1105 'GL_UNSIGNED_BYTE', 1164 'GL_UNSIGNED_BYTE',
1106 'GL_UNSIGNED_SHORT_5_6_5', 1165 'GL_UNSIGNED_SHORT_5_6_5',
1107 'GL_UNSIGNED_SHORT_4_4_4_4', 1166 'GL_UNSIGNED_SHORT_4_4_4_4',
1108 'GL_UNSIGNED_SHORT_5_5_5_1', 1167 'GL_UNSIGNED_SHORT_5_5_5_1',
1109 ], 1168 ],
1110 'invalid': [ 1169 'invalid': [
1111 'GL_SHORT', 1170 'GL_SHORT',
(...skipping 1492 matching lines...) Expand 10 before | Expand all | Expand 10 after
2604 'extension': True, 2663 'extension': True,
2605 'extension_flag': 'chromium_path_rendering', 2664 'extension_flag': 'chromium_path_rendering',
2606 }, 2665 },
2607 'MatrixLoadIdentityCHROMIUM': { 2666 'MatrixLoadIdentityCHROMIUM': {
2608 'decoder_func': 'DoMatrixLoadIdentityCHROMIUM', 2667 'decoder_func': 'DoMatrixLoadIdentityCHROMIUM',
2609 'gl_test_func': 'glMatrixLoadIdentityEXT', 2668 'gl_test_func': 'glMatrixLoadIdentityEXT',
2610 'chromium': True, 2669 'chromium': True,
2611 'extension': True, 2670 'extension': True,
2612 'extension_flag': 'chromium_path_rendering', 2671 'extension_flag': 'chromium_path_rendering',
2613 }, 2672 },
2673 'GenPathsCHROMIUM': {
2674 'type': 'Custom',
2675 'cmd_args': 'GLuint first_client_id, GLsizei range',
2676 'chromium': True,
2677 'extension': True,
2678 'extension_flag': 'chromium_path_rendering',
2679 },
2680 'DeletePathsCHROMIUM': {
2681 'type': 'Custom',
2682 'cmd_args': 'GLuint first_client_id, GLsizei range',
2683 'impl_func': False,
2684 'unit_test': False,
2685 'chromium': True,
2686 'extension': True,
2687 'extension_flag': 'chromium_path_rendering',
2688 },
2689 'IsPathCHROMIUM': {
2690 'type': 'Is',
2691 'decoder_func': 'DoIsPathCHROMIUM',
2692 'gl_test_func': 'glIsPathNV',
2693 'chromium': True,
2694 'extension': True,
2695 'extension_flag': 'chromium_path_rendering',
2696 },
2697 'PathCommandsCHROMIUM': {
2698 'type': 'Manual',
2699 'immediate': False,
2700 'chromium': True,
2701 'extension': True,
2702 'extension_flag': 'chromium_path_rendering',
2703 },
2704 'PathParameterfCHROMIUM': {
2705 'type': 'Custom',
2706 'chromium': True,
2707 'extension': True,
2708 'extension_flag': 'chromium_path_rendering',
2709 },
2710 'PathParameteriCHROMIUM': {
2711 'type': 'Custom',
2712 'chromium': True,
2713 'extension': True,
2714 'extension_flag': 'chromium_path_rendering',
2715 },
2716 'PathStencilFuncCHROMIUM': {
2717 'type': 'StateSet',
2718 'state': 'PathStencilFuncCHROMIUM',
2719 'decoder_func': 'glPathStencilFuncNV',
2720 'chromium': True,
2721 'extension': True,
2722 'extension_flag': 'chromium_path_rendering',
2723 },
2724 'StencilFillPathCHROMIUM': {
2725 'type': 'Custom',
2726 'chromium': True,
2727 'extension': True,
2728 'extension_flag': 'chromium_path_rendering',
2729 },
2730 'StencilStrokePathCHROMIUM': {
2731 'type': 'Custom',
2732 'chromium': True,
2733 'extension': True,
2734 'extension_flag': 'chromium_path_rendering',
2735 },
2736 'CoverFillPathCHROMIUM': {
2737 'type': 'Custom',
2738 'chromium': True,
2739 'extension': True,
2740 'extension_flag': 'chromium_path_rendering',
2741 },
2742 'CoverStrokePathCHROMIUM': {
2743 'type': 'Custom',
2744 'chromium': True,
2745 'extension': True,
2746 'extension_flag': 'chromium_path_rendering',
2747 },
2748 'StencilThenCoverFillPathCHROMIUM': {
2749 'type': 'Custom',
2750 'chromium': True,
2751 'extension': True,
2752 'extension_flag': 'chromium_path_rendering',
2753 },
2754 'StencilThenCoverStrokePathCHROMIUM': {
2755 'type': 'Custom',
2756 'chromium': True,
2757 'extension': True,
2758 'extension_flag': 'chromium_path_rendering',
2759 },
2760
2614 } 2761 }
2615 2762
2616 2763
2617 def Grouper(n, iterable, fillvalue=None): 2764 def Grouper(n, iterable, fillvalue=None):
2618 """Collect data into fixed-length chunks or blocks""" 2765 """Collect data into fixed-length chunks or blocks"""
2619 args = [iter(iterable)] * n 2766 args = [iter(iterable)] * n
2620 return itertools.izip_longest(fillvalue=fillvalue, *args) 2767 return itertools.izip_longest(fillvalue=fillvalue, *args)
2621 2768
2622 2769
2623 def SplitWords(input_string): 2770 def SplitWords(input_string):
(...skipping 3166 matching lines...) Expand 10 before | Expand all | Expand 10 after
5790 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd)); 5937 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
5791 } 5938 }
5792 """ 5939 """
5793 self.WriteValidUnitTest(func, file, invalid_test, { 5940 self.WriteValidUnitTest(func, file, invalid_test, {
5794 'comma': comma, 5941 'comma': comma,
5795 }, *extras) 5942 }, *extras)
5796 5943
5797 def WriteServiceImplementation(self, func, file): 5944 def WriteServiceImplementation(self, func, file):
5798 """Overrriden from TypeHandler.""" 5945 """Overrriden from TypeHandler."""
5799 self.WriteServiceHandlerFunctionHeader(func, file) 5946 self.WriteServiceHandlerFunctionHeader(func, file)
5947 self.WriteHandlerExtensionCheck(func, file)
5800 args = func.GetOriginalArgs() 5948 args = func.GetOriginalArgs()
5801 for arg in args: 5949 for arg in args:
5802 arg.WriteGetCode(file) 5950 arg.WriteGetCode(file)
5803 5951
5804 code = """ typedef cmds::%(func_name)s::Result Result; 5952 code = """ typedef cmds::%(func_name)s::Result Result;
5805 Result* result_dst = GetSharedMemoryAs<Result*>( 5953 Result* result_dst = GetSharedMemoryAs<Result*>(
5806 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); 5954 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst));
5807 if (!result_dst) { 5955 if (!result_dst) {
5808 return error::kOutOfBounds; 5956 return error::kOutOfBounds;
5809 } 5957 }
(...skipping 2808 matching lines...) Expand 10 before | Expand all | Expand 10 after
8618 Format(gen.generated_cpp_filenames) 8766 Format(gen.generated_cpp_filenames)
8619 8767
8620 if gen.errors > 0: 8768 if gen.errors > 0:
8621 print "%d errors" % gen.errors 8769 print "%d errors" % gen.errors
8622 return 1 8770 return 1
8623 return 0 8771 return 0
8624 8772
8625 8773
8626 if __name__ == '__main__': 8774 if __name__ == '__main__':
8627 sys.exit(main(sys.argv[1:])) 8775 sys.exit(main(sys.argv[1:]))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698