| 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 6685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6696 last_arg = func.GetLastOriginalArg() | 6696 last_arg = func.GetLastOriginalArg() |
| 6697 # All except shm_id and shm_offset. | 6697 # All except shm_id and shm_offset. |
| 6698 all_but_last_args = func.GetCmdArgs()[:-2] | 6698 all_but_last_args = func.GetCmdArgs()[:-2] |
| 6699 for arg in all_but_last_args: | 6699 for arg in all_but_last_args: |
| 6700 arg.WriteGetCode(f) | 6700 arg.WriteGetCode(f) |
| 6701 | 6701 |
| 6702 code = """ unsigned int buffer_size = 0; | 6702 code = """ unsigned int buffer_size = 0; |
| 6703 typedef cmds::%(func_name)s::Result Result; | 6703 typedef cmds::%(func_name)s::Result Result; |
| 6704 Result* result = GetSharedMemoryAndSizeAs<Result*>( | 6704 Result* result = GetSharedMemoryAndSizeAs<Result*>( |
| 6705 c.%(last_arg_name)s_shm_id, c.%(last_arg_name)s_shm_offset, | 6705 c.%(last_arg_name)s_shm_id, c.%(last_arg_name)s_shm_offset, |
| 6706 &buffer_size); | 6706 sizeof(Result), &buffer_size); |
| 6707 %(last_arg_type)s %(last_arg_name)s = result ? result->GetData() : NULL; | 6707 %(last_arg_type)s %(last_arg_name)s = result ? result->GetData() : NULL; |
| 6708 if (%(last_arg_name)s == NULL) { | 6708 if (%(last_arg_name)s == NULL) { |
| 6709 return error::kOutOfBounds; | 6709 return error::kOutOfBounds; |
| 6710 } | 6710 } |
| 6711 GLsizei bufsize = Result::ComputeMaxResults(buffer_size); | 6711 GLsizei bufsize = Result::ComputeMaxResults(buffer_size); |
| 6712 GLsizei written_values = 0; | 6712 GLsizei written_values = 0; |
| 6713 GLsizei* length = &written_values; | 6713 GLsizei* length = &written_values; |
| 6714 """ | 6714 """ |
| 6715 f.write(code % { | 6715 f.write(code % { |
| 6716 'last_arg_type': last_arg.type, | 6716 'last_arg_type': last_arg.type, |
| (...skipping 4532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11249 Format(gen.generated_cpp_filenames) | 11249 Format(gen.generated_cpp_filenames) |
| 11250 | 11250 |
| 11251 if gen.errors > 0: | 11251 if gen.errors > 0: |
| 11252 print "%d errors" % gen.errors | 11252 print "%d errors" % gen.errors |
| 11253 return 1 | 11253 return 1 |
| 11254 return 0 | 11254 return 0 |
| 11255 | 11255 |
| 11256 | 11256 |
| 11257 if __name__ == '__main__': | 11257 if __name__ == '__main__': |
| 11258 sys.exit(main(sys.argv[1:])) | 11258 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |