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 os | 8 import os |
9 import os.path | 9 import os.path |
10 import sys | 10 import sys |
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
724 'type': 'GLboolean', | 724 'type': 'GLboolean', |
725 'valid': [ | 725 'valid': [ |
726 'false', | 726 'false', |
727 ], | 727 ], |
728 'invalid': [ | 728 'invalid': [ |
729 'true', | 729 'true', |
730 ], | 730 ], |
731 }, | 731 }, |
732 } | 732 } |
733 | 733 |
734 # This table specifies the different pepper interfaces that are supported for | |
735 # GL commands. The first part of the tuple is the name, and the second part is | |
736 # whether it's a dev interface. | |
737 _PEPPER_INTERFACES = [ | |
738 ('', False), | |
greggman
2012/02/22 00:53:05
You can leave this as is but my preference would b
| |
739 ('InstancedArrays', True), | |
740 ('FramebufferBlit', True), | |
741 ('FramebufferMultisample', True), | |
742 ('ChromiumEnableFeature', True), | |
743 ('ChromiumMapSub', True), | |
744 ] | |
745 | |
734 # This table specifies types and other special data for the commands that | 746 # This table specifies types and other special data for the commands that |
735 # will be generated. | 747 # will be generated. |
736 # | 748 # |
737 # cmd_comment: A comment added to the cmd format. | 749 # cmd_comment: A comment added to the cmd format. |
738 # type: defines which handler will be used to generate code. | 750 # type: defines which handler will be used to generate code. |
739 # decoder_func: defines which function to call in the decoder to execute the | 751 # decoder_func: defines which function to call in the decoder to execute the |
740 # corresponding GL command. If not specified the GL command will | 752 # corresponding GL command. If not specified the GL command will |
741 # be called directly. | 753 # be called directly. |
742 # gl_test_func: GL function that is expected to be called when testing. | 754 # gl_test_func: GL function that is expected to be called when testing. |
743 # cmd_args: The arguments to use for the command. This overrides generating | 755 # cmd_args: The arguments to use for the command. This overrides generating |
(...skipping 12 matching lines...) Expand all Loading... | |
756 # needs_size: If true a data_size field is added to the command. | 768 # needs_size: If true a data_size field is added to the command. |
757 # data_type: The type of data the command uses. For PUTn or PUT types. | 769 # data_type: The type of data the command uses. For PUTn or PUT types. |
758 # count: The number of units per element. For PUTn or PUT types. | 770 # count: The number of units per element. For PUTn or PUT types. |
759 # unit_test: If False no service side unit test will be generated. | 771 # unit_test: If False no service side unit test will be generated. |
760 # client_test: If False no client side unit test will be generated. | 772 # client_test: If False no client side unit test will be generated. |
761 # expectation: If False the unit test will have no expected calls. | 773 # expectation: If False the unit test will have no expected calls. |
762 # gen_func: Name of function that generates GL resource for corresponding | 774 # gen_func: Name of function that generates GL resource for corresponding |
763 # bind function. | 775 # bind function. |
764 # valid_args: A dictionary of argument indices to args to use in unit tests | 776 # valid_args: A dictionary of argument indices to args to use in unit tests |
765 # when they can not be automatically determined. | 777 # when they can not be automatically determined. |
778 # pepper_interface: The pepper interface that is used for this extension | |
766 | 779 |
767 _FUNCTION_INFO = { | 780 _FUNCTION_INFO = { |
768 'ActiveTexture': { | 781 'ActiveTexture': { |
769 'decoder_func': 'DoActiveTexture', | 782 'decoder_func': 'DoActiveTexture', |
770 'unit_test': False, | 783 'unit_test': False, |
771 'impl_func': False, | 784 'impl_func': False, |
772 'client_test': False, | 785 'client_test': False, |
773 }, | 786 }, |
774 'AttachShader': {'decoder_func': 'DoAttachShader'}, | 787 'AttachShader': {'decoder_func': 'DoAttachShader'}, |
775 'BindAttribLocation': {'type': 'GLchar', 'bucket': True, 'needs_size': True}, | 788 'BindAttribLocation': {'type': 'GLchar', 'bucket': True, 'needs_size': True}, |
(...skipping 16 matching lines...) Expand all Loading... | |
792 }, | 805 }, |
793 'BindTexture': { | 806 'BindTexture': { |
794 'type': 'Bind', | 807 'type': 'Bind', |
795 'decoder_func': 'DoBindTexture', | 808 'decoder_func': 'DoBindTexture', |
796 'gen_func': 'GenTextures', | 809 'gen_func': 'GenTextures', |
797 }, | 810 }, |
798 'BlitFramebufferEXT': { | 811 'BlitFramebufferEXT': { |
799 'decoder_func': 'DoBlitFramebufferEXT', | 812 'decoder_func': 'DoBlitFramebufferEXT', |
800 'unit_test': False, | 813 'unit_test': False, |
801 'extension': True, | 814 'extension': True, |
815 'pepper_interface': 'FramebufferBlit', | |
802 }, | 816 }, |
803 'BufferData': { | 817 'BufferData': { |
804 'type': 'Manual', | 818 'type': 'Manual', |
805 'immediate': True, | 819 'immediate': True, |
806 'client_test': False, | 820 'client_test': False, |
807 }, | 821 }, |
808 'BufferSubData': { | 822 'BufferSubData': { |
809 'type': 'Data', | 823 'type': 'Data', |
810 'client_test': False, | 824 'client_test': False, |
811 'decoder_func': 'DoBufferSubData', | 825 'decoder_func': 'DoBufferSubData', |
(...skipping 15 matching lines...) Expand all Loading... | |
827 'ClearStencil': {'decoder_func': 'DoClearStencil'}, | 841 'ClearStencil': {'decoder_func': 'DoClearStencil'}, |
828 'EnableFeatureCHROMIUM': { | 842 'EnableFeatureCHROMIUM': { |
829 'type': 'Custom', | 843 'type': 'Custom', |
830 'immediate': False, | 844 'immediate': False, |
831 'decoder_func': 'DoEnableFeatureCHROMIUM', | 845 'decoder_func': 'DoEnableFeatureCHROMIUM', |
832 'expectation': False, | 846 'expectation': False, |
833 'cmd_args': 'GLuint bucket_id, GLint* result', | 847 'cmd_args': 'GLuint bucket_id, GLint* result', |
834 'result': ['GLint'], | 848 'result': ['GLint'], |
835 'extension': True, | 849 'extension': True, |
836 'chromium': True, | 850 'chromium': True, |
851 'pepper_interface': 'ChromiumEnableFeature', | |
837 }, | 852 }, |
838 'CompileShader': {'decoder_func': 'DoCompileShader', 'unit_test': False}, | 853 'CompileShader': {'decoder_func': 'DoCompileShader', 'unit_test': False}, |
839 'CompressedTexImage2D': { | 854 'CompressedTexImage2D': { |
840 'type': 'Manual', | 855 'type': 'Manual', |
841 'immediate': True, | 856 'immediate': True, |
842 'bucket': True, | 857 'bucket': True, |
843 }, | 858 }, |
844 'CompressedTexSubImage2D': { | 859 'CompressedTexSubImage2D': { |
845 'type': 'Data', | 860 'type': 'Data', |
846 'bucket': True, | 861 'bucket': True, |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1180 }, | 1195 }, |
1181 'LinkProgram': { | 1196 'LinkProgram': { |
1182 'decoder_func': 'DoLinkProgram', | 1197 'decoder_func': 'DoLinkProgram', |
1183 'impl_func': False, | 1198 'impl_func': False, |
1184 }, | 1199 }, |
1185 'MapBufferSubDataCHROMIUM': { | 1200 'MapBufferSubDataCHROMIUM': { |
1186 'gen_cmd': False, | 1201 'gen_cmd': False, |
1187 'extension': True, | 1202 'extension': True, |
1188 'chromium': True, | 1203 'chromium': True, |
1189 'client_test': False, | 1204 'client_test': False, |
1205 'pepper_interface': 'ChromiumMapSub', | |
1190 }, | 1206 }, |
1191 'MapTexSubImage2DCHROMIUM': { | 1207 'MapTexSubImage2DCHROMIUM': { |
1192 'gen_cmd': False, | 1208 'gen_cmd': False, |
1193 'extension': True, | 1209 'extension': True, |
1194 'chromium': True, | 1210 'chromium': True, |
1195 'client_test': False, | 1211 'client_test': False, |
1212 'pepper_interface': 'ChromiumMapSub', | |
1196 }, | 1213 }, |
1197 'PixelStorei': {'type': 'Manual'}, | 1214 'PixelStorei': {'type': 'Manual'}, |
1198 'PostSubBufferCHROMIUM': { | 1215 'PostSubBufferCHROMIUM': { |
1199 'type': 'Custom', | 1216 'type': 'Custom', |
1200 'impl_func': False, | 1217 'impl_func': False, |
1201 'unit_test': False, | 1218 'unit_test': False, |
1202 'client_test': False, | 1219 'client_test': False, |
1203 'extension': True, | 1220 'extension': True, |
1204 'chromium': True, | 1221 'chromium': True, |
1205 }, | 1222 }, |
1206 'RenderbufferStorage': { | 1223 'RenderbufferStorage': { |
1207 'decoder_func': 'DoRenderbufferStorage', | 1224 'decoder_func': 'DoRenderbufferStorage', |
1208 'gl_test_func': 'glRenderbufferStorageEXT', | 1225 'gl_test_func': 'glRenderbufferStorageEXT', |
1209 'expectation': False, | 1226 'expectation': False, |
1210 }, | 1227 }, |
1211 'RenderbufferStorageMultisampleEXT': { | 1228 'RenderbufferStorageMultisampleEXT': { |
1212 'decoder_func': 'DoRenderbufferStorageMultisample', | 1229 'decoder_func': 'DoRenderbufferStorageMultisample', |
1213 'gl_test_func': 'glRenderbufferStorageMultisampleEXT', | 1230 'gl_test_func': 'glRenderbufferStorageMultisampleEXT', |
1214 'expectation': False, | 1231 'expectation': False, |
1215 'unit_test': False, | 1232 'unit_test': False, |
1216 'extension': True, | 1233 'extension': True, |
1234 'pepper_interface': 'FramebufferMultisample', | |
1217 }, | 1235 }, |
1218 'ReadPixels': { | 1236 'ReadPixels': { |
1219 'cmd_comment': | 1237 'cmd_comment': |
1220 '// ReadPixels has the result separated from the pixel buffer so that\n' | 1238 '// ReadPixels has the result separated from the pixel buffer so that\n' |
1221 '// it is easier to specify the result going to some specific place\n' | 1239 '// it is easier to specify the result going to some specific place\n' |
1222 '// that exactly fits the rectangle of pixels.\n', | 1240 '// that exactly fits the rectangle of pixels.\n', |
1223 'type': 'Custom', | 1241 'type': 'Custom', |
1224 'immediate': False, | 1242 'immediate': False, |
1225 'impl_func': False, | 1243 'impl_func': False, |
1226 'client_test': False, | 1244 'client_test': False, |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1382 'type': 'PUTn', | 1400 'type': 'PUTn', |
1383 'data_type': 'GLfloat', | 1401 'data_type': 'GLfloat', |
1384 'count': 16, | 1402 'count': 16, |
1385 'decoder_func': 'DoUniformMatrix4fv', | 1403 'decoder_func': 'DoUniformMatrix4fv', |
1386 }, | 1404 }, |
1387 'UnmapBufferSubDataCHROMIUM': { | 1405 'UnmapBufferSubDataCHROMIUM': { |
1388 'gen_cmd': False, | 1406 'gen_cmd': False, |
1389 'extension': True, | 1407 'extension': True, |
1390 'chromium': True, | 1408 'chromium': True, |
1391 'client_test': False, | 1409 'client_test': False, |
1392 }, | 1410 'pepper_interface': 'ChromiumMapSub', |
1411 }, | |
1393 'UnmapTexSubImage2DCHROMIUM': { | 1412 'UnmapTexSubImage2DCHROMIUM': { |
1394 'gen_cmd': False, | 1413 'gen_cmd': False, |
1395 'extension': True, | 1414 'extension': True, |
1396 'chromium': True, | 1415 'chromium': True, |
1397 'client_test': False, | 1416 'client_test': False, |
1417 'pepper_interface': 'ChromiumMapSub', | |
1398 }, | 1418 }, |
1399 'UseProgram': {'decoder_func': 'DoUseProgram', 'unit_test': False}, | 1419 'UseProgram': {'decoder_func': 'DoUseProgram', 'unit_test': False}, |
1400 'ValidateProgram': {'decoder_func': 'DoValidateProgram'}, | 1420 'ValidateProgram': {'decoder_func': 'DoValidateProgram'}, |
1401 'VertexAttrib1f': {'decoder_func': 'DoVertexAttrib1f'}, | 1421 'VertexAttrib1f': {'decoder_func': 'DoVertexAttrib1f'}, |
1402 'VertexAttrib1fv': { | 1422 'VertexAttrib1fv': { |
1403 'type': 'PUT', | 1423 'type': 'PUT', |
1404 'data_type': 'GLfloat', | 1424 'data_type': 'GLfloat', |
1405 'count': 1, | 1425 'count': 1, |
1406 'decoder_func': 'DoVertexAttrib1fv', | 1426 'decoder_func': 'DoVertexAttrib1fv', |
1407 }, | 1427 }, |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1491 'unit_test': False, | 1511 'unit_test': False, |
1492 'extension': True, | 1512 'extension': True, |
1493 'decoder_func': 'DoTexStorage2DEXT', | 1513 'decoder_func': 'DoTexStorage2DEXT', |
1494 }, | 1514 }, |
1495 'DrawArraysInstancedANGLE': { | 1515 'DrawArraysInstancedANGLE': { |
1496 'type': 'Manual', | 1516 'type': 'Manual', |
1497 'cmd_args': 'GLenumDrawMode mode, GLint first, GLsizei count, ' | 1517 'cmd_args': 'GLenumDrawMode mode, GLint first, GLsizei count, ' |
1498 'GLsizei primcount', | 1518 'GLsizei primcount', |
1499 'extension': True, | 1519 'extension': True, |
1500 'unit_test': False, | 1520 'unit_test': False, |
1521 'pepper_interface': 'InstancedArrays', | |
1501 }, | 1522 }, |
1502 'DrawElementsInstancedANGLE': { | 1523 'DrawElementsInstancedANGLE': { |
1503 'type': 'Manual', | 1524 'type': 'Manual', |
1504 'cmd_args': 'GLenumDrawMode mode, GLsizei count, ' | 1525 'cmd_args': 'GLenumDrawMode mode, GLsizei count, ' |
1505 'GLenumIndexType type, GLuint index_offset, GLsizei primcount', | 1526 'GLenumIndexType type, GLuint index_offset, GLsizei primcount', |
1506 'extension': True, | 1527 'extension': True, |
1507 'unit_test': False, | 1528 'unit_test': False, |
1508 'client_test': False, | 1529 'client_test': False, |
1530 'pepper_interface': 'InstancedArrays', | |
1509 }, | 1531 }, |
1510 'VertexAttribDivisorANGLE': { | 1532 'VertexAttribDivisorANGLE': { |
1511 'type': 'Manual', | 1533 'type': 'Manual', |
1512 'cmd_args': 'GLuint index, GLuint divisor', | 1534 'cmd_args': 'GLuint index, GLuint divisor', |
1513 'extension': True, | 1535 'extension': True, |
1514 'unit_test': False, | 1536 'unit_test': False, |
1537 'pepper_interface': 'InstancedArrays', | |
1515 }, | 1538 }, |
1516 | 1539 |
1517 } | 1540 } |
1518 | 1541 |
1519 | 1542 |
1520 def SplitWords(input_string): | 1543 def SplitWords(input_string): |
1521 """Transforms a input_string into a list of lower-case components. | 1544 """Transforms a input_string into a list of lower-case components. |
1522 | 1545 |
1523 Args: | 1546 Args: |
1524 input_string: the input string. | 1547 input_string: the input string. |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1595 not parts[ii][0] == ")" and not fptr.match(parts[ii])) | 1618 not parts[ii][0] == ")" and not fptr.match(parts[ii])) |
1596 and splitter < 80): | 1619 and splitter < 80): |
1597 return splitter | 1620 return splitter |
1598 splitter += len(parts[ii]) + 1 | 1621 splitter += len(parts[ii]) + 1 |
1599 done = False | 1622 done = False |
1600 end = len(string) | 1623 end = len(string) |
1601 last_splitter = -1 | 1624 last_splitter = -1 |
1602 while not done: | 1625 while not done: |
1603 splitter = string[0:end].rfind(',') | 1626 splitter = string[0:end].rfind(',') |
1604 if splitter < 0 or (splitter > 0 and string[splitter - 1] == '"'): | 1627 if splitter < 0 or (splitter > 0 and string[splitter - 1] == '"'): |
1628 if last_splitter == -1: | |
1629 break | |
1630 return last_splitter | |
1631 elif splitter >= 80: | |
1632 end = splitter | |
1633 else: | |
1634 return splitter | |
1635 end = len(string) | |
1636 last_splitter = -1 | |
1637 while not done: | |
1638 splitter = string[0:end].rfind(' ') | |
1639 if splitter < 0 or (splitter > 0 and string[splitter - 1] == '"'): | |
1605 return last_splitter | 1640 return last_splitter |
1606 elif splitter >= 80: | 1641 elif splitter >= 80: |
1607 end = splitter | 1642 end = splitter |
1608 else: | 1643 else: |
1609 return splitter | 1644 return splitter |
1610 | 1645 |
1611 def __WriteLine(self, line, ends_with_eol): | 1646 def __WriteLine(self, line, ends_with_eol): |
1612 """Given a signle line, writes it to a file, splitting if it's > 80 chars""" | 1647 """Given a signle line, writes it to a file, splitting if it's > 80 chars""" |
1613 if len(line) >= 80: | 1648 if len(line) >= 80: |
1614 i = self.__FindSplit(line) | 1649 i = self.__FindSplit(line) |
1615 if i > 0: | 1650 if i > 0: |
1616 line1 = line[0:i + 1] | 1651 line1 = line[0:i + 1] |
1652 if line1[-1] == ' ': | |
1653 line1 = line1[:-1] | |
1654 lineend = '' | |
1655 if line1[0] == '#': | |
1656 lineend = ' \\' | |
1617 nolint = '' | 1657 nolint = '' |
1618 if len(line1) > 80: | 1658 if len(line1) > 80: |
1619 nolint = ' // NOLINT' | 1659 nolint = ' // NOLINT' |
1620 self.__AddLine(line1 + nolint + '\n') | 1660 self.__AddLine(line1 + nolint + lineend + '\n') |
1621 match = re.match("( +)", line1) | 1661 match = re.match("( +)", line1) |
1622 indent = "" | 1662 indent = "" |
1623 if match: | 1663 if match: |
1624 indent = match.group(1) | 1664 indent = match.group(1) |
1625 splitter = line[i] | 1665 splitter = line[i] |
1626 if not splitter == ',': | 1666 if not splitter == ',': |
1627 indent = " " + indent | 1667 indent = " " + indent |
1628 self.__WriteLine(indent + line[i + 1:].lstrip(), True) | 1668 self.__WriteLine(indent + line[i + 1:].lstrip(), True) |
1629 return | 1669 return |
1630 nolint = '' | 1670 nolint = '' |
(...skipping 3302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4933 return valid_args[str(index)] | 4973 return valid_args[str(index)] |
4934 return None | 4974 return None |
4935 | 4975 |
4936 def AddInfo(self, name, value): | 4976 def AddInfo(self, name, value): |
4937 """Adds an info.""" | 4977 """Adds an info.""" |
4938 setattr(self.info, name, value) | 4978 setattr(self.info, name, value) |
4939 | 4979 |
4940 def IsCoreGLFunction(self): | 4980 def IsCoreGLFunction(self): |
4941 return not self.GetInfo('extension') | 4981 return not self.GetInfo('extension') |
4942 | 4982 |
4983 def InPepperInterface(self, interface): | |
4984 ext = self.GetInfo('pepper_interface') | |
4985 if not interface.GetName(): | |
4986 return self.IsCoreGLFunction() | |
4987 return ext == interface.GetName() | |
4988 | |
4989 def InAnyPepperExtension(self): | |
4990 return self.IsCoreGLFunction() or self.GetInfo('pepper_interface') | |
4991 | |
4943 def GetGLFunctionName(self): | 4992 def GetGLFunctionName(self): |
4944 """Gets the function to call to execute GL for this command.""" | 4993 """Gets the function to call to execute GL for this command.""" |
4945 if self.GetInfo('decoder_func'): | 4994 if self.GetInfo('decoder_func'): |
4946 return self.GetInfo('decoder_func') | 4995 return self.GetInfo('decoder_func') |
4947 return "gl%s" % self.original_name | 4996 return "gl%s" % self.original_name |
4948 | 4997 |
4949 def GetGLTestFunctionName(self): | 4998 def GetGLTestFunctionName(self): |
4950 gl_func_name = self.GetInfo('gl_test_func') | 4999 gl_func_name = self.GetInfo('gl_test_func') |
4951 if gl_func_name == None: | 5000 if gl_func_name == None: |
4952 gl_func_name = self.GetGLFunctionName() | 5001 gl_func_name = self.GetGLFunctionName() |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5121 """Writes the GLES2 Implemention unit test.""" | 5170 """Writes the GLES2 Implemention unit test.""" |
5122 self.type_handler.WriteGLES2ImplementationUnitTest(self, file) | 5171 self.type_handler.WriteGLES2ImplementationUnitTest(self, file) |
5123 | 5172 |
5124 def WriteDestinationInitalizationValidation(self, file): | 5173 def WriteDestinationInitalizationValidation(self, file): |
5125 """Writes the client side destintion initialization validation.""" | 5174 """Writes the client side destintion initialization validation.""" |
5126 self.type_handler.WriteDestinationInitalizationValidation(self, file) | 5175 self.type_handler.WriteDestinationInitalizationValidation(self, file) |
5127 | 5176 |
5128 def WriteFormatTest(self, file): | 5177 def WriteFormatTest(self, file): |
5129 """Writes the cmd's format test.""" | 5178 """Writes the cmd's format test.""" |
5130 self.type_handler.WriteFormatTest(self, file) | 5179 self.type_handler.WriteFormatTest(self, file) |
5131 | 5180 |
greggman
2012/02/22 00:53:05
style: 2 blank lines between top level definitions
| |
5181 class PepperInterface(object): | |
5182 """A class that represents a function.""" | |
5183 | |
5184 def __init__(self, (name, dev)): | |
5185 self.name = name | |
5186 self.dev = dev | |
5187 | |
5188 def GetName(self): | |
5189 return self.name | |
5190 | |
5191 def GetInterfaceName(self): | |
5192 upperint = "" | |
5193 dev = "" | |
5194 if self.name: | |
5195 upperint = "_" + self.name.upper() | |
5196 if self.dev: | |
5197 dev = "_DEV" | |
5198 return "PPB_OPENGLES2%s%s_INTERFACE" % (upperint, dev) | |
5199 | |
5200 def GetInterfaceString(self): | |
5201 dev = "" | |
5202 if self.dev: | |
5203 dev = "(Dev)" | |
5204 return "PPB_OpenGLES2%s%s" % (self.name, dev) | |
5205 | |
5206 def GetStructName(self): | |
5207 dev = "" | |
5208 if self.dev: | |
5209 dev = "_Dev" | |
5210 return "PPB_OpenGLES2%s%s" % (self.name, dev) | |
5132 | 5211 |
greggman
2012/02/22 00:53:05
style: 2 blank lines between top level definitions
| |
5133 class ImmediateFunction(Function): | 5212 class ImmediateFunction(Function): |
5134 """A class that represnets an immediate function command.""" | 5213 """A class that represnets an immediate function command.""" |
5135 | 5214 |
5136 def __init__(self, func): | 5215 def __init__(self, func): |
5137 new_args = [] | 5216 new_args = [] |
5138 for arg in func.GetOriginalArgs(): | 5217 for arg in func.GetOriginalArgs(): |
5139 new_arg = arg.GetImmediateVersion() | 5218 new_arg = arg.GetImmediateVersion() |
5140 if new_arg: | 5219 if new_arg: |
5141 new_args.append(new_arg) | 5220 new_args.append(new_arg) |
5142 | 5221 |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5321 _function_re = re.compile(r'GL_APICALL(.*?)GL_APIENTRY (.*?) \((.*?)\);') | 5400 _function_re = re.compile(r'GL_APICALL(.*?)GL_APIENTRY (.*?) \((.*?)\);') |
5322 | 5401 |
5323 def __init__(self, verbose): | 5402 def __init__(self, verbose): |
5324 self.original_functions = [] | 5403 self.original_functions = [] |
5325 self.functions = [] | 5404 self.functions = [] |
5326 self.verbose = verbose | 5405 self.verbose = verbose |
5327 self.errors = 0 | 5406 self.errors = 0 |
5328 self._function_info = {} | 5407 self._function_info = {} |
5329 self._empty_type_handler = TypeHandler() | 5408 self._empty_type_handler = TypeHandler() |
5330 self._empty_function_info = FunctionInfo({}, self._empty_type_handler) | 5409 self._empty_function_info = FunctionInfo({}, self._empty_type_handler) |
5410 self.pepper_interfaces = [] | |
5411 self.interface_info = {} | |
5331 | 5412 |
5332 self._type_handlers = { | 5413 self._type_handlers = { |
5333 'Bind': BindHandler(), | 5414 'Bind': BindHandler(), |
5334 'Create': CreateHandler(), | 5415 'Create': CreateHandler(), |
5335 'Custom': CustomHandler(), | 5416 'Custom': CustomHandler(), |
5336 'Data': DataHandler(), | 5417 'Data': DataHandler(), |
5337 'Delete': DeleteHandler(), | 5418 'Delete': DeleteHandler(), |
5338 'DELn': DELnHandler(), | 5419 'DELn': DELnHandler(), |
5339 'GENn': GENnHandler(), | 5420 'GENn': GENnHandler(), |
5340 'GETn': GETnHandler(), | 5421 'GETn': GETnHandler(), |
5341 'GLchar': GLcharHandler(), | 5422 'GLchar': GLcharHandler(), |
5342 'HandWritten': HandWrittenHandler(), | 5423 'HandWritten': HandWrittenHandler(), |
5343 'Is': IsHandler(), | 5424 'Is': IsHandler(), |
5344 'Manual': ManualHandler(), | 5425 'Manual': ManualHandler(), |
5345 'PUT': PUTHandler(), | 5426 'PUT': PUTHandler(), |
5346 'PUTn': PUTnHandler(), | 5427 'PUTn': PUTnHandler(), |
5347 'PUTXn': PUTXnHandler(), | 5428 'PUTXn': PUTXnHandler(), |
5348 'STRn': STRnHandler(), | 5429 'STRn': STRnHandler(), |
5349 'Todo': TodoHandler(), | 5430 'Todo': TodoHandler(), |
5350 } | 5431 } |
5351 | 5432 |
5352 for func_name in _FUNCTION_INFO: | 5433 for func_name in _FUNCTION_INFO: |
5353 info = _FUNCTION_INFO[func_name] | 5434 info = _FUNCTION_INFO[func_name] |
5354 type = '' | 5435 type = '' |
5355 if 'type' in info: | 5436 if 'type' in info: |
5356 type = info['type'] | 5437 type = info['type'] |
5357 self._function_info[func_name] = FunctionInfo(info, | 5438 self._function_info[func_name] = FunctionInfo(info, |
5358 self.GetTypeHandler(type)) | 5439 self.GetTypeHandler(type)) |
5440 for interface in _PEPPER_INTERFACES: | |
5441 interface = PepperInterface(interface) | |
5442 self.pepper_interfaces.append(interface) | |
5443 self.interface_info[interface.GetName()] = interface | |
5359 | 5444 |
5360 def AddFunction(self, func): | 5445 def AddFunction(self, func): |
5361 """Adds a function.""" | 5446 """Adds a function.""" |
5362 self.functions.append(func) | 5447 self.functions.append(func) |
5363 | 5448 |
5364 def GetTypeHandler(self, name): | 5449 def GetTypeHandler(self, name): |
5365 """Gets a type info for the given type.""" | 5450 """Gets a type info for the given type.""" |
5366 if name in self._type_handlers: | 5451 if name in self._type_handlers: |
5367 return self._type_handlers[name] | 5452 return self._type_handlers[name] |
5368 return self._empty_type_handler | 5453 return self._empty_type_handler |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5711 | 5796 |
5712 """) | 5797 """) |
5713 else: | 5798 else: |
5714 file.Write(""" return GLES2Util::GetQualifiedEnumString( | 5799 file.Write(""" return GLES2Util::GetQualifiedEnumString( |
5715 NULL, 0, value); | 5800 NULL, 0, value); |
5716 } | 5801 } |
5717 | 5802 |
5718 """) | 5803 """) |
5719 file.Close() | 5804 file.Close() |
5720 | 5805 |
5721 def WritePepperGLES2Interface(self, filename): | 5806 def WritePepperGLES2Interface(self, filename, dev): |
5722 """Writes the Pepper OpenGLES interface definition.""" | 5807 """Writes the Pepper OpenGLES interface definition.""" |
5723 file = CHeaderWriter( | 5808 file = CHeaderWriter( |
5724 filename, | 5809 filename, |
5725 "// OpenGL ES interface.\n", | 5810 "// OpenGL ES interface.\n", |
5726 3) | 5811 2) |
5727 | 5812 |
5728 file.Write("#include \"ppapi/c/pp_resource.h\"\n\n") | 5813 file.Write("#include \"ppapi/c/pp_resource.h\"\n") |
5814 if dev: | |
5815 file.Write("#include \"ppapi/c/ppb_opengles2.h\"\n\n") | |
5816 else: | |
5817 file.Write("\n#ifndef __gl2_h_\n") | |
5818 for (k, v) in _GL_TYPES.iteritems(): | |
5819 file.Write("typedef %s %s;\n" % (v, k)) | |
5820 file.Write("#endif // __gl2_h_\n\n") | |
5729 | 5821 |
5730 file.Write("#ifndef __gl2_h_\n") | 5822 for interface in self.pepper_interfaces: |
5731 for (k, v) in _GL_TYPES.iteritems(): | 5823 if interface.dev != dev: |
5732 file.Write("typedef %s %s;\n" % (v, k)) | 5824 continue |
5733 file.Write("#endif // __gl2_h_\n\n") | 5825 file.Write("#define %s_1_0 \"%s;1.0\"\n" % |
5826 (interface.GetInterfaceName(), interface.GetInterfaceString())) | |
5827 file.Write("#define %s %s_1_0\n" % | |
5828 (interface.GetInterfaceName(), interface.GetInterfaceName())) | |
5734 | 5829 |
5735 file.Write("#define PPB_OPENGLES2_INTERFACE_1_0 \"PPB_OpenGLES2;1.0\"\n") | 5830 file.Write("\nstruct %s {\n" % interface.GetStructName()) |
5736 file.Write("#define PPB_OPENGLES2_INTERFACE PPB_OPENGLES2_INTERFACE_1_0\n") | 5831 for func in self.original_functions: |
5832 if not func.InPepperInterface(interface): | |
5833 continue | |
5737 | 5834 |
5738 file.Write("\nstruct PPB_OpenGLES2 {\n") | 5835 original_arg = func.MakeTypedOriginalArgString("") |
5739 for func in self.original_functions: | 5836 context_arg = "PP_Resource context" |
5740 if not func.IsCoreGLFunction(): | 5837 if len(original_arg): |
5741 continue | 5838 arg = context_arg + ", " + original_arg |
5839 else: | |
5840 arg = context_arg | |
5841 file.Write(" %s (*%s)(%s);\n" % (func.return_type, func.name, arg)) | |
5842 file.Write("};\n\n") | |
5742 | 5843 |
5743 original_arg = func.MakeTypedOriginalArgString("") | |
5744 context_arg = "PP_Resource context" | |
5745 if len(original_arg): | |
5746 arg = context_arg + ", " + original_arg | |
5747 else: | |
5748 arg = context_arg | |
5749 file.Write(" %s (*%s)(%s);\n" % (func.return_type, func.name, arg)) | |
5750 file.Write("};\n\n") | |
5751 | 5844 |
5752 file.Close() | 5845 file.Close() |
5753 | 5846 |
5754 def WritePepperGLES2Implementation(self, filename): | 5847 def WritePepperGLES2Implementation(self, filename): |
5755 """Writes the Pepper OpenGLES interface implementation.""" | 5848 """Writes the Pepper OpenGLES interface implementation.""" |
5756 | 5849 |
5757 file = CWriter(filename) | 5850 file = CWriter(filename) |
5758 file.Write(_LICENSE) | 5851 file.Write(_LICENSE) |
5759 file.Write(_DO_NOT_EDIT_WARNING) | 5852 file.Write(_DO_NOT_EDIT_WARNING) |
5760 | 5853 |
5761 file.Write("#include \"ppapi/shared_impl/ppb_opengles2_shared.h\"\n\n") | 5854 file.Write("#include \"ppapi/shared_impl/ppb_opengles2_shared.h\"\n\n") |
5762 file.Write("#include \"base/logging.h\"\n") | 5855 file.Write("#include \"base/logging.h\"\n") |
5763 file.Write("#include \"gpu/command_buffer/client/gles2_implementation.h\"\n" ) | 5856 file.Write("#include \"gpu/command_buffer/client/gles2_implementation.h\"\n" ) |
5764 file.Write("#include \"ppapi/shared_impl/ppb_graphics_3d_shared.h\"\n") | 5857 file.Write("#include \"ppapi/shared_impl/ppb_graphics_3d_shared.h\"\n") |
5765 file.Write("#include \"ppapi/thunk/enter.h\"\n\n") | 5858 file.Write("#include \"ppapi/thunk/enter.h\"\n\n") |
5766 | 5859 |
5767 file.Write("namespace ppapi {\n\n") | 5860 file.Write("namespace ppapi {\n\n") |
5768 file.Write("namespace {\n\n") | 5861 file.Write("namespace {\n\n") |
5769 | 5862 |
5770 file.Write("gpu::gles2::GLES2Implementation*" | 5863 file.Write("gpu::gles2::GLES2Implementation*" |
5771 " GetGLES(PP_Resource context) {\n") | 5864 " GetGLES(PP_Resource context) {\n") |
5772 file.Write(" thunk::EnterResource<thunk::PPB_Graphics3D_API>" | 5865 file.Write(" thunk::EnterResource<thunk::PPB_Graphics3D_API>" |
5773 " enter_g3d(context, false);\n") | 5866 " enter_g3d(context, false);\n") |
5774 file.Write(" DCHECK(enter_g3d.succeeded());\n") | 5867 file.Write(" DCHECK(enter_g3d.succeeded());\n") |
5775 file.Write(" return static_cast<PPB_Graphics3D_Shared*>" | 5868 file.Write(" return static_cast<PPB_Graphics3D_Shared*>" |
5776 "(enter_g3d.object())->gles2_impl();\n") | 5869 "(enter_g3d.object())->gles2_impl();\n") |
5777 file.Write("}\n\n") | 5870 file.Write("}\n\n") |
5778 | 5871 |
5779 for func in self.original_functions: | 5872 for func in self.original_functions: |
5780 if not func.IsCoreGLFunction(): | 5873 if not func.InAnyPepperExtension(): |
5781 continue | 5874 continue |
5782 | 5875 |
5783 original_arg = func.MakeTypedOriginalArgString("") | 5876 original_arg = func.MakeTypedOriginalArgString("") |
5784 context_arg = "PP_Resource context_id" | 5877 context_arg = "PP_Resource context_id" |
5785 if len(original_arg): | 5878 if len(original_arg): |
5786 arg = context_arg + ", " + original_arg | 5879 arg = context_arg + ", " + original_arg |
5787 else: | 5880 else: |
5788 arg = context_arg | 5881 arg = context_arg |
5789 file.Write("%s %s(%s) {\n" % (func.return_type, func.name, arg)) | 5882 file.Write("%s %s(%s) {\n" % (func.return_type, func.name, arg)) |
5790 | 5883 |
5791 return_str = "" if func.return_type == "void" else "return " | 5884 return_str = "" if func.return_type == "void" else "return " |
5792 file.Write(" %sGetGLES(context_id)->%s(%s);\n" % | 5885 file.Write(" %sGetGLES(context_id)->%s(%s);\n" % |
5793 (return_str, func.original_name, | 5886 (return_str, func.original_name, |
5794 func.MakeOriginalArgString(""))) | 5887 func.MakeOriginalArgString(""))) |
5795 file.Write("}\n\n") | 5888 file.Write("}\n\n") |
5796 | 5889 |
5797 file.Write("\nconst struct PPB_OpenGLES2 ppb_opengles2 = {\n") | |
5798 file.Write(" &") | |
5799 file.Write(",\n &".join( | |
5800 f.name for f in self.original_functions if f.IsCoreGLFunction())) | |
5801 file.Write("\n") | |
5802 file.Write("};\n\n") | |
5803 | |
5804 file.Write("} // namespace\n") | 5890 file.Write("} // namespace\n") |
5805 | 5891 |
5806 file.Write(""" | 5892 for interface in self.pepper_interfaces: |
5807 const PPB_OpenGLES2* PPB_OpenGLES2_Shared::GetInterface() { | 5893 file.Write("const %s* PPB_OpenGLES2_Shared::Get%sInterface() {\n" % |
5808 return &ppb_opengles2; | 5894 (interface.GetStructName(), interface.GetName())) |
5809 } | 5895 file.Write(" static const struct %s " |
5896 "ppb_opengles2 = {\n" % interface.GetStructName()) | |
5897 file.Write(" &") | |
5898 file.Write(",\n &".join( | |
5899 f.name for f in self.original_functions | |
5900 if f.InPepperInterface(interface))) | |
5901 file.Write("\n") | |
5810 | 5902 |
5811 """) | 5903 file.Write(" };\n") |
5904 file.Write(" return &ppb_opengles2;\n") | |
5905 file.Write("}\n") | |
5906 | |
5812 file.Write("} // namespace ppapi\n") | 5907 file.Write("} // namespace ppapi\n") |
5813 file.Close() | 5908 file.Close() |
5814 | 5909 |
5815 def WriteGLES2ToPPAPIBridge(self, filename): | 5910 def WriteGLES2ToPPAPIBridge(self, filename): |
5816 """Connects GLES2 helper library to PPB_OpenGLES2 interface""" | 5911 """Connects GLES2 helper library to PPB_OpenGLES2 interface""" |
5817 | 5912 |
5818 file = CWriter(filename) | 5913 file = CWriter(filename) |
5819 file.Write(_LICENSE) | 5914 file.Write(_LICENSE) |
5820 file.Write(_DO_NOT_EDIT_WARNING) | 5915 file.Write(_DO_NOT_EDIT_WARNING) |
5821 | 5916 |
5822 file.Write("#include <GLES2/gl2.h>\n") | 5917 file.Write("#include <GLES2/gl2.h>\n") |
5823 file.Write("#include \"ppapi/lib/gl/gles2/gl2ext_ppapi.h\"\n\n") | 5918 file.Write("#include \"ppapi/lib/gl/gles2/gl2ext_ppapi.h\"\n\n") |
5824 | 5919 |
5825 for func in self.original_functions: | 5920 for func in self.original_functions: |
5826 if not func.IsCoreGLFunction(): | 5921 if not func.InAnyPepperExtension(): |
5827 continue | 5922 continue |
5828 | 5923 |
5924 interface = self.interface_info[func.GetInfo('pepper_interface') or ''] | |
5925 | |
5829 file.Write("%s GL_APIENTRY gl%s(%s) {\n" % | 5926 file.Write("%s GL_APIENTRY gl%s(%s) {\n" % |
5830 (func.return_type, func.name, | 5927 (func.return_type, func.name, |
5831 func.MakeTypedOriginalArgString(""))) | 5928 func.MakeTypedOriginalArgString(""))) |
5832 return_str = "" if func.return_type == "void" else "return " | 5929 return_str = "" if func.return_type == "void" else "return " |
5833 interface_str = "glGetInterfacePPAPI()" | 5930 interface_str = "glGet%sInterfacePPAPI()" % interface.GetName() |
5834 original_arg = func.MakeOriginalArgString("") | 5931 original_arg = func.MakeOriginalArgString("") |
5835 context_arg = "glGetCurrentContextPPAPI()" | 5932 context_arg = "glGetCurrentContextPPAPI()" |
5836 if len(original_arg): | 5933 if len(original_arg): |
5837 arg = context_arg + ", " + original_arg | 5934 arg = context_arg + ", " + original_arg |
5838 else: | 5935 else: |
5839 arg = context_arg | 5936 arg = context_arg |
5840 file.Write(" %s%s->%s(%s);\n" % | 5937 if interface.GetName(): |
5841 (return_str, interface_str, func.name, arg)) | 5938 file.Write(" const struct %s* ext = %s;\n" % |
5939 (interface.GetStructName(), interface_str)) | |
5940 file.Write(" if (ext)\n") | |
5941 file.Write(" %sext->%s(%s);\n" % | |
5942 (return_str, func.name, arg)) | |
5943 if return_str: | |
5944 file.Write(" %s0;\n" % return_str) | |
5945 else: | |
5946 file.Write(" %s%s->%s(%s);\n" % | |
5947 (return_str, interface_str, func.name, arg)) | |
5842 file.Write("}\n\n") | 5948 file.Write("}\n\n") |
5949 file.Close() | |
5843 | 5950 |
5844 def WritePepperGLES2NaClProxy(self, filename): | 5951 def WritePepperGLES2NaClProxy(self, filename): |
5845 """Writes the Pepper OpenGLES interface implementation for NaCl.""" | 5952 """Writes the Pepper OpenGLES interface implementation for NaCl.""" |
5846 file = CWriter(filename) | 5953 file = CWriter(filename) |
5847 file.Write(_LICENSE) | 5954 file.Write(_LICENSE) |
5848 file.Write(_DO_NOT_EDIT_WARNING) | 5955 file.Write(_DO_NOT_EDIT_WARNING) |
5849 | 5956 |
5850 file.Write("#include \"native_client/src/shared/ppapi_proxy" | 5957 file.Write("#include \"native_client/src/shared/ppapi_proxy" |
5851 "/plugin_ppb_graphics_3d.h\"\n\n") | 5958 "/plugin_ppb_graphics_3d.h\"\n\n") |
5852 | 5959 |
5853 file.Write("#include \"gpu/command_buffer/client/gles2_implementation.h\"") | 5960 file.Write("#include \"gpu/command_buffer/client/gles2_implementation.h\"") |
5854 file.Write("\n#include \"native_client/src/third_party" | 5961 file.Write("\n#include \"ppapi/c/ppb_opengles2.h\"\n\n") |
5855 "/ppapi/c/dev/ppb_opengles_dev.h\"\n\n") | |
5856 | 5962 |
5857 file.Write("using ppapi_proxy::PluginGraphics3D;\n") | 5963 file.Write("using ppapi_proxy::PluginGraphics3D;\n") |
5858 file.Write("using ppapi_proxy::PluginResource;\n\n") | 5964 file.Write("using ppapi_proxy::PluginResource;\n\n") |
5859 file.Write("namespace {\n\n") | 5965 file.Write("namespace {\n\n") |
5860 | 5966 |
5861 for func in self.original_functions: | 5967 for func in self.original_functions: |
5862 if not func.IsCoreGLFunction(): | 5968 if not func.InAnyPepperExtension(): |
5863 continue | 5969 continue |
5864 args = func.MakeTypedOriginalArgString("") | 5970 args = func.MakeTypedOriginalArgString("") |
5865 if len(args) != 0: | 5971 if len(args) != 0: |
5866 args = ", " + args | 5972 args = ", " + args |
5867 file.Write("%s %s(PP_Resource context%s) {\n" % | 5973 file.Write("%s %s(PP_Resource context%s) {\n" % |
5868 (func.return_type, func.name, args)) | 5974 (func.return_type, func.name, args)) |
5869 return_string = "return " | 5975 return_string = "return " |
5870 if func.return_type == "void": | 5976 if func.return_type == "void": |
5871 return_string = "" | 5977 return_string = "" |
5872 file.Write(" %sPluginGraphics3D::implFromResource(context)->" | 5978 file.Write(" %sPluginGraphics3D::implFromResource(context)->" |
5873 "%s(%s);\n" % | 5979 "%s(%s);\n" % |
5874 (return_string, | 5980 (return_string, |
5875 func.original_name, | 5981 func.original_name, |
5876 func.MakeOriginalArgString(""))) | 5982 func.MakeOriginalArgString(""))) |
5877 file.Write("}\n") | 5983 file.Write("}\n") |
5878 | 5984 |
5879 file.Write("\n} // namespace\n\n") | 5985 file.Write("\n} // namespace\n\n") |
5880 | 5986 |
5881 file.Write("const PPB_OpenGLES2* " | 5987 for interface in self.pepper_interfaces: |
5882 "PluginGraphics3D::GetOpenGLESInterface() {\n") | 5988 file.Write("const %s* " |
5989 "PluginGraphics3D::GetOpenGLES%sInterface() {\n" % | |
5990 (interface.GetStructName(), interface.GetName())) | |
5883 | 5991 |
5884 file.Write(" const static struct PPB_OpenGLES2 ppb_opengles = {\n") | 5992 file.Write(" const static struct %s ppb_opengles = {\n" % |
5885 file.Write(" &") | 5993 interface.GetStructName()) |
5886 file.Write(",\n &".join( | 5994 file.Write(" &") |
5887 f.name for f in self.original_functions if f.IsCoreGLFunction())) | 5995 file.Write(",\n &".join( |
5888 file.Write("\n") | 5996 f.name for f in self.original_functions |
5889 file.Write(" };\n") | 5997 if f.InPepperInterface(interface))) |
5890 file.Write(" return &ppb_opengles;\n") | 5998 file.Write("\n") |
5891 file.Write("}\n") | 5999 file.Write(" };\n") |
6000 file.Write(" return &ppb_opengles;\n") | |
6001 file.Write("}\n") | |
5892 file.Close() | 6002 file.Close() |
5893 | 6003 |
5894 | 6004 |
5895 def main(argv): | 6005 def main(argv): |
5896 """This is the main function.""" | 6006 """This is the main function.""" |
5897 parser = OptionParser() | 6007 parser = OptionParser() |
5898 parser.add_option( | 6008 parser.add_option( |
5899 "-g", "--generate-implementation-templates", action="store_true", | 6009 "-g", "--generate-implementation-templates", action="store_true", |
5900 help="generates files that are generally hand edited..") | 6010 help="generates files that are generally hand edited..") |
5901 parser.add_option( | 6011 parser.add_option( |
(...skipping 19 matching lines...) Expand all Loading... | |
5921 gen = GLGenerator(options.verbose) | 6031 gen = GLGenerator(options.verbose) |
5922 gen.ParseGLH("common/GLES2/gl2.h") | 6032 gen.ParseGLH("common/GLES2/gl2.h") |
5923 | 6033 |
5924 # Support generating files under gen/ | 6034 # Support generating files under gen/ |
5925 if options.output_dir != None: | 6035 if options.output_dir != None: |
5926 os.chdir(options.output_dir) | 6036 os.chdir(options.output_dir) |
5927 | 6037 |
5928 if options.alternate_mode == "ppapi": | 6038 if options.alternate_mode == "ppapi": |
5929 # To trigger this action, do "make ppapi_gles_bindings" | 6039 # To trigger this action, do "make ppapi_gles_bindings" |
5930 os.chdir("ppapi"); | 6040 os.chdir("ppapi"); |
5931 gen.WritePepperGLES2Interface("c/ppb_opengles2.h") | 6041 gen.WritePepperGLES2Interface("c/ppb_opengles2.h", False) |
6042 gen.WritePepperGLES2Interface("c/dev/ppb_opengles2ext_dev.h", True) | |
5932 gen.WriteGLES2ToPPAPIBridge("lib/gl/gles2/gles2.c") | 6043 gen.WriteGLES2ToPPAPIBridge("lib/gl/gles2/gles2.c") |
5933 | 6044 |
5934 elif options.alternate_mode == "chrome_ppapi": | 6045 elif options.alternate_mode == "chrome_ppapi": |
5935 # To trigger this action, do "make ppapi_gles_implementation" | 6046 # To trigger this action, do "make ppapi_gles_implementation" |
5936 gen.WritePepperGLES2Implementation( | 6047 gen.WritePepperGLES2Implementation( |
5937 "ppapi/shared_impl/ppb_opengles2_shared.cc") | 6048 "ppapi/shared_impl/ppb_opengles2_shared.cc") |
5938 | 6049 |
5939 elif options.alternate_mode == "nacl_ppapi": | 6050 elif options.alternate_mode == "nacl_ppapi": |
6051 os.chdir("ppapi") | |
5940 gen.WritePepperGLES2NaClProxy( | 6052 gen.WritePepperGLES2NaClProxy( |
5941 "native_client/src/shared/ppapi_proxy/plugin_opengles.cc") | 6053 "native_client/src/shared/ppapi_proxy/plugin_opengles.cc") |
5942 | 6054 |
5943 else: | 6055 else: |
5944 os.chdir("gpu/command_buffer") | 6056 os.chdir("gpu/command_buffer") |
5945 gen.WriteCommandIds("common/gles2_cmd_ids_autogen.h") | 6057 gen.WriteCommandIds("common/gles2_cmd_ids_autogen.h") |
5946 gen.WriteFormat("common/gles2_cmd_format_autogen.h") | 6058 gen.WriteFormat("common/gles2_cmd_format_autogen.h") |
5947 gen.WriteFormatTest("common/gles2_cmd_format_test_autogen.h") | 6059 gen.WriteFormatTest("common/gles2_cmd_format_test_autogen.h") |
5948 gen.WriteGLES2ImplementationHeader("client/gles2_implementation_autogen.h") | 6060 gen.WriteGLES2ImplementationHeader("client/gles2_implementation_autogen.h") |
5949 gen.WriteGLES2ImplementationUnitTests( | 6061 gen.WriteGLES2ImplementationUnitTests( |
5950 "client/gles2_implementation_unittest_autogen.h") | 6062 "client/gles2_implementation_unittest_autogen.h") |
5951 gen.WriteGLES2CLibImplementation("client/gles2_c_lib_autogen.h") | 6063 gen.WriteGLES2CLibImplementation("client/gles2_c_lib_autogen.h") |
5952 gen.WriteCmdHelperHeader("client/gles2_cmd_helper_autogen.h") | 6064 gen.WriteCmdHelperHeader("client/gles2_cmd_helper_autogen.h") |
5953 gen.WriteServiceImplementation("service/gles2_cmd_decoder_autogen.h") | 6065 gen.WriteServiceImplementation("service/gles2_cmd_decoder_autogen.h") |
5954 gen.WriteServiceUnitTests("service/gles2_cmd_decoder_unittest_%d_autogen.h") | 6066 gen.WriteServiceUnitTests("service/gles2_cmd_decoder_unittest_%d_autogen.h") |
5955 gen.WriteServiceUtilsHeader("service/gles2_cmd_validation_autogen.h") | 6067 gen.WriteServiceUtilsHeader("service/gles2_cmd_validation_autogen.h") |
5956 gen.WriteServiceUtilsImplementation( | 6068 gen.WriteServiceUtilsImplementation( |
5957 "service/gles2_cmd_validation_implementation_autogen.h") | 6069 "service/gles2_cmd_validation_implementation_autogen.h") |
5958 gen.WriteCommonUtilsHeader("common/gles2_cmd_utils_autogen.h") | 6070 gen.WriteCommonUtilsHeader("common/gles2_cmd_utils_autogen.h") |
5959 gen.WriteCommonUtilsImpl("common/gles2_cmd_utils_implementation_autogen.h") | 6071 gen.WriteCommonUtilsImpl("common/gles2_cmd_utils_implementation_autogen.h") |
5960 | 6072 |
5961 if gen.errors > 0: | 6073 if gen.errors > 0: |
5962 print "%d errors" % gen.errors | 6074 print "%d errors" % gen.errors |
5963 return 1 | 6075 return 1 |
5964 return 0 | 6076 return 0 |
5965 | 6077 |
5966 | 6078 |
5967 if __name__ == '__main__': | 6079 if __name__ == '__main__': |
5968 sys.exit(main(sys.argv[1:])) | 6080 sys.exit(main(sys.argv[1:])) |
OLD | NEW |