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

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

Issue 7782020: Revert 99855 - Move PPAPI graphics3d and opengles interfaces out of Dev. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 3 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 | 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) 2011 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2011 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 5735 matching lines...) Expand 10 before | Expand all | Expand 10 after
5746 "// OpenGL ES interface.\n", 5746 "// OpenGL ES interface.\n",
5747 3) 5747 3)
5748 5748
5749 file.Write("#include \"ppapi/c/pp_resource.h\"\n\n") 5749 file.Write("#include \"ppapi/c/pp_resource.h\"\n\n")
5750 5750
5751 file.Write("#ifndef __gl2_h_\n") 5751 file.Write("#ifndef __gl2_h_\n")
5752 for (k, v) in _GL_TYPES.iteritems(): 5752 for (k, v) in _GL_TYPES.iteritems():
5753 file.Write("typedef %s %s;\n" % (v, k)) 5753 file.Write("typedef %s %s;\n" % (v, k))
5754 file.Write("#endif // __gl2_h_\n\n") 5754 file.Write("#endif // __gl2_h_\n\n")
5755 5755
5756 file.Write("#define PPB_OPENGLES2_INTERFACE " 5756 file.Write("#define PPB_OPENGLES2_DEV_INTERFACE "
5757 "\"PPB_OpenGLES;2.0\"\n") 5757 "\"PPB_OpenGLES(Dev);2.0\"\n")
5758 5758
5759 file.Write("\nstruct PPB_OpenGLES2 {\n") 5759 file.Write("\nstruct PPB_OpenGLES2_Dev {\n")
5760 for func in self.original_functions: 5760 for func in self.original_functions:
5761 if not func.IsCoreGLFunction(): 5761 if not func.IsCoreGLFunction():
5762 continue 5762 continue
5763 5763
5764 original_arg = func.MakeTypedOriginalArgString("") 5764 original_arg = func.MakeTypedOriginalArgString("")
5765 context_arg = "PP_Resource context" 5765 context_arg = "PP_Resource context"
5766 if len(original_arg): 5766 if len(original_arg):
5767 arg = context_arg + ", " + original_arg 5767 arg = context_arg + ", " + original_arg
5768 else: 5768 else:
5769 arg = context_arg 5769 arg = context_arg
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
5811 else: 5811 else:
5812 arg = context_arg 5812 arg = context_arg
5813 file.Write("%s %s(%s) {\n" % (func.return_type, func.name, arg)) 5813 file.Write("%s %s(%s) {\n" % (func.return_type, func.name, arg))
5814 5814
5815 return_str = "" if func.return_type == "void" else "return " 5815 return_str = "" if func.return_type == "void" else "return "
5816 file.Write(" %sGetGLES(context_id)->%s(%s);\n" % 5816 file.Write(" %sGetGLES(context_id)->%s(%s);\n" %
5817 (return_str, func.original_name, 5817 (return_str, func.original_name,
5818 func.MakeOriginalArgString(""))) 5818 func.MakeOriginalArgString("")))
5819 file.Write("}\n\n") 5819 file.Write("}\n\n")
5820 5820
5821 file.Write("\nconst struct PPB_OpenGLES2 ppb_opengles2 = {\n") 5821 file.Write("\nconst struct PPB_OpenGLES2_Dev ppb_opengles2 = {\n")
5822 file.Write(" &") 5822 file.Write(" &")
5823 file.Write(",\n &".join( 5823 file.Write(",\n &".join(
5824 f.name for f in self.original_functions if f.IsCoreGLFunction())) 5824 f.name for f in self.original_functions if f.IsCoreGLFunction()))
5825 file.Write("\n") 5825 file.Write("\n")
5826 file.Write("};\n\n") 5826 file.Write("};\n\n")
5827 5827
5828 file.Write("} // namespace\n") 5828 file.Write("} // namespace\n")
5829 5829
5830 file.Write(""" 5830 file.Write("""
5831 const PPB_OpenGLES2* OpenGLES2Impl::GetInterface() { 5831 const PPB_OpenGLES2_Dev* OpenGLES2Impl::GetInterface() {
5832 return &ppb_opengles2; 5832 return &ppb_opengles2;
5833 } 5833 }
5834 5834
5835 """) 5835 """)
5836 file.Write("} // namespace ppapi\n") 5836 file.Write("} // namespace ppapi\n")
5837 file.Close() 5837 file.Close()
5838 5838
5839 def WriteGLES2ToPPAPIBridge(self, filename): 5839 def WriteGLES2ToPPAPIBridge(self, filename):
5840 """Connects GLES2 helper library to PPB_OpenGLES2 interface""" 5840 """Connects GLES2 helper library to PPB_OpenGLES2 interface"""
5841 5841
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
5897 return_string = "" 5897 return_string = ""
5898 file.Write(" %sPluginGraphics3D::implFromResource(context)->" 5898 file.Write(" %sPluginGraphics3D::implFromResource(context)->"
5899 "%s(%s);\n" % 5899 "%s(%s);\n" %
5900 (return_string, 5900 (return_string,
5901 func.original_name, 5901 func.original_name,
5902 func.MakeOriginalArgString(""))) 5902 func.MakeOriginalArgString("")))
5903 file.Write("}\n") 5903 file.Write("}\n")
5904 5904
5905 file.Write("\n} // namespace\n\n") 5905 file.Write("\n} // namespace\n\n")
5906 5906
5907 file.Write("const PPB_OpenGLES2* " 5907 file.Write("const PPB_OpenGLES2_Dev* "
5908 "PluginGraphics3D::GetOpenGLESInterface() {\n") 5908 "PluginGraphics3D::GetOpenGLESInterface() {\n")
5909 5909
5910 file.Write(" const static struct PPB_OpenGLES2 ppb_opengles = {\n") 5910 file.Write(" const static struct PPB_OpenGLES2_Dev ppb_opengles = {\n")
5911 file.Write(" &") 5911 file.Write(" &")
5912 file.Write(",\n &".join( 5912 file.Write(",\n &".join(
5913 f.name for f in self.original_functions if (f.IsCoreGLFunction() and 5913 f.name for f in self.original_functions if (f.IsCoreGLFunction() and
5914 not f.IsType("UnknownCommand")))) 5914 not f.IsType("UnknownCommand"))))
5915 file.Write("\n") 5915 file.Write("\n")
5916 file.Write(" };\n") 5916 file.Write(" };\n")
5917 file.Write(" return &ppb_opengles;\n") 5917 file.Write(" return &ppb_opengles;\n")
5918 file.Write("}\n") 5918 file.Write("}\n")
5919 file.Close() 5919 file.Close()
5920 5920
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
5993 5993
5994 if options.generate_docs: 5994 if options.generate_docs:
5995 gen.WriteDocs("docs/gles2_cmd_format_docs_autogen.h") 5995 gen.WriteDocs("docs/gles2_cmd_format_docs_autogen.h")
5996 5996
5997 if gen.errors > 0: 5997 if gen.errors > 0:
5998 print "%d errors" % gen.errors 5998 print "%d errors" % gen.errors
5999 sys.exit(1) 5999 sys.exit(1)
6000 6000
6001 if __name__ == '__main__': 6001 if __name__ == '__main__':
6002 main(sys.argv[1:]) 6002 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