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 919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1472 'GL_UNSIGNED_INT_2_10_10_10_REV', | 1497 'GL_UNSIGNED_INT_2_10_10_10_REV', |
1473 'GL_UNSIGNED_INT_10F_11F_11F_REV', | 1498 'GL_UNSIGNED_INT_10F_11F_11F_REV', |
1474 'GL_UNSIGNED_INT_5_9_9_9_REV', | 1499 'GL_UNSIGNED_INT_5_9_9_9_REV', |
1475 'GL_UNSIGNED_INT_24_8', | 1500 'GL_UNSIGNED_INT_24_8', |
1476 'GL_FLOAT_32_UNSIGNED_INT_24_8_REV', | 1501 'GL_FLOAT_32_UNSIGNED_INT_24_8_REV', |
1477 ], | 1502 ], |
1478 'invalid': [ | 1503 'invalid': [ |
1479 'GL_UNSIGNED_BYTE_3_3_2', | 1504 'GL_UNSIGNED_BYTE_3_3_2', |
1480 ], | 1505 ], |
1481 }, | 1506 }, |
| 1507 'PathCoordType': { |
| 1508 'type': 'GLenum', |
| 1509 'valid': [ |
| 1510 'GL_BYTE', |
| 1511 'GL_UNSIGNED_BYTE', |
| 1512 'GL_SHORT', |
| 1513 'GL_UNSIGNED_SHORT', |
| 1514 'GL_FLOAT', |
| 1515 ], |
| 1516 }, |
| 1517 'PathCoverMode': { |
| 1518 'type': 'GLenum', |
| 1519 'valid': [ |
| 1520 'GL_CONVEX_HULL_CHROMIUM', |
| 1521 'GL_BOUNDING_BOX_CHROMIUM', |
| 1522 ], |
| 1523 }, |
| 1524 'PathFillMode': { |
| 1525 'type': 'GLenum', |
| 1526 'valid': [ |
| 1527 'GL_INVERT', |
| 1528 'GL_COUNT_UP_CHROMIUM', |
| 1529 'GL_COUNT_DOWN_CHROMIUM', |
| 1530 ], |
| 1531 }, |
| 1532 'PathParameter': { |
| 1533 'type': 'GLenum', |
| 1534 'valid': [ |
| 1535 'GL_PATH_STROKE_WIDTH_CHROMIUM', |
| 1536 'GL_PATH_END_CAPS_CHROMIUM', |
| 1537 'GL_PATH_JOIN_STYLE_CHROMIUM', |
| 1538 'GL_PATH_MITER_LIMIT_CHROMIUM', |
| 1539 'GL_PATH_STROKE_BOUND_CHROMIUM', |
| 1540 ] |
| 1541 }, |
| 1542 'PathParameterCapValues': { |
| 1543 'type': 'GLint', |
| 1544 'valid': [ |
| 1545 'GL_FLAT', |
| 1546 'GL_SQUARE_CHROMIUM', |
| 1547 'GL_ROUND_CHROMIUM', |
| 1548 ] |
| 1549 }, |
| 1550 'PathParameterJoinValues': { |
| 1551 'type': 'GLint', |
| 1552 'valid': [ |
| 1553 'GL_MITER_REVERT_CHROMIUM', |
| 1554 'GL_BEVEL_CHROMIUM', |
| 1555 'GL_ROUND_CHROMIUM', |
| 1556 ] |
| 1557 }, |
1482 'ReadPixelType': { | 1558 'ReadPixelType': { |
1483 'type': 'GLenum', | 1559 'type': 'GLenum', |
1484 'valid': [ | 1560 'valid': [ |
1485 'GL_UNSIGNED_BYTE', | 1561 'GL_UNSIGNED_BYTE', |
1486 'GL_UNSIGNED_SHORT_5_6_5', | 1562 'GL_UNSIGNED_SHORT_5_6_5', |
1487 'GL_UNSIGNED_SHORT_4_4_4_4', | 1563 'GL_UNSIGNED_SHORT_4_4_4_4', |
1488 'GL_UNSIGNED_SHORT_5_5_5_1', | 1564 'GL_UNSIGNED_SHORT_5_5_5_1', |
1489 ], | 1565 ], |
1490 'invalid': [ | 1566 'invalid': [ |
1491 'GL_SHORT', | 1567 'GL_SHORT', |
(...skipping 2470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3962 'extension': True, | 4038 'extension': True, |
3963 'extension_flag': 'chromium_path_rendering', | 4039 'extension_flag': 'chromium_path_rendering', |
3964 }, | 4040 }, |
3965 'MatrixLoadIdentityCHROMIUM': { | 4041 'MatrixLoadIdentityCHROMIUM': { |
3966 'decoder_func': 'DoMatrixLoadIdentityCHROMIUM', | 4042 'decoder_func': 'DoMatrixLoadIdentityCHROMIUM', |
3967 'gl_test_func': 'glMatrixLoadIdentityEXT', | 4043 'gl_test_func': 'glMatrixLoadIdentityEXT', |
3968 'chromium': True, | 4044 'chromium': True, |
3969 'extension': True, | 4045 'extension': True, |
3970 'extension_flag': 'chromium_path_rendering', | 4046 'extension_flag': 'chromium_path_rendering', |
3971 }, | 4047 }, |
| 4048 'GenPathsCHROMIUM': { |
| 4049 'type': 'Custom', |
| 4050 'cmd_args': 'GLuint first_client_id, GLsizei range', |
| 4051 'chromium': True, |
| 4052 'extension': True, |
| 4053 'extension_flag': 'chromium_path_rendering', |
| 4054 }, |
| 4055 'DeletePathsCHROMIUM': { |
| 4056 'type': 'Custom', |
| 4057 'cmd_args': 'GLuint first_client_id, GLsizei range', |
| 4058 'impl_func': False, |
| 4059 'unit_test': False, |
| 4060 'chromium': True, |
| 4061 'extension': True, |
| 4062 'extension_flag': 'chromium_path_rendering', |
| 4063 }, |
| 4064 'IsPathCHROMIUM': { |
| 4065 'type': 'Is', |
| 4066 'decoder_func': 'DoIsPathCHROMIUM', |
| 4067 'gl_test_func': 'glIsPathNV', |
| 4068 'chromium': True, |
| 4069 'extension': True, |
| 4070 'extension_flag': 'chromium_path_rendering', |
| 4071 }, |
| 4072 'PathCommandsCHROMIUM': { |
| 4073 'type': 'Manual', |
| 4074 'immediate': False, |
| 4075 'chromium': True, |
| 4076 'extension': True, |
| 4077 'extension_flag': 'chromium_path_rendering', |
| 4078 }, |
| 4079 'PathParameterfCHROMIUM': { |
| 4080 'type': 'Custom', |
| 4081 'chromium': True, |
| 4082 'extension': True, |
| 4083 'extension_flag': 'chromium_path_rendering', |
| 4084 }, |
| 4085 'PathParameteriCHROMIUM': { |
| 4086 'type': 'Custom', |
| 4087 'chromium': True, |
| 4088 'extension': True, |
| 4089 'extension_flag': 'chromium_path_rendering', |
| 4090 }, |
| 4091 'PathStencilFuncCHROMIUM': { |
| 4092 'type': 'StateSet', |
| 4093 'state': 'PathStencilFuncCHROMIUM', |
| 4094 'decoder_func': 'glPathStencilFuncNV', |
| 4095 'chromium': True, |
| 4096 'extension': True, |
| 4097 'extension_flag': 'chromium_path_rendering', |
| 4098 }, |
| 4099 'StencilFillPathCHROMIUM': { |
| 4100 'type': 'Custom', |
| 4101 'chromium': True, |
| 4102 'extension': True, |
| 4103 'extension_flag': 'chromium_path_rendering', |
| 4104 }, |
| 4105 'StencilStrokePathCHROMIUM': { |
| 4106 'type': 'Custom', |
| 4107 'chromium': True, |
| 4108 'extension': True, |
| 4109 'extension_flag': 'chromium_path_rendering', |
| 4110 }, |
| 4111 'CoverFillPathCHROMIUM': { |
| 4112 'type': 'Custom', |
| 4113 'chromium': True, |
| 4114 'extension': True, |
| 4115 'extension_flag': 'chromium_path_rendering', |
| 4116 }, |
| 4117 'CoverStrokePathCHROMIUM': { |
| 4118 'type': 'Custom', |
| 4119 'chromium': True, |
| 4120 'extension': True, |
| 4121 'extension_flag': 'chromium_path_rendering', |
| 4122 }, |
| 4123 'StencilThenCoverFillPathCHROMIUM': { |
| 4124 'type': 'Custom', |
| 4125 'chromium': True, |
| 4126 'extension': True, |
| 4127 'extension_flag': 'chromium_path_rendering', |
| 4128 }, |
| 4129 'StencilThenCoverStrokePathCHROMIUM': { |
| 4130 'type': 'Custom', |
| 4131 'chromium': True, |
| 4132 'extension': True, |
| 4133 'extension_flag': 'chromium_path_rendering', |
| 4134 }, |
| 4135 |
3972 } | 4136 } |
3973 | 4137 |
3974 | 4138 |
3975 def Grouper(n, iterable, fillvalue=None): | 4139 def Grouper(n, iterable, fillvalue=None): |
3976 """Collect data into fixed-length chunks or blocks""" | 4140 """Collect data into fixed-length chunks or blocks""" |
3977 args = [iter(iterable)] * n | 4141 args = [iter(iterable)] * n |
3978 return itertools.izip_longest(fillvalue=fillvalue, *args) | 4142 return itertools.izip_longest(fillvalue=fillvalue, *args) |
3979 | 4143 |
3980 | 4144 |
3981 def SplitWords(input_string): | 4145 def SplitWords(input_string): |
(...skipping 3950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7932 invalid_test += """ | 8096 invalid_test += """ |
7933 } | 8097 } |
7934 """ | 8098 """ |
7935 self.WriteValidUnitTest(func, file, invalid_test, { | 8099 self.WriteValidUnitTest(func, file, invalid_test, { |
7936 'comma': comma, | 8100 'comma': comma, |
7937 }, *extras) | 8101 }, *extras) |
7938 | 8102 |
7939 def WriteServiceImplementation(self, func, file): | 8103 def WriteServiceImplementation(self, func, file): |
7940 """Overrriden from TypeHandler.""" | 8104 """Overrriden from TypeHandler.""" |
7941 self.WriteServiceHandlerFunctionHeader(func, file) | 8105 self.WriteServiceHandlerFunctionHeader(func, file) |
| 8106 self.WriteHandlerExtensionCheck(func, file) |
7942 args = func.GetOriginalArgs() | 8107 args = func.GetOriginalArgs() |
7943 for arg in args: | 8108 for arg in args: |
7944 arg.WriteGetCode(file) | 8109 arg.WriteGetCode(file) |
7945 | 8110 |
7946 code = """ typedef cmds::%(func_name)s::Result Result; | 8111 code = """ typedef cmds::%(func_name)s::Result Result; |
7947 Result* result_dst = GetSharedMemoryAs<Result*>( | 8112 Result* result_dst = GetSharedMemoryAs<Result*>( |
7948 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); | 8113 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); |
7949 if (!result_dst) { | 8114 if (!result_dst) { |
7950 return error::kOutOfBounds; | 8115 return error::kOutOfBounds; |
7951 } | 8116 } |
(...skipping 3149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11101 Format(gen.generated_cpp_filenames) | 11266 Format(gen.generated_cpp_filenames) |
11102 | 11267 |
11103 if gen.errors > 0: | 11268 if gen.errors > 0: |
11104 print "%d errors" % gen.errors | 11269 print "%d errors" % gen.errors |
11105 return 1 | 11270 return 1 |
11106 return 0 | 11271 return 0 |
11107 | 11272 |
11108 | 11273 |
11109 if __name__ == '__main__': | 11274 if __name__ == '__main__': |
11110 sys.exit(main(sys.argv[1:])) | 11275 sys.exit(main(sys.argv[1:])) |
OLD | NEW |