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

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

Issue 1859703002: convert //gpu to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on master Created 4 years, 8 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
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 6143 matching lines...) Expand 10 before | Expand all | Expand 10 after
6154 (func.name, func.GetLastOriginalArg().name)) 6154 (func.name, func.GetLastOriginalArg().name))
6155 6155
6156 def WriteImmediateHandlerImplementation(self, func, f): 6156 def WriteImmediateHandlerImplementation(self, func, f):
6157 """Overrriden from TypeHandler.""" 6157 """Overrriden from TypeHandler."""
6158 if func.IsUnsafe() and not func.UseHelper(): 6158 if func.IsUnsafe() and not func.UseHelper():
6159 f.write(""" for (GLsizei ii = 0; ii < n; ++ii) { 6159 f.write(""" for (GLsizei ii = 0; ii < n; ++ii) {
6160 if (group_->Get%(resource_name)sServiceId(%(last_arg_name)s[ii], NULL)) { 6160 if (group_->Get%(resource_name)sServiceId(%(last_arg_name)s[ii], NULL)) {
6161 return error::kInvalidArguments; 6161 return error::kInvalidArguments;
6162 } 6162 }
6163 } 6163 }
6164 scoped_ptr<GLuint[]> service_ids(new GLuint[n]); 6164 std::unique_ptr<GLuint[]> service_ids(new GLuint[n]);
6165 gl%(func_name)s(n, service_ids.get()); 6165 gl%(func_name)s(n, service_ids.get());
6166 for (GLsizei ii = 0; ii < n; ++ii) { 6166 for (GLsizei ii = 0; ii < n; ++ii) {
6167 group_->Add%(resource_name)sId(%(last_arg_name)s[ii], service_ids[ii]); 6167 group_->Add%(resource_name)sId(%(last_arg_name)s[ii], service_ids[ii]);
6168 } 6168 }
6169 """ % { 'func_name': func.original_name, 6169 """ % { 'func_name': func.original_name,
6170 'last_arg_name': func.GetLastOriginalArg().name, 6170 'last_arg_name': func.GetLastOriginalArg().name,
6171 'resource_name': func.GetInfo('resource_type') }) 6171 'resource_name': func.GetInfo('resource_type') })
6172 else: 6172 else:
6173 f.write(" if (!%sHelper(n, %s)) {\n" 6173 f.write(" if (!%sHelper(n, %s)) {\n"
6174 " return error::kInvalidArguments;\n" 6174 " return error::kInvalidArguments;\n"
(...skipping 4754 matching lines...) Expand 10 before | Expand all | Expand 10 after
10929 with CHeaderWriter(filename, comment) as f: 10929 with CHeaderWriter(filename, comment) as f:
10930 for func in self.original_functions: 10930 for func in self.original_functions:
10931 func.WriteGLES2InterfaceHeader(f) 10931 func.WriteGLES2InterfaceHeader(f)
10932 self.generated_cpp_filenames.append(filename) 10932 self.generated_cpp_filenames.append(filename)
10933 10933
10934 def WriteMojoGLES2ImplHeader(self, filename): 10934 def WriteMojoGLES2ImplHeader(self, filename):
10935 """Writes the Mojo GLES2 implementation header.""" 10935 """Writes the Mojo GLES2 implementation header."""
10936 comment = ("// This file is included by gles2_interface.h to declare the\n" 10936 comment = ("// This file is included by gles2_interface.h to declare the\n"
10937 "// GL api functions.\n") 10937 "// GL api functions.\n")
10938 code = """ 10938 code = """
10939 #include <memory>
10940
10939 #include "gpu/command_buffer/client/gles2_interface.h" 10941 #include "gpu/command_buffer/client/gles2_interface.h"
10940 #include "mojo/public/c/gles2/gles2.h" 10942 #include "mojo/public/c/gles2/gles2.h"
10941 10943
10942 namespace mojo { 10944 namespace mojo {
10943 10945
10944 class MojoGLES2Impl : public gpu::gles2::GLES2Interface { 10946 class MojoGLES2Impl : public gpu::gles2::GLES2Interface {
10945 public: 10947 public:
10946 explicit MojoGLES2Impl(MojoGLES2Context context) { 10948 explicit MojoGLES2Impl(MojoGLES2Context context) {
10947 context_ = context; 10949 context_ = context;
10948 } 10950 }
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after
11577 Format(gen.generated_cpp_filenames) 11579 Format(gen.generated_cpp_filenames)
11578 11580
11579 if gen.errors > 0: 11581 if gen.errors > 0:
11580 print "%d errors" % gen.errors 11582 print "%d errors" % gen.errors
11581 return 1 11583 return 1
11582 return 0 11584 return 0
11583 11585
11584 11586
11585 if __name__ == '__main__': 11587 if __name__ == '__main__':
11586 sys.exit(main(sys.argv[1:])) 11588 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « gpu/blink/webgraphicscontext3d_impl.h ('k') | gpu/command_buffer/client/buffer_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698