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

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 Created 5 years, 6 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 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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 2456 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 3948 matching lines...) Expand 10 before | Expand all | Expand 10 after
7922 invalid_test += """ 8086 invalid_test += """
7923 } 8087 }
7924 """ 8088 """
7925 self.WriteValidUnitTest(func, file, invalid_test, { 8089 self.WriteValidUnitTest(func, file, invalid_test, {
7926 'comma': comma, 8090 'comma': comma,
7927 }, *extras) 8091 }, *extras)
7928 8092
7929 def WriteServiceImplementation(self, func, file): 8093 def WriteServiceImplementation(self, func, file):
7930 """Overrriden from TypeHandler.""" 8094 """Overrriden from TypeHandler."""
7931 self.WriteServiceHandlerFunctionHeader(func, file) 8095 self.WriteServiceHandlerFunctionHeader(func, file)
8096 self.WriteHandlerExtensionCheck(func, file)
7932 args = func.GetOriginalArgs() 8097 args = func.GetOriginalArgs()
7933 for arg in args: 8098 for arg in args:
7934 arg.WriteGetCode(file) 8099 arg.WriteGetCode(file)
7935 8100
7936 code = """ typedef cmds::%(func_name)s::Result Result; 8101 code = """ typedef cmds::%(func_name)s::Result Result;
7937 Result* result_dst = GetSharedMemoryAs<Result*>( 8102 Result* result_dst = GetSharedMemoryAs<Result*>(
7938 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); 8103 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst));
7939 if (!result_dst) { 8104 if (!result_dst) {
7940 return error::kOutOfBounds; 8105 return error::kOutOfBounds;
7941 } 8106 }
(...skipping 3137 matching lines...) Expand 10 before | Expand all | Expand 10 after
11079 Format(gen.generated_cpp_filenames) 11244 Format(gen.generated_cpp_filenames)
11080 11245
11081 if gen.errors > 0: 11246 if gen.errors > 0:
11082 print "%d errors" % gen.errors 11247 print "%d errors" % gen.errors
11083 return 1 11248 return 1
11084 return 0 11249 return 0
11085 11250
11086 11251
11087 if __name__ == '__main__': 11252 if __name__ == '__main__':
11088 sys.exit(main(sys.argv[1:])) 11253 sys.exit(main(sys.argv[1:]))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698