gpu/command_buffer/build_cmd_buffer_lib.py
def CreateArg(arg_string, named_type_info):
  """Convert string argument to an Argument class that represents it.

  The parameter 'arg_string' can be a single argument to a GL function,
  something like 'GLsizei width' or 'const GLenum* bufs'. Returns an instance of
  the Argument class, or None if 'arg_string' is 'void'.
  """
  if arg_string == 'void':
    return None

  arg_string = arg_string.strip()
  arg_default = None
  if '=' in arg_string:
    arg_string, arg_default = arg_string.split('=')
    arg_default = arg_default.strip()
  arg_parts = arg_string.split()
  assert len(arg_parts) > 1
  arg_name = arg_parts[-1]
  arg_type = " ".join(arg_parts[0:-1])
  t = arg_parts[0]  # only the first part of arg_type

  # Is this a pointer argument?
  if arg_string.find('*') >= 0:
    return PointerArgument(arg_name, arg_type, arg_default)
  elif t.startswith('EnumClass'):
    return EnumClassArgument(arg_name, arg_type, named_type_info, arg_default)
  # Is this a resource argument? Must come after pointer check.
  elif t.startswith('GLidBind'):
    return ResourceIdBindArgument(arg_name, arg_type, arg_default)
  elif t.startswith('GLidZero'):
    return ResourceIdZeroArgument(arg_name, arg_type, arg_default)
  elif t.startswith('GLid'):
    return ResourceIdArgument(arg_name, arg_type, arg_default)
  elif t.startswith('GLenum') and t !='GLenum':
    return EnumArgument(arg_name, arg_type, named_type_info, arg_default)
  elif t.startswith('GLbitfield') and t != 'GLbitfield':
    return BitFieldArgument(arg_name, arg_type, named_type_info, arg_default)
  elif t.startswith('GLboolean'):
    return GLBooleanArgument(arg_name, arg_type, arg_default)
  elif t.startswith('GLintUniformLocation'):
    return UniformLocationArgument(arg_name, arg_default)
  elif (t.startswith('GLint') and t != 'GLint' and
        not t.startswith('GLintptr')):
    return IntArgument(arg_name, arg_type, named_type_info, arg_default)
  elif t == 'bool':
    return BoolArgument(arg_name, arg_type, arg_default)
  elif t == 'GLsizeiNotNegative' or t == 'GLintptrNotNegative':
    return SizeNotNegativeArgument(arg_name, t.replace('NotNegative', ''),
                                   arg_default)
  elif t.startswith('GLsize'):
    return SizeArgument(arg_name, arg_type, arg_default)
  elif t == 'GLuint64' or t == 'GLint64':
    return Int64Argument(arg_name, arg_type, arg_default)
  else:
    return Argument(arg_name, arg_type, arg_default)
Convert string argument to an Argument class that represents it.

  The parameter 'arg_string' can be a single argument to a GL function,
  something like 'GLsizei width' or 'const GLenum* bufs'. Returns an instance of
  the Argument class, or None if 'arg_string' is 'void'.
  
Convert string argument to an Argument class that represents it.
Convert string argument to an Argument class that represents it .
def CreateArg(arg_string, named_type_info):
  if arg_string == 'void':
    return None
  arg_string = arg_string.strip()
  arg_default = None
  if '=' in arg_string:
    arg_string, arg_default = arg_string.split('=')
    arg_default = arg_default.strip()
  arg_parts = arg_string.split()
  assert len(arg_parts) > 1
  arg_name = arg_parts[-1]
  arg_type = " ".join(arg_parts[0:-1])
  t = arg_parts[0]  
  if arg_string.find('*') >= 0:
    return PointerArgument(arg_name, arg_type, arg_default)
  elif t.startswith('EnumClass'):
    return EnumClassArgument(arg_name, arg_type, named_type_info, arg_default)
  elif t.startswith('GLidBind'):
    return ResourceIdBindArgument(arg_name, arg_type, arg_default)
  elif t.startswith('GLidZero'):
    return ResourceIdZeroArgument(arg_name, arg_type, arg_default)
  elif t.startswith('GLid'):
    return ResourceIdArgument(arg_name, arg_type, arg_default)
  elif t.startswith('GLenum') and t !='GLenum':
    return EnumArgument(arg_name, arg_type, named_type_info, arg_default)
  elif t.startswith('GLbitfield') and t != 'GLbitfield':
    return BitFieldArgument(arg_name, arg_type, named_type_info, arg_default)
  elif t.startswith('GLboolean'):
    return GLBooleanArgument(arg_name, arg_type, arg_default)
  elif t.startswith('GLintUniformLocation'):
    return UniformLocationArgument(arg_name, arg_default)
  elif (t.startswith('GLint') and t != 'GLint' and
        not t.startswith('GLintptr')):
    return IntArgument(arg_name, arg_type, named_type_info, arg_default)
  elif t == 'bool':
    return BoolArgument(arg_name, arg_type, arg_default)
  elif t == 'GLsizeiNotNegative' or t == 'GLintptrNotNegative':
    return SizeNotNegativeArgument(arg_name, t.replace('NotNegative', ''),
                                   arg_default)
  elif t.startswith('GLsize'):
    return SizeArgument(arg_name, arg_type, arg_default)
  elif t == 'GLuint64' or t == 'GLint64':
    return Int64Argument(arg_name, arg_type, arg_default)
  else:
    return Argument(arg_name, arg_type, arg_default)
def CreateArg ( arg_string , named_type_info ) : if arg_string == 'void' : return None arg_string = arg_string . strip ( ) arg_default = None if '=' in arg_string : arg_string , arg_default = arg_string . split ( '=' ) arg_default = arg_default . strip ( ) arg_parts = arg_string . split ( ) assert len ( arg_parts ) > 1 arg_name = arg_parts [ - 1 ] arg_type = " " . join ( arg_parts [ 0 : - 1 ] ) t = arg_parts [ 0 ] if arg_string . find ( '*' ) >= 0 : return PointerArgument ( arg_name , arg_type , arg_default ) elif t . startswith ( 'EnumClass' ) : return EnumClassArgument ( arg_name , arg_type , named_type_info , arg_default ) elif t . startswith ( 'GLidBind' ) : return ResourceIdBindArgument ( arg_name , arg_type , arg_default ) elif t . startswith ( 'GLidZero' ) : return ResourceIdZeroArgument ( arg_name , arg_type , arg_default ) elif t . startswith ( 'GLid' ) : return ResourceIdArgument ( arg_name , arg_type , arg_default ) elif t . startswith ( 'GLenum' ) and t != 'GLenum' : return EnumArgument ( arg_name , arg_type , named_type_info , arg_default ) elif t . startswith ( 'GLbitfield' ) and t != 'GLbitfield' : return BitFieldArgument ( arg_name , arg_type , named_type_info , arg_default ) elif t . startswith ( 'GLboolean' ) : return GLBooleanArgument ( arg_name , arg_type , arg_default ) elif t . startswith ( 'GLintUniformLocation' ) : return UniformLocationArgument ( arg_name , arg_default ) elif ( t . startswith ( 'GLint' ) and t != 'GLint' and not t . startswith ( 'GLintptr' ) ) : return IntArgument ( arg_name , arg_type , named_type_info , arg_default ) elif t == 'bool' : return BoolArgument ( arg_name , arg_type , arg_default ) elif t == 'GLsizeiNotNegative' or t == 'GLintptrNotNegative' : return SizeNotNegativeArgument ( arg_name , t . replace ( 'NotNegative' , '' ) , arg_default ) elif t . startswith ( 'GLsize' ) : return SizeArgument ( arg_name , arg_type , arg_default ) elif t == 'GLuint64' or t == 'GLint64' : return Int64Argument ( arg_name , arg_type , arg_default ) else : return Argument ( arg_name , arg_type , arg_default )
Convert string argument to an Argument class that represents it.
Convert string argument to an Argument class that represents it .
"""Convert string argument to an Argument class that represents it.

  The parameter 'arg_string' can be a single argument to a GL function,
  something like 'GLsizei width' or 'const GLenum* bufs'. Returns an instance of
  the Argument class, or None if 'arg_string' is 'void'.
  """ # only the first part of arg_type # Is this a pointer argument? # Is this a resource argument? Must come after pointer check.
arg_string
named_type_info