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 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 'default': [ | 533 'default': [ |
534 '1.0f', '0.0f','0.0f','0.0f', | 534 '1.0f', '0.0f','0.0f','0.0f', |
535 '0.0f', '1.0f','0.0f','0.0f', | 535 '0.0f', '1.0f','0.0f','0.0f', |
536 '0.0f', '0.0f','1.0f','0.0f', | 536 '0.0f', '0.0f','1.0f','0.0f', |
537 '0.0f', '0.0f','0.0f','1.0f', | 537 '0.0f', '0.0f','0.0f','1.0f', |
538 ], | 538 ], |
539 'extension_flag': 'chromium_path_rendering', | 539 'extension_flag': 'chromium_path_rendering', |
540 }, | 540 }, |
541 ], | 541 ], |
542 }, | 542 }, |
| 543 'PathStencilFuncCHROMIUM': { |
| 544 'type': 'Normal', |
| 545 'func': 'PathStencilFuncNV', |
| 546 'extension_flag': 'chromium_path_rendering', |
| 547 'states': [ |
| 548 { |
| 549 'name': 'stencil_path_func', |
| 550 'type': 'GLenum', |
| 551 'enum': 'GL_PATH_STENCIL_FUNC_CHROMIUM', |
| 552 'default': 'GL_ALWAYS', |
| 553 }, |
| 554 { |
| 555 'name': 'stencil_path_ref', |
| 556 'type': 'GLint', |
| 557 'enum': 'GL_PATH_STENCIL_REF_CHROMIUM', |
| 558 'default': '0', |
| 559 }, |
| 560 { |
| 561 'name': 'stencil_path_mask', |
| 562 'type': 'GLuint', |
| 563 'enum': 'GL_PATH_STENCIL_VALUE_MASK_CHROMIUM', |
| 564 'default': '0xFFFFFFFFU', |
| 565 }, |
| 566 ], |
| 567 }, |
543 } | 568 } |
544 | 569 |
545 # Named type info object represents a named type that is used in OpenGL call | 570 # Named type info object represents a named type that is used in OpenGL call |
546 # arguments. Each named type defines a set of valid OpenGL call arguments. The | 571 # arguments. Each named type defines a set of valid OpenGL call arguments. The |
547 # named types are used in 'cmd_buffer_functions.txt'. | 572 # named types are used in 'cmd_buffer_functions.txt'. |
548 # type: The actual GL type of the named type. | 573 # type: The actual GL type of the named type. |
549 # valid: The list of values that are valid for both the client and the service. | 574 # valid: The list of values that are valid for both the client and the service. |
550 # valid_es3: The list of values that are valid in OpenGL ES 3, but not ES 2. | 575 # valid_es3: The list of values that are valid in OpenGL ES 3, but not ES 2. |
551 # invalid: Examples of invalid values for the type. At least these values | 576 # invalid: Examples of invalid values for the type. At least these values |
552 # should be tested to be invalid. | 577 # should be tested to be invalid. |
(...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1478 'GL_UNSIGNED_INT_2_10_10_10_REV', | 1503 'GL_UNSIGNED_INT_2_10_10_10_REV', |
1479 'GL_UNSIGNED_INT_10F_11F_11F_REV', | 1504 'GL_UNSIGNED_INT_10F_11F_11F_REV', |
1480 'GL_UNSIGNED_INT_5_9_9_9_REV', | 1505 'GL_UNSIGNED_INT_5_9_9_9_REV', |
1481 'GL_UNSIGNED_INT_24_8', | 1506 'GL_UNSIGNED_INT_24_8', |
1482 'GL_FLOAT_32_UNSIGNED_INT_24_8_REV', | 1507 'GL_FLOAT_32_UNSIGNED_INT_24_8_REV', |
1483 ], | 1508 ], |
1484 'invalid': [ | 1509 'invalid': [ |
1485 'GL_UNSIGNED_BYTE_3_3_2', | 1510 'GL_UNSIGNED_BYTE_3_3_2', |
1486 ], | 1511 ], |
1487 }, | 1512 }, |
| 1513 'PathCoordType': { |
| 1514 'type': 'GLenum', |
| 1515 'valid': [ |
| 1516 'GL_BYTE', |
| 1517 'GL_UNSIGNED_BYTE', |
| 1518 'GL_SHORT', |
| 1519 'GL_UNSIGNED_SHORT', |
| 1520 'GL_FLOAT', |
| 1521 ], |
| 1522 }, |
| 1523 'PathCoverMode': { |
| 1524 'type': 'GLenum', |
| 1525 'valid': [ |
| 1526 'GL_CONVEX_HULL_CHROMIUM', |
| 1527 'GL_BOUNDING_BOX_CHROMIUM', |
| 1528 ], |
| 1529 }, |
| 1530 'PathFillMode': { |
| 1531 'type': 'GLenum', |
| 1532 'valid': [ |
| 1533 'GL_INVERT', |
| 1534 'GL_COUNT_UP_CHROMIUM', |
| 1535 'GL_COUNT_DOWN_CHROMIUM', |
| 1536 ], |
| 1537 }, |
| 1538 'PathParameter': { |
| 1539 'type': 'GLenum', |
| 1540 'valid': [ |
| 1541 'GL_PATH_STROKE_WIDTH_CHROMIUM', |
| 1542 'GL_PATH_END_CAPS_CHROMIUM', |
| 1543 'GL_PATH_JOIN_STYLE_CHROMIUM', |
| 1544 'GL_PATH_MITER_LIMIT_CHROMIUM', |
| 1545 'GL_PATH_STROKE_BOUND_CHROMIUM', |
| 1546 ] |
| 1547 }, |
| 1548 'PathParameterCapValues': { |
| 1549 'type': 'GLint', |
| 1550 'valid': [ |
| 1551 'GL_FLAT', |
| 1552 'GL_SQUARE_CHROMIUM', |
| 1553 'GL_ROUND_CHROMIUM', |
| 1554 ] |
| 1555 }, |
| 1556 'PathParameterJoinValues': { |
| 1557 'type': 'GLint', |
| 1558 'valid': [ |
| 1559 'GL_MITER_REVERT_CHROMIUM', |
| 1560 'GL_BEVEL_CHROMIUM', |
| 1561 'GL_ROUND_CHROMIUM', |
| 1562 ] |
| 1563 }, |
1488 'ReadPixelType': { | 1564 'ReadPixelType': { |
1489 'type': 'GLenum', | 1565 'type': 'GLenum', |
1490 'valid': [ | 1566 'valid': [ |
1491 'GL_UNSIGNED_BYTE', | 1567 'GL_UNSIGNED_BYTE', |
1492 'GL_UNSIGNED_SHORT_5_6_5', | 1568 'GL_UNSIGNED_SHORT_5_6_5', |
1493 'GL_UNSIGNED_SHORT_4_4_4_4', | 1569 'GL_UNSIGNED_SHORT_4_4_4_4', |
1494 'GL_UNSIGNED_SHORT_5_5_5_1', | 1570 'GL_UNSIGNED_SHORT_5_5_5_1', |
1495 ], | 1571 ], |
1496 'invalid': [ | 1572 'invalid': [ |
1497 'GL_SHORT', | 1573 'GL_SHORT', |
(...skipping 2462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3960 'extension': True, | 4036 'extension': True, |
3961 'extension_flag': 'chromium_path_rendering', | 4037 'extension_flag': 'chromium_path_rendering', |
3962 }, | 4038 }, |
3963 'MatrixLoadIdentityCHROMIUM': { | 4039 'MatrixLoadIdentityCHROMIUM': { |
3964 'decoder_func': 'DoMatrixLoadIdentityCHROMIUM', | 4040 'decoder_func': 'DoMatrixLoadIdentityCHROMIUM', |
3965 'gl_test_func': 'glMatrixLoadIdentityEXT', | 4041 'gl_test_func': 'glMatrixLoadIdentityEXT', |
3966 'chromium': True, | 4042 'chromium': True, |
3967 'extension': True, | 4043 'extension': True, |
3968 'extension_flag': 'chromium_path_rendering', | 4044 'extension_flag': 'chromium_path_rendering', |
3969 }, | 4045 }, |
| 4046 'GenPathsCHROMIUM': { |
| 4047 'type': 'Custom', |
| 4048 'cmd_args': 'GLuint first_client_id, GLsizei range', |
| 4049 'chromium': True, |
| 4050 'extension': True, |
| 4051 'extension_flag': 'chromium_path_rendering', |
| 4052 }, |
| 4053 'DeletePathsCHROMIUM': { |
| 4054 'type': 'Custom', |
| 4055 'cmd_args': 'GLuint first_client_id, GLsizei range', |
| 4056 'impl_func': False, |
| 4057 'unit_test': False, |
| 4058 'chromium': True, |
| 4059 'extension': True, |
| 4060 'extension_flag': 'chromium_path_rendering', |
| 4061 }, |
| 4062 'IsPathCHROMIUM': { |
| 4063 'type': 'Is', |
| 4064 'decoder_func': 'DoIsPathCHROMIUM', |
| 4065 'gl_test_func': 'glIsPathNV', |
| 4066 'chromium': True, |
| 4067 'extension': True, |
| 4068 'extension_flag': 'chromium_path_rendering', |
| 4069 }, |
| 4070 'PathCommandsCHROMIUM': { |
| 4071 'type': 'Manual', |
| 4072 'immediate': False, |
| 4073 'chromium': True, |
| 4074 'extension': True, |
| 4075 'extension_flag': 'chromium_path_rendering', |
| 4076 }, |
| 4077 'PathParameterfCHROMIUM': { |
| 4078 'type': 'Custom', |
| 4079 'chromium': True, |
| 4080 'extension': True, |
| 4081 'extension_flag': 'chromium_path_rendering', |
| 4082 }, |
| 4083 'PathParameteriCHROMIUM': { |
| 4084 'type': 'Custom', |
| 4085 'chromium': True, |
| 4086 'extension': True, |
| 4087 'extension_flag': 'chromium_path_rendering', |
| 4088 }, |
| 4089 'PathStencilFuncCHROMIUM': { |
| 4090 'type': 'StateSet', |
| 4091 'state': 'PathStencilFuncCHROMIUM', |
| 4092 'decoder_func': 'glPathStencilFuncNV', |
| 4093 'chromium': True, |
| 4094 'extension': True, |
| 4095 'extension_flag': 'chromium_path_rendering', |
| 4096 }, |
| 4097 'StencilFillPathCHROMIUM': { |
| 4098 'type': 'Custom', |
| 4099 'chromium': True, |
| 4100 'extension': True, |
| 4101 'extension_flag': 'chromium_path_rendering', |
| 4102 }, |
| 4103 'StencilStrokePathCHROMIUM': { |
| 4104 'type': 'Custom', |
| 4105 'chromium': True, |
| 4106 'extension': True, |
| 4107 'extension_flag': 'chromium_path_rendering', |
| 4108 }, |
| 4109 'CoverFillPathCHROMIUM': { |
| 4110 'type': 'Custom', |
| 4111 'chromium': True, |
| 4112 'extension': True, |
| 4113 'extension_flag': 'chromium_path_rendering', |
| 4114 }, |
| 4115 'CoverStrokePathCHROMIUM': { |
| 4116 'type': 'Custom', |
| 4117 'chromium': True, |
| 4118 'extension': True, |
| 4119 'extension_flag': 'chromium_path_rendering', |
| 4120 }, |
| 4121 'StencilThenCoverFillPathCHROMIUM': { |
| 4122 'type': 'Custom', |
| 4123 'chromium': True, |
| 4124 'extension': True, |
| 4125 'extension_flag': 'chromium_path_rendering', |
| 4126 }, |
| 4127 'StencilThenCoverStrokePathCHROMIUM': { |
| 4128 'type': 'Custom', |
| 4129 'chromium': True, |
| 4130 'extension': True, |
| 4131 'extension_flag': 'chromium_path_rendering', |
| 4132 }, |
| 4133 |
3970 } | 4134 } |
3971 | 4135 |
3972 | 4136 |
3973 def Grouper(n, iterable, fillvalue=None): | 4137 def Grouper(n, iterable, fillvalue=None): |
3974 """Collect data into fixed-length chunks or blocks""" | 4138 """Collect data into fixed-length chunks or blocks""" |
3975 args = [iter(iterable)] * n | 4139 args = [iter(iterable)] * n |
3976 return itertools.izip_longest(fillvalue=fillvalue, *args) | 4140 return itertools.izip_longest(fillvalue=fillvalue, *args) |
3977 | 4141 |
3978 | 4142 |
3979 def SplitWords(input_string): | 4143 def SplitWords(input_string): |
(...skipping 3950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7930 invalid_test += """ | 8094 invalid_test += """ |
7931 } | 8095 } |
7932 """ | 8096 """ |
7933 self.WriteValidUnitTest(func, file, invalid_test, { | 8097 self.WriteValidUnitTest(func, file, invalid_test, { |
7934 'comma': comma, | 8098 'comma': comma, |
7935 }, *extras) | 8099 }, *extras) |
7936 | 8100 |
7937 def WriteServiceImplementation(self, func, file): | 8101 def WriteServiceImplementation(self, func, file): |
7938 """Overrriden from TypeHandler.""" | 8102 """Overrriden from TypeHandler.""" |
7939 self.WriteServiceHandlerFunctionHeader(func, file) | 8103 self.WriteServiceHandlerFunctionHeader(func, file) |
| 8104 self.WriteHandlerExtensionCheck(func, file) |
7940 args = func.GetOriginalArgs() | 8105 args = func.GetOriginalArgs() |
7941 for arg in args: | 8106 for arg in args: |
7942 arg.WriteGetCode(file) | 8107 arg.WriteGetCode(file) |
7943 | 8108 |
7944 code = """ typedef cmds::%(func_name)s::Result Result; | 8109 code = """ typedef cmds::%(func_name)s::Result Result; |
7945 Result* result_dst = GetSharedMemoryAs<Result*>( | 8110 Result* result_dst = GetSharedMemoryAs<Result*>( |
7946 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); | 8111 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); |
7947 if (!result_dst) { | 8112 if (!result_dst) { |
7948 return error::kOutOfBounds; | 8113 return error::kOutOfBounds; |
7949 } | 8114 } |
(...skipping 3149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11099 Format(gen.generated_cpp_filenames) | 11264 Format(gen.generated_cpp_filenames) |
11100 | 11265 |
11101 if gen.errors > 0: | 11266 if gen.errors > 0: |
11102 print "%d errors" % gen.errors | 11267 print "%d errors" % gen.errors |
11103 return 1 | 11268 return 1 |
11104 return 0 | 11269 return 0 |
11105 | 11270 |
11106 | 11271 |
11107 if __name__ == '__main__': | 11272 if __name__ == '__main__': |
11108 sys.exit(main(sys.argv[1:])) | 11273 sys.exit(main(sys.argv[1:])) |
OLD | NEW |