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 4392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4403 if 'range_checks' in item: | 4403 if 'range_checks' in item: |
4404 for range_check in item['range_checks']: | 4404 for range_check in item['range_checks']: |
4405 code.append("%s %s" % (args[ndx].name, range_check['check'])) | 4405 code.append("%s %s" % (args[ndx].name, range_check['check'])) |
4406 if 'nan_check' in item: | 4406 if 'nan_check' in item: |
4407 # Drivers might generate an INVALID_VALUE error when a value is set | 4407 # Drivers might generate an INVALID_VALUE error when a value is set |
4408 # to NaN. This is allowed behavior under GLES 3.0 section 2.1.1 or | 4408 # to NaN. This is allowed behavior under GLES 3.0 section 2.1.1 or |
4409 # OpenGL 4.5 section 2.3.4.1 - providing NaN allows undefined results. | 4409 # OpenGL 4.5 section 2.3.4.1 - providing NaN allows undefined results. |
4410 # Make this behavior consistent within Chromium, and avoid leaking GL | 4410 # Make this behavior consistent within Chromium, and avoid leaking GL |
4411 # errors by generating the error in the command buffer instead of | 4411 # errors by generating the error in the command buffer instead of |
4412 # letting the GL driver generate it. | 4412 # letting the GL driver generate it. |
4413 code.append("base::IsNaN(%s)" % args[ndx].name) | 4413 code.append("std::isnan(%s)" % args[ndx].name) |
4414 if len(code): | 4414 if len(code): |
4415 file.Write(" if (%s) {\n" % " ||\n ".join(code)) | 4415 file.Write(" if (%s) {\n" % " ||\n ".join(code)) |
4416 file.Write( | 4416 file.Write( |
4417 ' LOCAL_SET_GL_ERROR(GL_INVALID_VALUE,' | 4417 ' LOCAL_SET_GL_ERROR(GL_INVALID_VALUE,' |
4418 ' "%s", "%s out of range");\n' % | 4418 ' "%s", "%s out of range");\n' % |
4419 (func.name, args[ndx].name)) | 4419 (func.name, args[ndx].name)) |
4420 file.Write(" return error::kNoError;\n") | 4420 file.Write(" return error::kNoError;\n") |
4421 file.Write(" }\n") | 4421 file.Write(" }\n") |
4422 code = [] | 4422 code = [] |
4423 for ndx,item in enumerate(states): | 4423 for ndx,item in enumerate(states): |
(...skipping 6240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10664 Format(gen.generated_cpp_filenames) | 10664 Format(gen.generated_cpp_filenames) |
10665 | 10665 |
10666 if gen.errors > 0: | 10666 if gen.errors > 0: |
10667 print "%d errors" % gen.errors | 10667 print "%d errors" % gen.errors |
10668 return 1 | 10668 return 1 |
10669 return 0 | 10669 return 0 |
10670 | 10670 |
10671 | 10671 |
10672 if __name__ == '__main__': | 10672 if __name__ == '__main__': |
10673 sys.exit(main(sys.argv[1:])) | 10673 sys.exit(main(sys.argv[1:])) |
OLD | NEW |