diff options
author | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-20 18:03:24 +0000 |
---|---|---|
committer | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-20 18:03:24 +0000 |
commit | bc124aabfb137195eea9a37c7b0401ee7c83798d (patch) | |
tree | 47010d539e75ce97d210bb1c159d88ea24e2abcd /gpu | |
parent | d6833856fdb1ee83547353a4c69388c426ff4aaa (diff) | |
download | chromium_src-bc124aabfb137195eea9a37c7b0401ee7c83798d.zip chromium_src-bc124aabfb137195eea9a37c7b0401ee7c83798d.tar.gz chromium_src-bc124aabfb137195eea9a37c7b0401ee7c83798d.tar.bz2 |
Sorry but I had to rollback this change.
os.path.relpath is not available with python 2.4
which is the verison of python that Chrome's
build system ships with.
TBR=neb@chromium.org
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56887 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rwxr-xr-x | gpu/command_buffer/build_gles2_cmd_buffer.py | 159 |
1 files changed, 24 insertions, 135 deletions
diff --git a/gpu/command_buffer/build_gles2_cmd_buffer.py b/gpu/command_buffer/build_gles2_cmd_buffer.py index d1c7935..f747f7a 100755 --- a/gpu/command_buffer/build_gles2_cmd_buffer.py +++ b/gpu/command_buffer/build_gles2_cmd_buffer.py @@ -16,7 +16,7 @@ _SIZE_OF_UINT32 = 4 _SIZE_OF_COMMAND_HEADER = 4 _FIRST_SPECIFIC_COMMAND_ID = 256 -_LICENSE = """// Copyright (c) 2010 The Chromium Authors. All rights reserved. +_LICENSE = """// Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -32,25 +32,6 @@ _LICENSE = """// Copyright (c) 2010 The Chromium Authors. All rights reserved. # # *) All GLenums have been changed to GLenumTypeOfEnum # -_GL_TYPES = { - 'GLenum': 'unsigned int', - 'GLboolean': 'unsigned char', - 'GLbitfield': 'unsigned int', - 'GLbyte': 'signed char', - 'GLshort': 'short', - 'GLint': 'int', - 'GLsizei': 'int', - 'GLubyte': 'unsigned char', - 'GLushort': 'unsigned short', - 'GLuint': 'unsigned int', - 'GLfloat': 'float', - 'GLclampf': 'float', - 'GLvoid': 'void', - 'GLfixed': 'int', - 'GLclampx': 'int', - 'GLintptr': 'khronos_intptr_t', - 'GLsizeiptr': 'khronos_ssize_t', -} _GL_FUNCTIONS = """ GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture); GL_APICALL void GL_APIENTRY glAttachShader (GLidProgram program, GLidShader shader); @@ -1584,15 +1565,11 @@ class CWriter(object): if splitter >= 0 and not string[splitter + 1] == '=' and splitter < 80: return splitter parts = string.split('(') - fptr = re.compile('\*\w*\)') if len(parts) > 1: splitter = len(parts[0]) for ii in range(1, len(parts)): - # Don't split on the dot in "if (.condition)". if (not parts[ii - 1][-3:] == "if " and - # Don't split "(.)" or "(.*fptr)". - (len(parts[ii]) > 0 and - not parts[ii][0] == ")" and not fptr.match(parts[ii])) + (len(parts[ii]) > 0 and not parts[ii][0] == ")") and splitter < 80): return splitter splitter += len(parts[ii]) + 1 @@ -1644,17 +1621,12 @@ class CHeaderWriter(CWriter): _non_alnum_re = re.compile(r'[^a-zA-Z0-9]') - def __init__(self, filename, file_comment = None, guard_depth = None): + def __init__(self, filename, file_comment = None): CWriter.__init__(self, filename) - if guard_depth == None: - hpath = os.path.relpath(filename) - else: - base = os.path.abspath(filename) - for i in xrange(0, guard_depth): - base = os.path.dirname(base) - hpath = os.path.relpath(base) - + base = os.path.dirname( + os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) + hpath = os.path.abspath(filename)[len(base) + 1:] self.guard = self._non_alnum_re.sub('_', hpath).upper() + '_' self.Write(_LICENSE) @@ -5084,78 +5056,9 @@ class GLGenerator(object): 'post': post, }) pre = ' ' - file.Write("}\n\n"); - file.Close() - - def WritePepperGLES2Interface(self, filename): - """Writes the Pepper OpenGLES interface definition.""" - file = CHeaderWriter( - filename, - "// This interface is used to access common and lite profile OpenGL ES " - "2.0\n// functions.\n") - - file.Write("#include \"../GLES2/khrplatform.h\"\n\n") - - file.Write("#define PPB_OPENGLES_INTERFACE \"PPB_OpenGLES;2.0\"\n\n") - - for (k, v) in _GL_TYPES.iteritems(): - file.Write("typedef %s %s;\n" % (v, k)) - - file.Write("\ntypedef struct _ppb_OpenGLES {\n") - for func in self.original_functions: - file.Write(" %s (*%s)(%s);\n" % - (func.return_type, func.name, - func.MakeTypedOriginalArgString(""))) - file.Write("} PPB_OpenGLES;\n\n") - + file.Write("}\n"); file.Close() - def WritePepperGLES2Implementation(self, filename): - """Writes the Pepper OpenGLES interface implementation.""" - - file = CWriter(filename) - file.Write(_LICENSE) - file.Write("// This file is auto-generated. DO NOT EDIT!\n\n") - - file.Write("#include \"webkit/glue/plugins/pepper_graphics_3d.h\"\n\n") - - file.Write("#include \"gpu/command_buffer/client/gles2_implementation.h\"") - file.Write("\n#include \"third_party/ppapi/c/ppb_opengles.h\"\n\n") - - file.Write("namespace pepper {\n\n") - file.Write("namespace {\n\n") - - for func in self.original_functions: - file.Write("%s %s(%s) {\n" % - (func.return_type, func.name, - func.MakeTypedOriginalArgString(""))) - return_string = "return " - if func.return_type == "void": - return_string = "" - file.Write(" %sGraphics3D::GetCurrent()->impl()->%s(%s);\n" % - (return_string, func.original_name, - func.MakeOriginalArgString(""))) - file.Write("}\n") - - - file.Write("\nconst PPB_OpenGLES ppb_opengles = {\n") - - file.Write(" &") - file.Write(",\n &".join(f.name for f in self.original_functions)) - file.Write("\n") - - file.Write("};\n\n") - file.Write("} // namespace\n") - - file.Write(""" -const PPB_OpenGLES* Graphics3D::GetOpenGLESInterface() { - return &ppb_opengles; -} - -""") - file.Write("} // namespace pepper\n") - - file.Close() def main(argv): """This is the main function.""" @@ -5170,12 +5073,6 @@ def main(argv): "--generate-docs", action="store_true", help="generate a docs friendly version of the command formats.") parser.add_option( - "--alternate-mode", type="choice", choices=("ppapi", "chrome_ppapi"), - help="generate files for other projects. \"ppapi\" must be run from the " - "directory containing the ppapi directory, and will generate ppapi " - "bindings. \"chrome_ppapi\" must be run from chrome src directory and " - "will generate chrome plumbing for ppapi") - parser.add_option( "-v", "--verbose", action="store_true", help="prints more output.") @@ -5183,31 +5080,23 @@ def main(argv): gen = GLGenerator(options.verbose) gen.ParseGLH("common/GLES2/gl2.h") - - if options.alternate_mode == "ppapi": - gen.WritePepperGLES2Interface("ppapi/c/ppb_opengles.h") - - elif options.alternate_mode == "chrome_ppapi": - gen.WritePepperGLES2Implementation("webkit/glue/plugins/pepper_graphics_3d_gl.cc") - - else: - gen.WriteCommandIds("common/gles2_cmd_ids_autogen.h") - gen.WriteFormat("common/gles2_cmd_format_autogen.h") - gen.WriteFormatTest("common/gles2_cmd_format_test_autogen.h") - gen.WriteGLES2ImplementationHeader("client/gles2_implementation_autogen.h") - gen.WriteGLES2CLibImplementation("client/gles2_c_lib_autogen.h") - gen.WriteCmdHelperHeader("client/gles2_cmd_helper_autogen.h") - gen.WriteServiceImplementation("service/gles2_cmd_decoder_autogen.h") - gen.WriteServiceUnitTests("service/gles2_cmd_decoder_unittest_%d_autogen.h") - gen.WriteServiceUtilsHeader("service/gles2_cmd_validation_autogen.h") - gen.WriteServiceUtilsImplementation( - "service/gles2_cmd_validation_implementation_autogen.h") - - if options.generate_command_id_tests: - gen.WriteCommandIdTest("common/gles2_cmd_id_test_autogen.h") - - if options.generate_docs: - gen.WriteDocs("docs/gles2_cmd_format_docs_autogen.h") + gen.WriteCommandIds("common/gles2_cmd_ids_autogen.h") + gen.WriteFormat("common/gles2_cmd_format_autogen.h") + gen.WriteFormatTest("common/gles2_cmd_format_test_autogen.h") + gen.WriteGLES2ImplementationHeader("client/gles2_implementation_autogen.h") + gen.WriteGLES2CLibImplementation("client/gles2_c_lib_autogen.h") + gen.WriteCmdHelperHeader("client/gles2_cmd_helper_autogen.h") + gen.WriteServiceImplementation("service/gles2_cmd_decoder_autogen.h") + gen.WriteServiceUnitTests("service/gles2_cmd_decoder_unittest_%d_autogen.h") + gen.WriteServiceUtilsHeader("service/gles2_cmd_validation_autogen.h") + gen.WriteServiceUtilsImplementation( + "service/gles2_cmd_validation_implementation_autogen.h") + + if options.generate_command_id_tests: + gen.WriteCommandIdTest("common/gles2_cmd_id_test_autogen.h") + + if options.generate_docs: + gen.WriteDocs("docs/gles2_cmd_format_docs_autogen.h") if gen.errors > 0: print "%d errors" % gen.errors |