OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """code generator for GLES2 command buffers.""" | 6 """code generator for GLES2 command buffers.""" |
7 | 7 |
8 import itertools | 8 import itertools |
9 import os | 9 import os |
10 import os.path | 10 import os.path |
(...skipping 1411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1422 'SyncFlags': { | 1422 'SyncFlags': { |
1423 'type': 'GLbitfield', | 1423 'type': 'GLbitfield', |
1424 'is_complete': True, | 1424 'is_complete': True, |
1425 'valid': [ | 1425 'valid': [ |
1426 '0', | 1426 '0', |
1427 ], | 1427 ], |
1428 'invalid': [ | 1428 'invalid': [ |
1429 '1', | 1429 '1', |
1430 ], | 1430 ], |
1431 }, | 1431 }, |
| 1432 'SyncFlushFlags': { |
| 1433 'type': 'GLbitfield', |
| 1434 'is_complete': True, |
| 1435 'valid': [ |
| 1436 'GL_SYNC_FLUSH_COMMANDS_BIT', |
| 1437 '0', |
| 1438 ], |
| 1439 'invalid': [ |
| 1440 '0xFFFFFFFF', |
| 1441 ], |
| 1442 }, |
1432 } | 1443 } |
1433 | 1444 |
1434 # This table specifies the different pepper interfaces that are supported for | 1445 # This table specifies the different pepper interfaces that are supported for |
1435 # GL commands. 'dev' is true if it's a dev interface. | 1446 # GL commands. 'dev' is true if it's a dev interface. |
1436 _PEPPER_INTERFACES = [ | 1447 _PEPPER_INTERFACES = [ |
1437 {'name': '', 'dev': False}, | 1448 {'name': '', 'dev': False}, |
1438 {'name': 'InstancedArrays', 'dev': False}, | 1449 {'name': 'InstancedArrays', 'dev': False}, |
1439 {'name': 'FramebufferBlit', 'dev': False}, | 1450 {'name': 'FramebufferBlit', 'dev': False}, |
1440 {'name': 'FramebufferMultisample', 'dev': False}, | 1451 {'name': 'FramebufferMultisample', 'dev': False}, |
1441 {'name': 'ChromiumEnableFeature', 'dev': False}, | 1452 {'name': 'ChromiumEnableFeature', 'dev': False}, |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1635 }, | 1646 }, |
1636 'ClearDepthf': { | 1647 'ClearDepthf': { |
1637 'type': 'StateSet', | 1648 'type': 'StateSet', |
1638 'state': 'ClearDepthf', | 1649 'state': 'ClearDepthf', |
1639 'decoder_func': 'glClearDepth', | 1650 'decoder_func': 'glClearDepth', |
1640 'gl_test_func': 'glClearDepth', | 1651 'gl_test_func': 'glClearDepth', |
1641 'valid_args': { | 1652 'valid_args': { |
1642 '0': '0.5f' | 1653 '0': '0.5f' |
1643 }, | 1654 }, |
1644 }, | 1655 }, |
| 1656 'ClientWaitSync': { |
| 1657 'type': 'Custom', |
| 1658 'data_transfer_methods': ['shm'], |
| 1659 'cmd_args': 'GLuint sync, GLbitfieldSyncFlushFlags flags, ' |
| 1660 'GLuint timeout_0, GLuint timeout_1, GLenum* result', |
| 1661 'unsafe': True, |
| 1662 'result': ['GLenum'], |
| 1663 }, |
1645 'ColorMask': { | 1664 'ColorMask': { |
1646 'type': 'StateSet', | 1665 'type': 'StateSet', |
1647 'state': 'ColorMask', | 1666 'state': 'ColorMask', |
1648 'no_gl': True, | 1667 'no_gl': True, |
1649 'expectation': False, | 1668 'expectation': False, |
1650 }, | 1669 }, |
1651 'ConsumeTextureCHROMIUM': { | 1670 'ConsumeTextureCHROMIUM': { |
1652 'decoder_func': 'DoConsumeTextureCHROMIUM', | 1671 'decoder_func': 'DoConsumeTextureCHROMIUM', |
1653 'impl_func': False, | 1672 'impl_func': False, |
1654 'type': 'PUT', | 1673 'type': 'PUT', |
(...skipping 1247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2902 'client_test': False, | 2921 'client_test': False, |
2903 'unsafe': True, | 2922 'unsafe': True, |
2904 }, | 2923 }, |
2905 'VertexAttribPointer': { | 2924 'VertexAttribPointer': { |
2906 'type': 'Manual', | 2925 'type': 'Manual', |
2907 'cmd_args': 'GLuint indx, GLintVertexAttribSize size, ' | 2926 'cmd_args': 'GLuint indx, GLintVertexAttribSize size, ' |
2908 'GLenumVertexAttribType type, GLboolean normalized, ' | 2927 'GLenumVertexAttribType type, GLboolean normalized, ' |
2909 'GLsizei stride, GLuint offset', | 2928 'GLsizei stride, GLuint offset', |
2910 'client_test': False, | 2929 'client_test': False, |
2911 }, | 2930 }, |
| 2931 'WaitSync': { |
| 2932 'type': 'Custom', |
| 2933 'cmd_args': 'GLuint sync, GLbitfieldSyncFlushFlags flags, ' |
| 2934 'GLuint timeout_0, GLuint timeout_1', |
| 2935 'impl_func': False, |
| 2936 'client_test': False, |
| 2937 'unsafe': True, |
| 2938 }, |
2912 'Scissor': { | 2939 'Scissor': { |
2913 'type': 'StateSet', | 2940 'type': 'StateSet', |
2914 'state': 'Scissor', | 2941 'state': 'Scissor', |
2915 }, | 2942 }, |
2916 'Viewport': { | 2943 'Viewport': { |
2917 'decoder_func': 'DoViewport', | 2944 'decoder_func': 'DoViewport', |
2918 }, | 2945 }, |
2919 'ResizeCHROMIUM': { | 2946 'ResizeCHROMIUM': { |
2920 'type': 'Custom', | 2947 'type': 'Custom', |
2921 'impl_func': False, | 2948 'impl_func': False, |
(...skipping 6042 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8964 file.Write("\n") | 8991 file.Write("\n") |
8965 file.Close() | 8992 file.Close() |
8966 self.generated_cpp_filenames.append(file.filename) | 8993 self.generated_cpp_filenames.append(file.filename) |
8967 | 8994 |
8968 def WriteFormat(self, filename): | 8995 def WriteFormat(self, filename): |
8969 """Writes the command buffer format""" | 8996 """Writes the command buffer format""" |
8970 file = CHeaderWriter(filename) | 8997 file = CHeaderWriter(filename) |
8971 # Forward declaration of a few enums used in constant argument | 8998 # Forward declaration of a few enums used in constant argument |
8972 # to avoid including GL header files. | 8999 # to avoid including GL header files. |
8973 enum_defines = { | 9000 enum_defines = { |
8974 'GL_SYNC_GPU_COMMANDS_COMPLETE': 0x9117, | 9001 'GL_SYNC_GPU_COMMANDS_COMPLETE': '0x9117', |
| 9002 'GL_SYNC_FLUSH_COMMANDS_BIT': '0x00000001', |
8975 } | 9003 } |
8976 file.Write('\n') | 9004 file.Write('\n') |
8977 for enum in enum_defines: | 9005 for enum in enum_defines: |
8978 file.Write("#define %s 0x%x\n" % (enum, enum_defines[enum])) | 9006 file.Write("#define %s %s\n" % (enum, enum_defines[enum])) |
8979 file.Write('\n') | 9007 file.Write('\n') |
8980 for func in self.functions: | 9008 for func in self.functions: |
8981 if True: | 9009 if True: |
8982 #gen_cmd = func.GetInfo('gen_cmd') | 9010 #gen_cmd = func.GetInfo('gen_cmd') |
8983 #if gen_cmd == True or gen_cmd == None: | 9011 #if gen_cmd == True or gen_cmd == None: |
8984 func.WriteStruct(file) | 9012 func.WriteStruct(file) |
8985 file.Write("\n") | 9013 file.Write("\n") |
8986 file.Close() | 9014 file.Close() |
8987 self.generated_cpp_filenames.append(file.filename) | 9015 self.generated_cpp_filenames.append(file.filename) |
8988 | 9016 |
(...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10132 Format(gen.generated_cpp_filenames) | 10160 Format(gen.generated_cpp_filenames) |
10133 | 10161 |
10134 if gen.errors > 0: | 10162 if gen.errors > 0: |
10135 print "%d errors" % gen.errors | 10163 print "%d errors" % gen.errors |
10136 return 1 | 10164 return 1 |
10137 return 0 | 10165 return 0 |
10138 | 10166 |
10139 | 10167 |
10140 if __name__ == '__main__': | 10168 if __name__ == '__main__': |
10141 sys.exit(main(sys.argv[1:])) | 10169 sys.exit(main(sys.argv[1:])) |
OLD | NEW |