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

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

Issue 6062003: Added ppapi::Context3D interface. The API has already been reviewed. I am add... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | gpu/demos/framework/pepper.cc » ('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/python 1 #!/usr/bin/python
2 # 2 #
3 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """code generator for GLES2 command buffers.""" 7 """code generator for GLES2 command buffers."""
8 8
9 import os 9 import os
10 import os.path 10 import os.path
(...skipping 5244 matching lines...) Expand 10 before | Expand all | Expand 10 after
5255 file.Write("}\n\n"); 5255 file.Write("}\n\n");
5256 file.Close() 5256 file.Close()
5257 5257
5258 def WritePepperGLES2Interface(self, filename): 5258 def WritePepperGLES2Interface(self, filename):
5259 """Writes the Pepper OpenGLES interface definition.""" 5259 """Writes the Pepper OpenGLES interface definition."""
5260 file = CHeaderWriter( 5260 file = CHeaderWriter(
5261 filename, 5261 filename,
5262 "// OpenGL ES interface.\n", 5262 "// OpenGL ES interface.\n",
5263 3) 5263 3)
5264 5264
5265 file.Write("#include \"ppapi/c/pp_resource.h\"\n\n")
5266
5265 file.Write("#ifndef __gl2_h_\n") 5267 file.Write("#ifndef __gl2_h_\n")
5266 for (k, v) in _GL_TYPES.iteritems(): 5268 for (k, v) in _GL_TYPES.iteritems():
5267 file.Write("typedef %s %s;\n" % (v, k)) 5269 file.Write("typedef %s %s;\n" % (v, k))
5268 file.Write("#endif // __gl2_h_\n\n") 5270 file.Write("#endif // __gl2_h_\n\n")
5269 5271
5270 file.Write("#define PPB_OPENGLES2_DEV_INTERFACE \"PPB_OpenGLES(Dev);2.0\"\n" ) 5272 file.Write("#define PPB_OPENGLES2_DEV_INTERFACE \"PPB_OpenGLES(Dev);2.0\"\n" )
5271 5273
5272 file.Write("\nstruct PPB_OpenGLES2_Dev {\n") 5274 file.Write("\nstruct PPB_OpenGLES2_Dev {\n")
5273 for func in self.original_functions: 5275 for func in self.original_functions:
5274 if not func.IsCoreGLFunction(): 5276 if not func.IsCoreGLFunction():
(...skipping 10 matching lines...) Expand all
5285 5287
5286 file.Close() 5288 file.Close()
5287 5289
5288 def WritePepperGLES2Implementation(self, filename): 5290 def WritePepperGLES2Implementation(self, filename):
5289 """Writes the Pepper OpenGLES interface implementation.""" 5291 """Writes the Pepper OpenGLES interface implementation."""
5290 5292
5291 file = CWriter(filename) 5293 file = CWriter(filename)
5292 file.Write(_LICENSE) 5294 file.Write(_LICENSE)
5293 file.Write("// This file is auto-generated. DO NOT EDIT!\n\n") 5295 file.Write("// This file is auto-generated. DO NOT EDIT!\n\n")
5294 5296
5295 file.Write("#include \"webkit/plugins/ppapi/ppb_graphics_3d_impl.h\"\n\n") 5297 file.Write("#include \"webkit/plugins/ppapi/ppb_opengles_impl.h\"\n\n")
5296 5298
5297 file.Write("#include \"gpu/command_buffer/client/gles2_implementation.h\"") 5299 file.Write("#include \"gpu/command_buffer/client/gles2_implementation.h\"\n" )
5298 file.Write("\n#include \"ppapi/c/dev/ppb_opengles_dev.h\"\n\n") 5300 file.Write("#include \"ppapi/c/dev/ppb_opengles_dev.h\"\n")
5301 file.Write("#include \"webkit/plugins/ppapi/ppb_context_3d_impl.h\"\n\n")
5299 5302
5300 file.Write("namespace webkit {\n") 5303 file.Write("namespace webkit {\n")
5301 file.Write("namespace ppapi {\n\n") 5304 file.Write("namespace ppapi {\n\n")
5302 file.Write("namespace {\n\n") 5305 file.Write("namespace {\n\n")
5303 5306
5304 for func in self.original_functions: 5307 for func in self.original_functions:
5305 if not func.IsCoreGLFunction(): 5308 if not func.IsCoreGLFunction():
5306 continue 5309 continue
5307 5310
5308 original_arg = func.MakeTypedOriginalArgString("") 5311 original_arg = func.MakeTypedOriginalArgString("")
5309 context_arg = "PP_Resource context" 5312 context_arg = "PP_Resource context_id"
5310 if len(original_arg): 5313 if len(original_arg):
5311 arg = context_arg + ", " + original_arg 5314 arg = context_arg + ", " + original_arg
5312 else: 5315 else:
5313 arg = context_arg 5316 arg = context_arg
5314 file.Write("%s %s(%s) {\n" % (func.return_type, func.name, arg)) 5317 file.Write("%s %s(%s) {\n" % (func.return_type, func.name, arg))
5315 5318
5316 file.Write(""" scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = 5319 file.Write(""" scoped_refptr<PPB_Context3D_Impl> context =
5317 Resource::GetAs<PPB_Graphics3D_Impl>(context); 5320 Resource::GetAs<PPB_Context3D_Impl>(context_id);
5318 """) 5321 """)
5319 5322
5320 return_str = "" if func.return_type == "void" else "return " 5323 return_str = "" if func.return_type == "void" else "return "
5321 file.Write(" %sgraphics_3d->impl()->%s(%s);\n" % 5324 file.Write(" %scontext->gles2_impl()->%s(%s);\n" %
5322 (return_str, func.original_name, 5325 (return_str, func.original_name,
5323 func.MakeOriginalArgString(""))) 5326 func.MakeOriginalArgString("")))
5324 file.Write("}\n\n") 5327 file.Write("}\n\n")
5325 5328
5326 file.Write("\nconst struct PPB_OpenGLES2_Dev ppb_opengles2 = {\n") 5329 file.Write("\nconst struct PPB_OpenGLES2_Dev ppb_opengles2 = {\n")
5327 file.Write(" &") 5330 file.Write(" &")
5328 file.Write(",\n &".join( 5331 file.Write(",\n &".join(
5329 f.name for f in self.original_functions if f.IsCoreGLFunction())) 5332 f.name for f in self.original_functions if f.IsCoreGLFunction()))
5330 file.Write("\n") 5333 file.Write("\n")
5331 file.Write("};\n\n") 5334 file.Write("};\n\n")
5332 5335
5333 file.Write("} // namespace\n") 5336 file.Write("} // namespace\n")
5334 5337
5335 file.Write(""" 5338 file.Write("""
5336 const PPB_OpenGLES2_Dev* PPB_Graphics3D_Impl::GetOpenGLES2Interface() { 5339 const PPB_OpenGLES2_Dev* PPB_OpenGLES_Impl::GetInterface() {
5337 return &ppb_opengles2; 5340 return &ppb_opengles2;
5338 } 5341 }
5339 5342
5340 """) 5343 """)
5341 file.Write("} // namespace ppapi\n") 5344 file.Write("} // namespace ppapi\n")
5342 file.Write("} // namespace webkit\n\n") 5345 file.Write("} // namespace webkit\n\n")
5343 5346
5344 file.Close() 5347 file.Close()
5345 5348
5346 def WriteGLES2ToPPAPIBridge(self, filename): 5349 def WriteGLES2ToPPAPIBridge(self, filename):
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
5426 5429
5427 if options.generate_docs: 5430 if options.generate_docs:
5428 gen.WriteDocs("docs/gles2_cmd_format_docs_autogen.h") 5431 gen.WriteDocs("docs/gles2_cmd_format_docs_autogen.h")
5429 5432
5430 if gen.errors > 0: 5433 if gen.errors > 0:
5431 print "%d errors" % gen.errors 5434 print "%d errors" % gen.errors
5432 sys.exit(1) 5435 sys.exit(1)
5433 5436
5434 if __name__ == '__main__': 5437 if __name__ == '__main__':
5435 main(sys.argv[1:]) 5438 main(sys.argv[1:])
OLDNEW
« no previous file with comments | « no previous file | gpu/demos/framework/pepper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698