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

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

Issue 8849003: Rename the shared_impl resource files to give them more regular names. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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 | ppapi/ppapi_shared.gypi » ('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) 2011 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2011 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 os 8 import os
9 import os.path 9 import os.path
10 import sys 10 import sys
(...skipping 5787 matching lines...) Expand 10 before | Expand all | Expand 10 after
5798 5798
5799 file.Close() 5799 file.Close()
5800 5800
5801 def WritePepperGLES2Implementation(self, filename): 5801 def WritePepperGLES2Implementation(self, filename):
5802 """Writes the Pepper OpenGLES interface implementation.""" 5802 """Writes the Pepper OpenGLES interface implementation."""
5803 5803
5804 file = CWriter(filename) 5804 file = CWriter(filename)
5805 file.Write(_LICENSE) 5805 file.Write(_LICENSE)
5806 file.Write(_DO_NOT_EDIT_WARNING) 5806 file.Write(_DO_NOT_EDIT_WARNING)
5807 5807
5808 file.Write("#include \"ppapi/shared_impl/opengles2_impl.h\"\n\n") 5808 file.Write("#include \"ppapi/shared_impl/ppb_opengles2_shared.h\"\n\n")
5809 file.Write("#include \"base/logging.h\"\n") 5809 file.Write("#include \"base/logging.h\"\n")
5810 file.Write("#include \"gpu/command_buffer/client/gles2_implementation.h\"\n" ) 5810 file.Write("#include \"gpu/command_buffer/client/gles2_implementation.h\"\n" )
5811 file.Write("#include \"ppapi/shared_impl/graphics_3d_impl.h\"\n") 5811 file.Write("#include \"ppapi/shared_impl/ppb_graphics_3d_shared.h\"\n")
5812 file.Write("#include \"ppapi/thunk/enter.h\"\n\n") 5812 file.Write("#include \"ppapi/thunk/enter.h\"\n\n")
5813 5813
5814 file.Write("namespace ppapi {\n\n") 5814 file.Write("namespace ppapi {\n\n")
5815 file.Write("namespace {\n\n") 5815 file.Write("namespace {\n\n")
5816 5816
5817 file.Write("gpu::gles2::GLES2Implementation*" 5817 file.Write("gpu::gles2::GLES2Implementation*"
5818 " GetGLES(PP_Resource context) {\n") 5818 " GetGLES(PP_Resource context) {\n")
5819 file.Write(" thunk::EnterResource<thunk::PPB_Graphics3D_API>" 5819 file.Write(" thunk::EnterResource<thunk::PPB_Graphics3D_API>"
5820 " enter_g3d(context, false);\n") 5820 " enter_g3d(context, false);\n")
5821 file.Write(" DCHECK(enter_g3d.succeeded());\n") 5821 file.Write(" DCHECK(enter_g3d.succeeded());\n")
5822 file.Write(" return static_cast<Graphics3DImpl*>" 5822 file.Write(" return static_cast<PPB_Graphics3D_Shared*>"
5823 "(enter_g3d.object())->gles2_impl();\n") 5823 "(enter_g3d.object())->gles2_impl();\n")
5824 file.Write("}\n\n") 5824 file.Write("}\n\n")
5825 5825
5826 for func in self.original_functions: 5826 for func in self.original_functions:
5827 if not func.IsCoreGLFunction(): 5827 if not func.IsCoreGLFunction():
5828 continue 5828 continue
5829 5829
5830 original_arg = func.MakeTypedOriginalArgString("") 5830 original_arg = func.MakeTypedOriginalArgString("")
5831 context_arg = "PP_Resource context_id" 5831 context_arg = "PP_Resource context_id"
5832 if len(original_arg): 5832 if len(original_arg):
(...skipping 11 matching lines...) Expand all
5844 file.Write("\nconst struct PPB_OpenGLES2 ppb_opengles2 = {\n") 5844 file.Write("\nconst struct PPB_OpenGLES2 ppb_opengles2 = {\n")
5845 file.Write(" &") 5845 file.Write(" &")
5846 file.Write(",\n &".join( 5846 file.Write(",\n &".join(
5847 f.name for f in self.original_functions if f.IsCoreGLFunction())) 5847 f.name for f in self.original_functions if f.IsCoreGLFunction()))
5848 file.Write("\n") 5848 file.Write("\n")
5849 file.Write("};\n\n") 5849 file.Write("};\n\n")
5850 5850
5851 file.Write("} // namespace\n") 5851 file.Write("} // namespace\n")
5852 5852
5853 file.Write(""" 5853 file.Write("""
5854 const PPB_OpenGLES2* OpenGLES2Impl::GetInterface() { 5854 const PPB_OpenGLES2* PPB_OpenGLES2_Shared::GetInterface() {
5855 return &ppb_opengles2; 5855 return &ppb_opengles2;
5856 } 5856 }
5857 5857
5858 """) 5858 """)
5859 file.Write("} // namespace ppapi\n") 5859 file.Write("} // namespace ppapi\n")
5860 file.Close() 5860 file.Close()
5861 5861
5862 def WriteGLES2ToPPAPIBridge(self, filename): 5862 def WriteGLES2ToPPAPIBridge(self, filename):
5863 """Connects GLES2 helper library to PPB_OpenGLES2 interface""" 5863 """Connects GLES2 helper library to PPB_OpenGLES2 interface"""
5864 5864
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
5982 os.chdir(options.output_dir) 5982 os.chdir(options.output_dir)
5983 5983
5984 if options.alternate_mode == "ppapi": 5984 if options.alternate_mode == "ppapi":
5985 # To trigger this action, do "make ppapi_gles_bindings" 5985 # To trigger this action, do "make ppapi_gles_bindings"
5986 os.chdir("ppapi"); 5986 os.chdir("ppapi");
5987 gen.WritePepperGLES2Interface("c/ppb_opengles2.h") 5987 gen.WritePepperGLES2Interface("c/ppb_opengles2.h")
5988 gen.WriteGLES2ToPPAPIBridge("lib/gl/gles2/gles2.c") 5988 gen.WriteGLES2ToPPAPIBridge("lib/gl/gles2/gles2.c")
5989 5989
5990 elif options.alternate_mode == "chrome_ppapi": 5990 elif options.alternate_mode == "chrome_ppapi":
5991 # To trigger this action, do "make ppapi_gles_implementation" 5991 # To trigger this action, do "make ppapi_gles_implementation"
5992 gen.WritePepperGLES2Implementation("ppapi/shared_impl/opengles2_impl.cc") 5992 gen.WritePepperGLES2Implementation(
5993 "ppapi/shared_impl/ppb_opengles2_shared.cc")
5993 5994
5994 elif options.alternate_mode == "nacl_ppapi": 5995 elif options.alternate_mode == "nacl_ppapi":
5995 gen.WritePepperGLES2NaClProxy( 5996 gen.WritePepperGLES2NaClProxy(
5996 "native_client/src/shared/ppapi_proxy/plugin_opengles.cc") 5997 "native_client/src/shared/ppapi_proxy/plugin_opengles.cc")
5997 5998
5998 else: 5999 else:
5999 os.chdir("gpu/command_buffer") 6000 os.chdir("gpu/command_buffer")
6000 gen.WriteCommandIds("common/gles2_cmd_ids_autogen.h") 6001 gen.WriteCommandIds("common/gles2_cmd_ids_autogen.h")
6001 gen.WriteFormat("common/gles2_cmd_format_autogen.h") 6002 gen.WriteFormat("common/gles2_cmd_format_autogen.h")
6002 gen.WriteFormatTest("common/gles2_cmd_format_test_autogen.h") 6003 gen.WriteFormatTest("common/gles2_cmd_format_test_autogen.h")
(...skipping 15 matching lines...) Expand all
6018 gen.WriteDocs("docs/gles2_cmd_format_docs_autogen.h") 6019 gen.WriteDocs("docs/gles2_cmd_format_docs_autogen.h")
6019 6020
6020 if gen.errors > 0: 6021 if gen.errors > 0:
6021 print "%d errors" % gen.errors 6022 print "%d errors" % gen.errors
6022 return 1 6023 return 1
6023 return 0 6024 return 0
6024 6025
6025 6026
6026 if __name__ == '__main__': 6027 if __name__ == '__main__':
6027 sys.exit(main(sys.argv[1:])) 6028 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « no previous file | ppapi/ppapi_shared.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698