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

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

Issue 1349233002: Mandoline: Enable more GL commands which are used by WebGL. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | mojo/gles2/gles2_impl.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/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 4854 matching lines...) Expand 10 before | Expand all | Expand 10 after
4865 """Writes the Mojo GLES2 implementation header.""" 4865 """Writes the Mojo GLES2 implementation header."""
4866 f.write("%s %s(%s) override;\n" % 4866 f.write("%s %s(%s) override;\n" %
4867 (func.return_type, func.original_name, 4867 (func.return_type, func.original_name,
4868 func.MakeTypedOriginalArgString(""))) 4868 func.MakeTypedOriginalArgString("")))
4869 4869
4870 def WriteMojoGLES2Impl(self, func, f): 4870 def WriteMojoGLES2Impl(self, func, f):
4871 """Writes the Mojo GLES2 implementation.""" 4871 """Writes the Mojo GLES2 implementation."""
4872 f.write("%s MojoGLES2Impl::%s(%s) {\n" % 4872 f.write("%s MojoGLES2Impl::%s(%s) {\n" %
4873 (func.return_type, func.original_name, 4873 (func.return_type, func.original_name,
4874 func.MakeTypedOriginalArgString(""))) 4874 func.MakeTypedOriginalArgString("")))
4875 extensions = ["CHROMIUM_sync_point", "CHROMIUM_texture_mailbox", 4875 extensions = [True, "CHROMIUM_sync_point", "CHROMIUM_texture_mailbox",
4876 "CHROMIUM_sub_image", "CHROMIUM_miscellaneous", 4876 "CHROMIUM_sub_image", "CHROMIUM_miscellaneous",
4877 "occlusion_query_EXT", "CHROMIUM_image", 4877 "occlusion_query_EXT", "CHROMIUM_image",
4878 "CHROMIUM_copy_texture", 4878 "CHROMIUM_copy_texture",
4879 "CHROMIUM_pixel_transfer_buffer_object", 4879 "CHROMIUM_pixel_transfer_buffer_object",
4880 "chromium_framebuffer_multisample"] 4880 "chromium_framebuffer_multisample"]
4881 if func.IsCoreGLFunction() or func.GetInfo("extension") in extensions: 4881
4882 is_core_gl_func = func.IsCoreGLFunction()
4883 ext = func.GetInfo("extension")
4884 is_safe = not func.IsUnsafe()
4885 if is_core_gl_func or (is_safe and ext in extensions):
4882 f.write("MojoGLES2MakeCurrent(context_);"); 4886 f.write("MojoGLES2MakeCurrent(context_);");
4883 func_return = "gl" + func.original_name + "(" + \ 4887 func_return = "gl" + func.original_name + "(" + \
4884 func.MakeOriginalArgString("") + ");" 4888 func.MakeOriginalArgString("") + ");"
4885 if func.return_type == "void": 4889 if func.return_type == "void":
4886 f.write(func_return); 4890 f.write(func_return);
4887 else: 4891 else:
4888 f.write("return " + func_return); 4892 f.write("return " + func_return);
4889 else: 4893 else:
4890 f.write("NOTREACHED() << \"Unimplemented %s.\";\n" % 4894 f.write("NOTREACHED() << \"Unimplemented %s.\";\n" %
4891 func.original_name); 4895 func.original_name);
(...skipping 5560 matching lines...) Expand 10 before | Expand all | Expand 10 after
10452 f.write(code); 10456 f.write(code);
10453 self.generated_cpp_filenames.append(filename) 10457 self.generated_cpp_filenames.append(filename)
10454 10458
10455 def WriteMojoGLES2Impl(self, filename): 10459 def WriteMojoGLES2Impl(self, filename):
10456 """Writes the Mojo GLES2 implementation.""" 10460 """Writes the Mojo GLES2 implementation."""
10457 code = """ 10461 code = """
10458 #include "mojo/gpu/mojo_gles2_impl_autogen.h" 10462 #include "mojo/gpu/mojo_gles2_impl_autogen.h"
10459 10463
10460 #include "base/logging.h" 10464 #include "base/logging.h"
10461 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_copy_texture.h" 10465 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_copy_texture.h"
10466 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_extension.h"
10462 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_framebuffer_multisam ple.h" 10467 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_framebuffer_multisam ple.h"
10463 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_image.h" 10468 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_image.h"
10464 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_miscellaneous.h" 10469 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_miscellaneous.h"
10465 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_pixel_transfer_buffe r_object.h" 10470 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_pixel_transfer_buffe r_object.h"
10466 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_sub_image.h" 10471 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_sub_image.h"
10467 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_sync_point.h" 10472 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_sync_point.h"
10468 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_texture_mailbox.h" 10473 #include "third_party/mojo/src/mojo/public/c/gles2/chromium_texture_mailbox.h"
10469 #include "third_party/mojo/src/mojo/public/c/gles2/gles2.h" 10474 #include "third_party/mojo/src/mojo/public/c/gles2/gles2.h"
10470 #include "third_party/mojo/src/mojo/public/c/gles2/occlusion_query_ext.h" 10475 #include "third_party/mojo/src/mojo/public/c/gles2/occlusion_query_ext.h"
10471 10476
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
10885 func.MakeTypedOriginalArgString(""), 10890 func.MakeTypedOriginalArgString(""),
10886 func.MakeOriginalArgString(""))) 10891 func.MakeOriginalArgString("")))
10887 self.generated_cpp_filenames.append(filename) 10892 self.generated_cpp_filenames.append(filename)
10888 10893
10889 def WriteMojoGLCallVisitorForExtension(self, filename, extension): 10894 def WriteMojoGLCallVisitorForExtension(self, filename, extension):
10890 """Provides the GL implementation for mojo for a particular extension""" 10895 """Provides the GL implementation for mojo for a particular extension"""
10891 with CWriter(filename) as f: 10896 with CWriter(filename) as f:
10892 for func in self.original_functions: 10897 for func in self.original_functions:
10893 if func.GetInfo("extension") != extension: 10898 if func.GetInfo("extension") != extension:
10894 continue 10899 continue
10900 if func.IsUnsafe():
10901 continue
10895 f.write("VISIT_GL_CALL(%s, %s, (%s), (%s))\n" % 10902 f.write("VISIT_GL_CALL(%s, %s, (%s), (%s))\n" %
10896 (func.name, func.return_type, 10903 (func.name, func.return_type,
10897 func.MakeTypedOriginalArgString(""), 10904 func.MakeTypedOriginalArgString(""),
10898 func.MakeOriginalArgString(""))) 10905 func.MakeOriginalArgString("")))
10899 self.generated_cpp_filenames.append(filename) 10906 self.generated_cpp_filenames.append(filename)
10900 10907
10901 def Format(generated_files): 10908 def Format(generated_files):
10902 formatter = "clang-format" 10909 formatter = "clang-format"
10903 if platform.system() == "Windows": 10910 if platform.system() == "Windows":
10904 formatter += ".bat" 10911 formatter += ".bat"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
11004 "gles2_cmd_validation_implementation_autogen.h") 11011 "gles2_cmd_validation_implementation_autogen.h")
11005 gen.WriteCommonUtilsHeader( 11012 gen.WriteCommonUtilsHeader(
11006 "gpu/command_buffer/common/gles2_cmd_utils_autogen.h") 11013 "gpu/command_buffer/common/gles2_cmd_utils_autogen.h")
11007 gen.WriteCommonUtilsImpl( 11014 gen.WriteCommonUtilsImpl(
11008 "gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h") 11015 "gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h")
11009 gen.WriteGLES2Header("gpu/GLES2/gl2chromium_autogen.h") 11016 gen.WriteGLES2Header("gpu/GLES2/gl2chromium_autogen.h")
11010 mojo_gles2_prefix = ("third_party/mojo/src/mojo/public/c/gles2/" 11017 mojo_gles2_prefix = ("third_party/mojo/src/mojo/public/c/gles2/"
11011 "gles2_call_visitor") 11018 "gles2_call_visitor")
11012 gen.WriteMojoGLCallVisitor(mojo_gles2_prefix + "_autogen.h") 11019 gen.WriteMojoGLCallVisitor(mojo_gles2_prefix + "_autogen.h")
11013 gen.WriteMojoGLCallVisitorForExtension( 11020 gen.WriteMojoGLCallVisitorForExtension(
11021 mojo_gles2_prefix + "_chromium_extension_autogen.h",
11022 True)
Peng 2015/09/17 16:32:33 I am wondering why not put all gl extension APIs i
piman 2015/09/17 23:51:38 I would prefer if you tagged each function that yo
Peng 2015/09/18 15:17:16 I tagged most functions, except several functions
11023 gen.WriteMojoGLCallVisitorForExtension(
11014 mojo_gles2_prefix + "_chromium_texture_mailbox_autogen.h", 11024 mojo_gles2_prefix + "_chromium_texture_mailbox_autogen.h",
11015 "CHROMIUM_texture_mailbox") 11025 "CHROMIUM_texture_mailbox")
11016 gen.WriteMojoGLCallVisitorForExtension( 11026 gen.WriteMojoGLCallVisitorForExtension(
11017 mojo_gles2_prefix + "_chromium_sync_point_autogen.h", 11027 mojo_gles2_prefix + "_chromium_sync_point_autogen.h",
11018 "CHROMIUM_sync_point") 11028 "CHROMIUM_sync_point")
11019 gen.WriteMojoGLCallVisitorForExtension( 11029 gen.WriteMojoGLCallVisitorForExtension(
11020 mojo_gles2_prefix + "_chromium_sub_image_autogen.h", 11030 mojo_gles2_prefix + "_chromium_sub_image_autogen.h",
11021 "CHROMIUM_sub_image") 11031 "CHROMIUM_sub_image")
11022 gen.WriteMojoGLCallVisitorForExtension( 11032 gen.WriteMojoGLCallVisitorForExtension(
11023 mojo_gles2_prefix + "_chromium_miscellaneous_autogen.h", 11033 mojo_gles2_prefix + "_chromium_miscellaneous_autogen.h",
(...skipping 17 matching lines...) Expand all
11041 Format(gen.generated_cpp_filenames) 11051 Format(gen.generated_cpp_filenames)
11042 11052
11043 if gen.errors > 0: 11053 if gen.errors > 0:
11044 print "%d errors" % gen.errors 11054 print "%d errors" % gen.errors
11045 return 1 11055 return 1
11046 return 0 11056 return 0
11047 11057
11048 11058
11049 if __name__ == '__main__': 11059 if __name__ == '__main__':
11050 sys.exit(main(sys.argv[1:])) 11060 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « no previous file | mojo/gles2/gles2_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698