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