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 2462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3954 'extension': True, | 4030 'extension': True, |
3955 'extension_flag': 'chromium_path_rendering', | 4031 'extension_flag': 'chromium_path_rendering', |
3956 }, | 4032 }, |
3957 'MatrixLoadIdentityCHROMIUM': { | 4033 'MatrixLoadIdentityCHROMIUM': { |
3958 'decoder_func': 'DoMatrixLoadIdentityCHROMIUM', | 4034 'decoder_func': 'DoMatrixLoadIdentityCHROMIUM', |
3959 'gl_test_func': 'glMatrixLoadIdentityEXT', | 4035 'gl_test_func': 'glMatrixLoadIdentityEXT', |
3960 'chromium': True, | 4036 'chromium': True, |
3961 'extension': True, | 4037 'extension': True, |
3962 'extension_flag': 'chromium_path_rendering', | 4038 'extension_flag': 'chromium_path_rendering', |
3963 }, | 4039 }, |
| 4040 'GenPathsCHROMIUM': { |
| 4041 'type': 'Custom', |
| 4042 'cmd_args': 'GLuint first_client_id, GLsizei range', |
| 4043 'chromium': True, |
| 4044 'extension': True, |
| 4045 'extension_flag': 'chromium_path_rendering', |
| 4046 }, |
| 4047 'DeletePathsCHROMIUM': { |
| 4048 'type': 'Custom', |
| 4049 'cmd_args': 'GLuint first_client_id, GLsizei range', |
| 4050 'impl_func': False, |
| 4051 'unit_test': False, |
| 4052 'chromium': True, |
| 4053 'extension': True, |
| 4054 'extension_flag': 'chromium_path_rendering', |
| 4055 }, |
| 4056 'IsPathCHROMIUM': { |
| 4057 'type': 'Is', |
| 4058 'decoder_func': 'DoIsPathCHROMIUM', |
| 4059 'gl_test_func': 'glIsPathNV', |
| 4060 'chromium': True, |
| 4061 'extension': True, |
| 4062 'extension_flag': 'chromium_path_rendering', |
| 4063 }, |
| 4064 'PathCommandsCHROMIUM': { |
| 4065 'type': 'Manual', |
| 4066 'immediate': False, |
| 4067 'chromium': True, |
| 4068 'extension': True, |
| 4069 'extension_flag': 'chromium_path_rendering', |
| 4070 }, |
| 4071 'PathParameterfCHROMIUM': { |
| 4072 'type': 'Custom', |
| 4073 'chromium': True, |
| 4074 'extension': True, |
| 4075 'extension_flag': 'chromium_path_rendering', |
| 4076 }, |
| 4077 'PathParameteriCHROMIUM': { |
| 4078 'type': 'Custom', |
| 4079 'chromium': True, |
| 4080 'extension': True, |
| 4081 'extension_flag': 'chromium_path_rendering', |
| 4082 }, |
| 4083 'PathStencilFuncCHROMIUM': { |
| 4084 'type': 'StateSet', |
| 4085 'state': 'PathStencilFuncCHROMIUM', |
| 4086 'decoder_func': 'glPathStencilFuncNV', |
| 4087 'chromium': True, |
| 4088 'extension': True, |
| 4089 'extension_flag': 'chromium_path_rendering', |
| 4090 }, |
| 4091 'StencilFillPathCHROMIUM': { |
| 4092 'type': 'Custom', |
| 4093 'chromium': True, |
| 4094 'extension': True, |
| 4095 'extension_flag': 'chromium_path_rendering', |
| 4096 }, |
| 4097 'StencilStrokePathCHROMIUM': { |
| 4098 'type': 'Custom', |
| 4099 'chromium': True, |
| 4100 'extension': True, |
| 4101 'extension_flag': 'chromium_path_rendering', |
| 4102 }, |
| 4103 'CoverFillPathCHROMIUM': { |
| 4104 'type': 'Custom', |
| 4105 'chromium': True, |
| 4106 'extension': True, |
| 4107 'extension_flag': 'chromium_path_rendering', |
| 4108 }, |
| 4109 'CoverStrokePathCHROMIUM': { |
| 4110 'type': 'Custom', |
| 4111 'chromium': True, |
| 4112 'extension': True, |
| 4113 'extension_flag': 'chromium_path_rendering', |
| 4114 }, |
| 4115 'StencilThenCoverFillPathCHROMIUM': { |
| 4116 'type': 'Custom', |
| 4117 'chromium': True, |
| 4118 'extension': True, |
| 4119 'extension_flag': 'chromium_path_rendering', |
| 4120 }, |
| 4121 'StencilThenCoverStrokePathCHROMIUM': { |
| 4122 'type': 'Custom', |
| 4123 'chromium': True, |
| 4124 'extension': True, |
| 4125 'extension_flag': 'chromium_path_rendering', |
| 4126 }, |
| 4127 |
3964 } | 4128 } |
3965 | 4129 |
3966 | 4130 |
3967 def Grouper(n, iterable, fillvalue=None): | 4131 def Grouper(n, iterable, fillvalue=None): |
3968 """Collect data into fixed-length chunks or blocks""" | 4132 """Collect data into fixed-length chunks or blocks""" |
3969 args = [iter(iterable)] * n | 4133 args = [iter(iterable)] * n |
3970 return itertools.izip_longest(fillvalue=fillvalue, *args) | 4134 return itertools.izip_longest(fillvalue=fillvalue, *args) |
3971 | 4135 |
3972 | 4136 |
3973 def SplitWords(input_string): | 4137 def SplitWords(input_string): |
(...skipping 3950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7924 invalid_test += """ | 8088 invalid_test += """ |
7925 } | 8089 } |
7926 """ | 8090 """ |
7927 self.WriteValidUnitTest(func, file, invalid_test, { | 8091 self.WriteValidUnitTest(func, file, invalid_test, { |
7928 'comma': comma, | 8092 'comma': comma, |
7929 }, *extras) | 8093 }, *extras) |
7930 | 8094 |
7931 def WriteServiceImplementation(self, func, file): | 8095 def WriteServiceImplementation(self, func, file): |
7932 """Overrriden from TypeHandler.""" | 8096 """Overrriden from TypeHandler.""" |
7933 self.WriteServiceHandlerFunctionHeader(func, file) | 8097 self.WriteServiceHandlerFunctionHeader(func, file) |
| 8098 self.WriteHandlerExtensionCheck(func, file) |
7934 args = func.GetOriginalArgs() | 8099 args = func.GetOriginalArgs() |
7935 for arg in args: | 8100 for arg in args: |
7936 arg.WriteGetCode(file) | 8101 arg.WriteGetCode(file) |
7937 | 8102 |
7938 code = """ typedef cmds::%(func_name)s::Result Result; | 8103 code = """ typedef cmds::%(func_name)s::Result Result; |
7939 Result* result_dst = GetSharedMemoryAs<Result*>( | 8104 Result* result_dst = GetSharedMemoryAs<Result*>( |
7940 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); | 8105 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); |
7941 if (!result_dst) { | 8106 if (!result_dst) { |
7942 return error::kOutOfBounds; | 8107 return error::kOutOfBounds; |
7943 } | 8108 } |
(...skipping 3149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11093 Format(gen.generated_cpp_filenames) | 11258 Format(gen.generated_cpp_filenames) |
11094 | 11259 |
11095 if gen.errors > 0: | 11260 if gen.errors > 0: |
11096 print "%d errors" % gen.errors | 11261 print "%d errors" % gen.errors |
11097 return 1 | 11262 return 1 |
11098 return 0 | 11263 return 0 |
11099 | 11264 |
11100 | 11265 |
11101 if __name__ == '__main__': | 11266 if __name__ == '__main__': |
11102 sys.exit(main(sys.argv[1:])) | 11267 sys.exit(main(sys.argv[1:])) |
OLD | NEW |