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 1694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1705 }, | 1705 }, |
1706 'CopyTexImage2D': { | 1706 'CopyTexImage2D': { |
1707 'decoder_func': 'DoCopyTexImage2D', | 1707 'decoder_func': 'DoCopyTexImage2D', |
1708 'unit_test': False, | 1708 'unit_test': False, |
1709 'defer_reads': True, | 1709 'defer_reads': True, |
1710 }, | 1710 }, |
1711 'CopyTexSubImage2D': { | 1711 'CopyTexSubImage2D': { |
1712 'decoder_func': 'DoCopyTexSubImage2D', | 1712 'decoder_func': 'DoCopyTexSubImage2D', |
1713 'defer_reads': True, | 1713 'defer_reads': True, |
1714 }, | 1714 }, |
| 1715 'CopyTexSubImage3D': { |
| 1716 'defer_reads': True, |
| 1717 'unsafe': True, |
| 1718 }, |
1715 'CreateImageCHROMIUM': { | 1719 'CreateImageCHROMIUM': { |
1716 'type': 'Manual', | 1720 'type': 'Manual', |
1717 'cmd_args': | 1721 'cmd_args': |
1718 'ClientBuffer buffer, GLsizei width, GLsizei height, ' | 1722 'ClientBuffer buffer, GLsizei width, GLsizei height, ' |
1719 'GLenum internalformat', | 1723 'GLenum internalformat', |
1720 'result': ['GLuint'], | 1724 'result': ['GLuint'], |
1721 'client_test': False, | 1725 'client_test': False, |
1722 'gen_cmd': False, | 1726 'gen_cmd': False, |
1723 'expectation': False, | 1727 'expectation': False, |
1724 'extension': True, | 1728 'extension': True, |
(...skipping 5819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7544 if func.IsImmediate(): | 7548 if func.IsImmediate(): |
7545 return 0 | 7549 return 0 |
7546 return 1 | 7550 return 1 |
7547 | 7551 |
7548 def GetInvalidArg(self, index): | 7552 def GetInvalidArg(self, index): |
7549 """overridden from Argument.""" | 7553 """overridden from Argument.""" |
7550 return ("-1", "kNoError", "GL_INVALID_VALUE") | 7554 return ("-1", "kNoError", "GL_INVALID_VALUE") |
7551 | 7555 |
7552 def WriteValidationCode(self, file, func): | 7556 def WriteValidationCode(self, file, func): |
7553 """overridden from Argument.""" | 7557 """overridden from Argument.""" |
7554 file.Write(" if (%s < 0) {\n" % self.name) | 7558 if func.IsUnsafe(): |
7555 file.Write( | 7559 return |
7556 " LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, \"gl%s\", \"%s < 0\");\n" % | 7560 code = """ if (%(var_name)s < 0) { |
7557 (func.original_name, self.name)) | 7561 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "gl%(func_name)s", "%(var_name)s < 0"); |
7558 file.Write(" return error::kNoError;\n") | 7562 return error::kNoError; |
7559 file.Write(" }\n") | 7563 } |
| 7564 """ |
| 7565 file.Write(code % { |
| 7566 "var_name": self.name, |
| 7567 "func_name": func.original_name, |
| 7568 }) |
7560 | 7569 |
7561 def WriteClientSideValidationCode(self, file, func): | 7570 def WriteClientSideValidationCode(self, file, func): |
7562 """overridden from Argument.""" | 7571 """overridden from Argument.""" |
7563 file.Write(" if (%s < 0) {\n" % self.name) | 7572 code = """ if (%(var_name)s < 0) { |
7564 file.Write( | 7573 SetGLError(GL_INVALID_VALUE, "gl%(func_name)s", "%(var_name)s < 0"); |
7565 " SetGLError(GL_INVALID_VALUE, \"gl%s\", \"%s < 0\");\n" % | 7574 return; |
7566 (func.original_name, self.name)) | 7575 } |
7567 file.Write(" return;\n") | 7576 """ |
7568 file.Write(" }\n") | 7577 file.Write(code % { |
| 7578 "var_name": self.name, |
| 7579 "func_name": func.original_name, |
| 7580 }) |
7569 | 7581 |
7570 | 7582 |
7571 class SizeNotNegativeArgument(SizeArgument): | 7583 class SizeNotNegativeArgument(SizeArgument): |
7572 """class for GLsizeiNotNegative. It's NEVER allowed to be negative""" | 7584 """class for GLsizeiNotNegative. It's NEVER allowed to be negative""" |
7573 | 7585 |
7574 def __init__(self, name, type, gl_type): | 7586 def __init__(self, name, type, gl_type): |
7575 SizeArgument.__init__(self, name, gl_type) | 7587 SizeArgument.__init__(self, name, gl_type) |
7576 | 7588 |
7577 def GetInvalidArg(self, index): | 7589 def GetInvalidArg(self, index): |
7578 """overridden from SizeArgument.""" | 7590 """overridden from SizeArgument.""" |
(...skipping 2482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10061 Format(gen.generated_cpp_filenames) | 10073 Format(gen.generated_cpp_filenames) |
10062 | 10074 |
10063 if gen.errors > 0: | 10075 if gen.errors > 0: |
10064 print "%d errors" % gen.errors | 10076 print "%d errors" % gen.errors |
10065 return 1 | 10077 return 1 |
10066 return 0 | 10078 return 0 |
10067 | 10079 |
10068 | 10080 |
10069 if __name__ == '__main__': | 10081 if __name__ == '__main__': |
10070 sys.exit(main(sys.argv[1:])) | 10082 sys.exit(main(sys.argv[1:])) |
OLD | NEW |