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