class_docstr: Compiler is used to convert Function and Variable instances into
  ready-to-use GLSL code. This class handles name mangling to ensure that
  there are no name collisions amongst global objects. The final name of
  each object may be retrieved using ``Compiler.__getitem__(obj)``.
  
  Accepts multiple root Functions as keyword arguments. ``compile()`` then
  returns a dict of GLSL strings with the same keys.
  
  Example::
  
      # initialize with two main functions
      compiler = Compiler(vert=v_func, frag=f_func)
  
      # compile and extract shaders
      code = compiler.compile()
      v_code = code['vert']
      f_code = code['frag']
  
      # look up name of some object
      name = compiler[obj]
docstr: Compile all code and return a dict {name: code} where the keys
  are determined by the keyword arguments passed to __init__().
  
  Parameters
  ----------
  pretty : bool
      If True, use a slower method to mangle object names. This produces
      GLSL that is more readable.
      If False, then the output is mostly unreadable GLSL, but is about
      10x faster to compile.
code: def compile(self, pretty=True):
      """Compile all code and return a dict {name: code} where the keys
      are determined by the keyword arguments passed to __init__().
  
      Parameters
      ----------
      pretty : bool
          If True, use a slower method to mangle object names. This produces
          GLSL that is more readable.
          If False, then the output is mostly unreadable GLSL, but is about
          10x faster to compile.
      """
      # Authoritative mapping of {obj: name}
      self._object_names = {}
  
      #
      # 1. collect list of dependencies for each shader
      #
  
      # maps {shader_name: [deps]}
      self._shader_deps = {}
  
      for shader_name, shader in self.shaders.items():
          this_shader_deps = []
          self._shader_deps[shader_name] = this_shader_deps
          dep_set = set()
  
          for dep in shader.dependencies(sort=True):
              # visit each object no more than once per shader
              if dep.name is None or dep in dep_set:
                  continue
              this_shader_deps.append(dep)
              dep_set.add(dep)
  
      #
      # 2. Assign names to all objects.
      #
      if pretty:
          self._rename_objects_pretty()
      else:
          self._rename_objects_fast()
  
      #
      # 3. Now we have a complete namespace; concatenate all definitions
      # together in topological order.
      #
      compiled = {}
      obj_names = self._object_names
  
      for shader_name, shader in self.shaders.items():
          code = []
          version = shader.version_pragma
          for dep in self._shader_deps[shader_name]:
              dep_code = dep.definition(obj_names, version, shader)
              if dep_code is not None:
                  code.append(dep_code)
  
          if version is not None:
              code.insert(0, "#version %s %s" % version)
  
          compiled[shader_name] = "\n".join(code)
  
      self.code = compiled
      return compiled
  
file_path: vispy/vispy/visuals/shaders/compiler.py
imports: from __future__ import division
  from ...None import gloo
label_desc: Use image node_id 3 for calling the Compiler obj's underlying member method code with example usage: obj.compile(pretty) and returns: compiled