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 }, | |
1443 } | 1432 } |
1444 | 1433 |
1445 # This table specifies the different pepper interfaces that are supported for | 1434 # This table specifies the different pepper interfaces that are supported for |
1446 # GL commands. 'dev' is true if it's a dev interface. | 1435 # GL commands. 'dev' is true if it's a dev interface. |
1447 _PEPPER_INTERFACES = [ | 1436 _PEPPER_INTERFACES = [ |
1448 {'name': '', 'dev': False}, | 1437 {'name': '', 'dev': False}, |
1449 {'name': 'InstancedArrays', 'dev': False}, | 1438 {'name': 'InstancedArrays', 'dev': False}, |
1450 {'name': 'FramebufferBlit', 'dev': False}, | 1439 {'name': 'FramebufferBlit', 'dev': False}, |
1451 {'name': 'FramebufferMultisample', 'dev': False}, | 1440 {'name': 'FramebufferMultisample', 'dev': False}, |
1452 {'name': 'ChromiumEnableFeature', 'dev': False}, | 1441 {'name': 'ChromiumEnableFeature', 'dev': False}, |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1646 }, | 1635 }, |
1647 'ClearDepthf': { | 1636 'ClearDepthf': { |
1648 'type': 'StateSet', | 1637 'type': 'StateSet', |
1649 'state': 'ClearDepthf', | 1638 'state': 'ClearDepthf', |
1650 'decoder_func': 'glClearDepth', | 1639 'decoder_func': 'glClearDepth', |
1651 'gl_test_func': 'glClearDepth', | 1640 'gl_test_func': 'glClearDepth', |
1652 'valid_args': { | 1641 'valid_args': { |
1653 '0': '0.5f' | 1642 '0': '0.5f' |
1654 }, | 1643 }, |
1655 }, | 1644 }, |
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 }, | |
1664 'ColorMask': { | 1645 'ColorMask': { |
1665 'type': 'StateSet', | 1646 'type': 'StateSet', |
1666 'state': 'ColorMask', | 1647 'state': 'ColorMask', |
1667 'no_gl': True, | 1648 'no_gl': True, |
1668 'expectation': False, | 1649 'expectation': False, |
1669 }, | 1650 }, |
1670 'ConsumeTextureCHROMIUM': { | 1651 'ConsumeTextureCHROMIUM': { |
1671 'decoder_func': 'DoConsumeTextureCHROMIUM', | 1652 'decoder_func': 'DoConsumeTextureCHROMIUM', |
1672 'impl_func': False, | 1653 'impl_func': False, |
1673 'type': 'PUT', | 1654 'type': 'PUT', |
(...skipping 1247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2921 'client_test': False, | 2902 'client_test': False, |
2922 'unsafe': True, | 2903 'unsafe': True, |
2923 }, | 2904 }, |
2924 'VertexAttribPointer': { | 2905 'VertexAttribPointer': { |
2925 'type': 'Manual', | 2906 'type': 'Manual', |
2926 'cmd_args': 'GLuint indx, GLintVertexAttribSize size, ' | 2907 'cmd_args': 'GLuint indx, GLintVertexAttribSize size, ' |
2927 'GLenumVertexAttribType type, GLboolean normalized, ' | 2908 'GLenumVertexAttribType type, GLboolean normalized, ' |
2928 'GLsizei stride, GLuint offset', | 2909 'GLsizei stride, GLuint offset', |
2929 'client_test': False, | 2910 'client_test': False, |
2930 }, | 2911 }, |
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 }, | |
2939 'Scissor': { | 2912 'Scissor': { |
2940 'type': 'StateSet', | 2913 'type': 'StateSet', |
2941 'state': 'Scissor', | 2914 'state': 'Scissor', |
2942 }, | 2915 }, |
2943 'Viewport': { | 2916 'Viewport': { |
2944 'decoder_func': 'DoViewport', | 2917 'decoder_func': 'DoViewport', |
2945 }, | 2918 }, |
2946 'ResizeCHROMIUM': { | 2919 'ResizeCHROMIUM': { |
2947 'type': 'Custom', | 2920 'type': 'Custom', |
2948 'impl_func': False, | 2921 'impl_func': False, |
(...skipping 6042 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8991 file.Write("\n") | 8964 file.Write("\n") |
8992 file.Close() | 8965 file.Close() |
8993 self.generated_cpp_filenames.append(file.filename) | 8966 self.generated_cpp_filenames.append(file.filename) |
8994 | 8967 |
8995 def WriteFormat(self, filename): | 8968 def WriteFormat(self, filename): |
8996 """Writes the command buffer format""" | 8969 """Writes the command buffer format""" |
8997 file = CHeaderWriter(filename) | 8970 file = CHeaderWriter(filename) |
8998 # Forward declaration of a few enums used in constant argument | 8971 # Forward declaration of a few enums used in constant argument |
8999 # to avoid including GL header files. | 8972 # to avoid including GL header files. |
9000 enum_defines = { | 8973 enum_defines = { |
9001 'GL_SYNC_GPU_COMMANDS_COMPLETE': '0x9117', | 8974 'GL_SYNC_GPU_COMMANDS_COMPLETE': 0x9117, |
9002 'GL_SYNC_FLUSH_COMMANDS_BIT': '0x00000001', | |
9003 } | 8975 } |
9004 file.Write('\n') | 8976 file.Write('\n') |
9005 for enum in enum_defines: | 8977 for enum in enum_defines: |
9006 file.Write("#define %s %s\n" % (enum, enum_defines[enum])) | 8978 file.Write("#define %s 0x%x\n" % (enum, enum_defines[enum])) |
9007 file.Write('\n') | 8979 file.Write('\n') |
9008 for func in self.functions: | 8980 for func in self.functions: |
9009 if True: | 8981 if True: |
9010 #gen_cmd = func.GetInfo('gen_cmd') | 8982 #gen_cmd = func.GetInfo('gen_cmd') |
9011 #if gen_cmd == True or gen_cmd == None: | 8983 #if gen_cmd == True or gen_cmd == None: |
9012 func.WriteStruct(file) | 8984 func.WriteStruct(file) |
9013 file.Write("\n") | 8985 file.Write("\n") |
9014 file.Close() | 8986 file.Close() |
9015 self.generated_cpp_filenames.append(file.filename) | 8987 self.generated_cpp_filenames.append(file.filename) |
9016 | 8988 |
(...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10160 Format(gen.generated_cpp_filenames) | 10132 Format(gen.generated_cpp_filenames) |
10161 | 10133 |
10162 if gen.errors > 0: | 10134 if gen.errors > 0: |
10163 print "%d errors" % gen.errors | 10135 print "%d errors" % gen.errors |
10164 return 1 | 10136 return 1 |
10165 return 0 | 10137 return 0 |
10166 | 10138 |
10167 | 10139 |
10168 if __name__ == '__main__': | 10140 if __name__ == '__main__': |
10169 sys.exit(main(sys.argv[1:])) | 10141 sys.exit(main(sys.argv[1:])) |
OLD | NEW |