gpu/command_buffer/build_cmd_buffer_lib.py
def ParseGLH(self, filename):
    """Parses the cmd_buffer_functions.txt file and extracts the functions"""
    filename = os.path.join(self.chromium_root_dir, filename)
    with open(filename, "r") as f:
      functions = f.read()
    for line in functions.splitlines():
      if self._whitespace_re.match(line) or self._comment_re.match(line):
        continue
      match = self._function_re.match(line)
      if match:
        prefixed_name = match.group(2)
        func_name = prefixed_name[2:]
        func_info = self.GetFunctionInfo(func_name)
        if func_info['type'] == 'Noop':
          continue

        parsed_func_info = {
          'prefixed_name': prefixed_name,
          'original_name': func_name,
          'original_args': match.group(3),
          'return_type': match.group(1).strip(),
        }

        for k in parsed_func_info.keys():
          if not k in func_info:
            func_info[k] = parsed_func_info[k]

        f = Function(func_name, func_info, self.named_type_info,
                     self.type_handlers)
        if not f.GetInfo('internal'):
          self.original_functions.append(f)

        #for arg in f.GetOriginalArgs():
        #  if not isinstance(arg, EnumArgument) and arg.type == 'GLenum':
        #    self.Log("%s uses bare GLenum %s." % (func_name, arg.name))

        func_type = f.GetInfo('type')
        if func_type != 'NoCommand':
          if f.type_handler.NeedsDataTransferFunction(f):
            methods = f.GetDataTransferMethods()
            if 'immediate' in methods:
              self.AddFunction(ImmediateFunction(f, self.type_handlers))
            if 'bucket' in methods:
              self.AddFunction(BucketFunction(f, self.type_handlers))
            if 'shm' in methods:
              self.AddFunction(f)
          else:
            self.AddFunction(f)
      else:
        self.Error("Could not parse function: %s using regex: %s" %
                   (line, self._function_re.pattern))

    self.Log("Auto Generated Functions    : %d" %
             len([f for f in self.functions if f.can_auto_generate or
                  (not f.IsType('') and not f.IsType('Custom') and
                   not f.IsType('Todo'))]))

    funcs = [f for f in self.functions if not f.can_auto_generate and
             (f.IsType('') or f.IsType('Custom') or f.IsType('Todo'))]
    self.Log("Non Auto Generated Functions: %d" % len(funcs))

    for f in funcs:
      self.Log("  %-10s %-20s gl%s" % (f.info['type'], f.return_type, f.name))
Parses the cmd_buffer_functions.txt file and extracts the functions
Parses the cmd_buffer_functions.txt file and extracts the functions
Parses the cmd_buffer_functions . txt file and extracts the functions
def ParseGLH(self, filename):
    filename = os.path.join(self.chromium_root_dir, filename)
    with open(filename, "r") as f:
      functions = f.read()
    for line in functions.splitlines():
      if self._whitespace_re.match(line) or self._comment_re.match(line):
        continue
      match = self._function_re.match(line)
      if match:
        prefixed_name = match.group(2)
        func_name = prefixed_name[2:]
        func_info = self.GetFunctionInfo(func_name)
        if func_info['type'] == 'Noop':
          continue
        parsed_func_info = {
          'prefixed_name': prefixed_name,
          'original_name': func_name,
          'original_args': match.group(3),
          'return_type': match.group(1).strip(),
        }
        for k in parsed_func_info.keys():
          if not k in func_info:
            func_info[k] = parsed_func_info[k]
        f = Function(func_name, func_info, self.named_type_info,
                     self.type_handlers)
        if not f.GetInfo('internal'):
          self.original_functions.append(f)
        func_type = f.GetInfo('type')
        if func_type != 'NoCommand':
          if f.type_handler.NeedsDataTransferFunction(f):
            methods = f.GetDataTransferMethods()
            if 'immediate' in methods:
              self.AddFunction(ImmediateFunction(f, self.type_handlers))
            if 'bucket' in methods:
              self.AddFunction(BucketFunction(f, self.type_handlers))
            if 'shm' in methods:
              self.AddFunction(f)
          else:
            self.AddFunction(f)
      else:
        self.Error("Could not parse function: %s using regex: %s" %
                   (line, self._function_re.pattern))
    self.Log("Auto Generated Functions    : %d" %
             len([f for f in self.functions if f.can_auto_generate or
                  (not f.IsType('') and not f.IsType('Custom') and
                   not f.IsType('Todo'))]))
    funcs = [f for f in self.functions if not f.can_auto_generate and
             (f.IsType('') or f.IsType('Custom') or f.IsType('Todo'))]
    self.Log("Non Auto Generated Functions: %d" % len(funcs))
    for f in funcs:
      self.Log("  %-10s %-20s gl%s" % (f.info['type'], f.return_type, f.name))
def ParseGLH ( self , filename ) : filename = os . path . join ( self . chromium_root_dir , filename ) with open ( filename , "r" ) as f : functions = f . read ( ) for line in functions . splitlines ( ) : if self . _whitespace_re . match ( line ) or self . _comment_re . match ( line ) : continue match = self . _function_re . match ( line ) if match : prefixed_name = match . group ( 2 ) func_name = prefixed_name [ 2 : ] func_info = self . GetFunctionInfo ( func_name ) if func_info [ 'type' ] == 'Noop' : continue parsed_func_info = { 'prefixed_name' : prefixed_name , 'original_name' : func_name , 'original_args' : match . group ( 3 ) , 'return_type' : match . group ( 1 ) . strip ( ) , } for k in parsed_func_info . keys ( ) : if not k in func_info : func_info [ k ] = parsed_func_info [ k ] f = Function ( func_name , func_info , self . named_type_info , self . type_handlers ) if not f . GetInfo ( 'internal' ) : self . original_functions . append ( f ) func_type = f . GetInfo ( 'type' ) if func_type != 'NoCommand' : if f . type_handler . NeedsDataTransferFunction ( f ) : methods = f . GetDataTransferMethods ( ) if 'immediate' in methods : self . AddFunction ( ImmediateFunction ( f , self . type_handlers ) ) if 'bucket' in methods : self . AddFunction ( BucketFunction ( f , self . type_handlers ) ) if 'shm' in methods : self . AddFunction ( f ) else : self . AddFunction ( f ) else : self . Error ( "Could not parse function: %s using regex: %s" % ( line , self . _function_re . pattern ) ) self . Log ( "Auto Generated Functions    : %d" % len ( [ f for f in self . functions if f . can_auto_generate or ( not f . IsType ( '' ) and not f . IsType ( 'Custom' ) and not f . IsType ( 'Todo' ) ) ] ) ) funcs = [ f for f in self . functions if not f . can_auto_generate and ( f . IsType ( '' ) or f . IsType ( 'Custom' ) or f . IsType ( 'Todo' ) ) ] self . Log ( "Non Auto Generated Functions: %d" % len ( funcs ) ) for f in funcs : self . Log ( "  %-10s %-20s gl%s" % ( f . info [ 'type' ] , f . return_type , f . name ) )
Parses the cmd_buffer_functions.txt file and extracts the functions
Parses the cmd_buffer_functions . txt file and extracts the functions
"""Parses the cmd_buffer_functions.txt file and extracts the functions""" #for arg in f.GetOriginalArgs(): #  if not isinstance(arg, EnumArgument) and arg.type == 'GLenum': #    self.Log("%s uses bare GLenum %s." % (func_name, arg.name))
self
filename