Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(381)

Side by Side Diff: gpu/command_buffer/build_gles2_cmd_buffer.py

Issue 2764403002: Make sure buffers are large enough to hold the Result structure. (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | gpu/command_buffer/service/common_decoder.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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:]))
OLDNEW
« no previous file with comments | « no previous file | gpu/command_buffer/service/common_decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698