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