Module Expr Str Import alias Import alias Import alias identifier ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias alias ImportFrom alias alias ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr If CompareIsNot NameLoad NameLoad body For NameStore NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Call NameLoad Assign AttributeStore NameLoad attr Call NameLoad Assign AttributeStore NameLoad attr Call NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str If Call NameLoad NameLoad NameLoad body If CompareEq AttributeLoad NameLoad attr Str body If CompareNotEq AttributeLoad NameLoad attr Str body Raise Call NameLoad Str Assign NameStore AttributeLoad NameLoad attr orelse Raise Call NameLoad BinOpMod Str TupleLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr orelse If Call NameLoad NameLoad NameLoad body If Call NameLoad Call NameLoad AttributeLoad NameLoad attr TupleLoad Str Str Str body Assign NameStore AttributeLoad NameLoad attr orelse If BoolOpOr CompareIn NameLoad AttributeLoad NameLoad attr CompareIn NameLoad TupleLoad Str Str body Assign NameStore AttributeLoad NameLoad attr orelse Raise Call NameLoad BinOpMod Str NameLoad orelse Raise Call NameLoad Str If Call NameLoad Call AttributeLoad NameLoad attr NameLoad NameLoad body Return If BoolOpAnd CompareIsNot NameLoad NameLoad UnaryOpNot Call NameLoad NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad If Call NameLoad NameLoad NameLoad body If Call AttributeLoad NameLoad attr CompareNotEq AttributeLoad NameLoad attr NameLoad body Assign AttributeStore NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr keyword NameLoad Return Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword NameLoad If CompareIs NameLoad NameLoad body Return Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad If CompareIsNot NameLoad NameLoad body For NameStore TupleLoad NameLoad NameLoad body If Call NameLoad NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad If CompareIsNot NameLoad NameLoad body If Call NameLoad NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad Assign SubscriptStore NameLoad Index NameLoad NameLoad For NameStore TupleLoad NameLoad NameLoad body If Call NameLoad NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad If Call NameLoad NameLoad NameLoad body For NameStore Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr body If CompareNotIn NameLoad AttributeLoad NameLoad attr body Expr Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr keyword NameLoad keyword NameLoad If CompareLtE AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Import alias Assign NameStore Call AttributeLoad NameLoad attr SubscriptLoad Call AttributeLoad NameLoad attr Slice Num Num Expr Call AttributeLoad NameLoad attr Str NameLoad NameLoad Call AttributeLoad Str attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str TryExcept body Return SubscriptLoad AttributeLoad NameLoad attr Index NameLoad handlers ExceptHandler type NameLoad body Pass TryExcept body Return SubscriptLoad AttributeLoad NameLoad attr Index NameLoad handlers ExceptHandler type NameLoad body Pass If CompareNotIn NameLoad AttributeLoad NameLoad attr body Raise Call NameLoad BinOpMod Str NameLoad orelse Raise Call NameLoad BinOpMod Str NameLoad decorator_list FunctionDef arguments args NameParam defaults vararg body Expr Str Return Call NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body If CompareIs AttributeLoad NameLoad attr NameLoad body TryExcept body Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr handlers ExceptHandler type NameLoad name NameStore body Raise Call NameLoad BinOpAdd Str Call NameLoad NameLoad Return AttributeLoad NameLoad attr decorator_list NameLoad FunctionDef arguments args NameParam defaults body Expr Str Return SubscriptLoad AttributeLoad NameLoad attr Index Num decorator_list NameLoad FunctionDef arguments args NameParam defaults body Expr Str Return SubscriptLoad AttributeLoad NameLoad attr Index Num decorator_list NameLoad FunctionDef arguments args NameParam defaults body Expr Str Return SubscriptLoad AttributeLoad NameLoad attr Index Num decorator_list NameLoad FunctionDef arguments args NameParam defaults body Expr Str Return AttributeLoad NameLoad attr decorator_list NameLoad FunctionDef arguments args NameParam NameParam defaults body If Call NameLoad NameLoad NameLoad body Assign NameStore AttributeLoad NameLoad attr orelse If UnaryOpNot Call NameLoad NameLoad NameLoad body Raise Call NameLoad BinOpMod Str Call NameLoad NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list AttributeLoad NameLoad attr FunctionDef arguments args NameParam defaults body If CompareIs AttributeLoad NameLoad attr NameLoad body Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Return AttributeLoad NameLoad attr decorator_list NameLoad FunctionDef arguments args NameParam defaults body If CompareIs AttributeLoad NameLoad attr NameLoad body Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Return BinOpAdd Call NameLoad Call AttributeLoad AttributeLoad NameLoad attr attr ListComp SubscriptLoad NameLoad Index Num comprehension NameStore AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str If CompareNotEq NameLoad Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad body Assign SubscriptStore AttributeLoad NameLoad attr Index NameLoad NameLoad Expr Call AttributeLoad NameLoad attr keyword NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad For NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Assign NameStore Call AttributeLoad NameLoad attr Str If CompareEq NameLoad AttributeLoad NameLoad attr body Continue If CompareIn NameLoad TupleLoad Str Str body Raise Call NameLoad BinOpMod Str NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore AttributeLoad NameLoad attr Assign NameStore SubscriptLoad NameLoad Index NameLoad Assign NameStore Call AttributeLoad NameLoad attr BinOpAdd BinOpAdd Str AttributeLoad NameLoad attr Str BinOpAdd BinOpAdd Str NameLoad Str For TupleStore NameStore NameStore Call AttributeLoad AttributeLoad NameLoad attr attr body Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad Assign NameStore ListLoad For TupleStore NameStore NameStore Call AttributeLoad AttributeLoad NameLoad attr attr body If Call NameLoad NameLoad NameLoad body Assign NameStore SubscriptLoad NameLoad Index NameLoad If Call NameLoad NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore BinOpMod Str TupleLoad NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad If CompareIn Str AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad Str attr NameLoad If NameLoad body Assign NameStore BinOpAdd BinOpAdd Str NameLoad Str Assign NameStore Call AttributeLoad NameLoad attr Str Assign NameStore BinOpAdd BinOpAdd BinOpAdd SubscriptLoad NameLoad Index Num NameLoad SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num If CompareIn Str AttributeLoad NameLoad attr body Assign NameStore Call AttributeLoad NameLoad attr BinOpAdd NameLoad Str NameLoad If CompareIs NameLoad NameLoad body Raise Call NameLoad BinOpMod Str NameLoad Assign NameStore SubscriptLoad Call AttributeLoad NameLoad attr Index Num Assign NameStore BinOpAdd BinOpAdd SubscriptLoad NameLoad Slice NameLoad Str SubscriptLoad NameLoad Slice NameLoad For TupleStore NameStore NameStore Call AttributeLoad AttributeLoad NameLoad attr attr body Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore BinOpAdd BinOpAdd Str NameLoad Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad BinOpAdd NameLoad Str NameLoad If CompareIn Str NameLoad body Assign NameStore Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Str NameLoad Call NameLoad Call AttributeLoad AttributeLoad NameLoad attr attr Return BinOpAdd NameLoad Str decorator_list FunctionDef arguments args NameParam NameParam defaults body Return Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Return SubscriptLoad NameLoad Index NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Str Assign NameStore Num For NameStore NameLoad body If CompareNotEq Call AttributeLoad NameLoad attr Str body Assign NameStore BinOpSub Call NameLoad NameLoad Call NameLoad Call AttributeLoad NameLoad attr Assign NameStore Call NameLoad NameLoad NameLoad If CompareGt NameLoad Num body Assign NameStore ListComp SubscriptLoad NameLoad Slice NameLoad comprehension NameStore NameLoad Assign NameStore Call AttributeLoad Str attr NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body TryExcept body Assign NameStore Call AttributeLoad Str attr ListComp Call AttributeLoad Str attr NameLoad comprehension NameStore AttributeLoad NameLoad attr handlers ExceptHandler type NameLoad body Return BinOpMod Str TupleLoad AttributeLoad AttributeLoad NameLoad attr attr Call NameLoad NameLoad Return BinOpMod Str TupleLoad AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad Call NameLoad NameLoad decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam defaults vararg kwarg body Assign AttributeStore NameLoad attr Dict Expr Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Return TupleLoad Str ListLoad Str decorator_list NameLoad FunctionDef arguments args NameParam defaults body If CompareIsNot AttributeLoad NameLoad attr NameLoad body Return AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr For NameStore NameLoad body If CompareEq SubscriptLoad NameLoad Index Num Str body Continue Expr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Num For NameStore SubscriptLoad NameLoad Index Num body Expr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Num Assign AttributeStore NameLoad attr NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call NameLoad NameLoad ListLoad Assign SubscriptStore AttributeLoad NameLoad attr Index NameLoad NameLoad Assign SubscriptStore NameLoad Index NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Call AttributeLoad SubscriptLoad AttributeLoad NameLoad attr Index NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Call AttributeLoad SubscriptLoad AttributeLoad NameLoad attr Index NameLoad attr NameLoad decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad TupleLoad body Expr Call AttributeLoad NameLoad attr NameLoad If UnaryOpNot BoolOpOr CompareIs NameLoad NameLoad Call NameLoad NameLoad NameLoad body Raise Call NameLoad Str Assign AttributeStore NameLoad attr ListLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr BoolOpOr NameLoad Str Assign AttributeStore NameLoad attr ListLoad Assign AttributeStore NameLoad attr Str Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Return SubscriptLoad AttributeLoad NameLoad attr Slice decorator_list NameLoad FunctionDef arguments args NameParam NameParam defaults body While AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr SubscriptLoad AttributeLoad NameLoad attr Index Num keyword NameLoad For NameStore NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad keyword NameLoad Expr Call AttributeLoad NameLoad attr decorator_list AttributeLoad NameLoad attr FunctionDef arguments args NameParam defaults body Return TupleLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list NameLoad FunctionDef arguments args NameParam defaults body Assign NameStore AttributeLoad NameLoad attr If CompareGt Call NameLoad NameLoad Num body Assign AttributeStore NameLoad attr AttributeLoad SubscriptLoad NameLoad Index Num attr Assign AttributeStore NameLoad attr SubscriptLoad AttributeLoad SubscriptLoad NameLoad Index Num attr Slice orelse Assign AttributeStore NameLoad attr Str Assign AttributeStore NameLoad attr ListLoad Expr Call AttributeLoad NameLoad attr keyword NameLoad decorator_list FunctionDef arguments args NameParam defaults body Return NameLoad decorator_list NameLoad FunctionDef arguments args NameParam NameParam defaults body Raise Call NameLoad Str decorator_list AttributeLoad NameLoad attr FunctionDef arguments args NameParam defaults body Return Dict decorator_list NameLoad FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Expr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad If NameLoad body Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Call AttributeLoad NameLoad attr SubscriptLoad AttributeLoad NameLoad attr Index NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Assign SubscriptStore AttributeLoad NameLoad attr Index NameLoad NameLoad Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Return SubscriptLoad AttributeLoad NameLoad attr Index NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad body Expr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad If NameLoad body Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Expr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad If NameLoad body Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Assign NameStore SubscriptLoad NameLoad Index NameLoad Assign NameStore Call AttributeLoad Str attr ListComp BinOpMod Str NameLoad comprehension NameStore AttributeLoad NameLoad attr Assign NameStore BinOpMod Str TupleLoad AttributeLoad NameLoad attr NameLoad NameLoad Assign NameStore Num If CompareEq Call NameLoad AttributeLoad NameLoad attr Num body Assign NameStore Str Assign NameStore Str orelse Assign TupleStore NameStore NameStore SubscriptLoad SubscriptLoad AttributeLoad NameLoad attr Index Num Slice Num For NameStore AttributeLoad NameLoad attr body If CompareEq NameLoad Str body Assign NameStore Str orelse Assign NameStore NameLoad If BoolOpOr CompareNotEq Call NameLoad AttributeLoad NameLoad attr Num CompareNotEq NameLoad SubscriptLoad SubscriptLoad AttributeLoad NameLoad attr Index Num Index Num body Raise Call NameLoad BinOpMod Str TupleLoad NameLoad AttributeLoad NameLoad attr Assign NameStore AttributeLoad NameLoad attr If CompareEq AttributeLoad NameLoad attr Str body Assign NameStore Str orelse AugAssignAdd NameStore Num Assign NameStore BinOpMod Str NameLoad Assign NameStore BinOpMod Str TupleLoad AttributeLoad NameLoad attr NameLoad Assign NameStore NameLoad AugAssignAdd NameStore BinOpMod Str TupleLoad NameLoad SubscriptLoad NameLoad Index NameLoad NameLoad If CompareNotEq AttributeLoad NameLoad attr Str body AugAssignAdd NameStore BinOpMod Str NameLoad AugAssignAdd NameStore Str Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Return ListLoad decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call AttributeLoad Str attr Call NameLoad NameLoad AttributeLoad NameLoad attr Return BinOpMod Str TupleLoad NameLoad Call NameLoad NameLoad decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam defaults body Assign AttributeStore NameLoad attr Dict Assign AttributeStore NameLoad attr ListLoad Expr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults Num body Expr Str If CompareIn NameLoad AttributeLoad NameLoad attr body Return Assign SubscriptStore AttributeLoad NameLoad attr Index NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr keyword NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr keyword NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body If CompareIs AttributeLoad NameLoad attr NameLoad body Assign AttributeStore NameLoad attr Call NameLoad Call AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr keyword Lambda arguments args NameParam defaults SubscriptLoad NameLoad Index Num Assign NameStore Str For TupleStore NameStore NameStore AttributeLoad NameLoad attr body AugAssignAdd NameStore BinOpAdd Call AttributeLoad NameLoad attr NameLoad Str Return NameLoad decorator_list decorator_list
N/A N/A 
Classses representing GLSL objects (functions, variables, etc) that may be
composed together to create complete shaders. 
See the docstring of Function for details.

Details
-------

A complete GLSL program is composed of ShaderObjects, each of which may be used
inline as an expression, and some of which include a definition that must be
included on the final code. ShaderObjects keep track of a hierarchy of
dependencies so that all necessary code is included at compile time, and
changes made to any object may be propagated to the root of the hierarchy to 
trigger a recompile.
 N/A re N/A logging N/A numpy np util.eq eq util logger ext.ordereddict OrderedDict ext.six string_types N/A parsing shader_object ShaderObject variable Variable Varying expression TextExpression FunctionCall Function N/A ShaderObject N/A N/A Representation of a GLSL function
    
    Objects of this class can be used for re-using and composing GLSL
    snippets. Each Function consists of a GLSL snippet in the form of
    a function. The code may have template variables that start with
    the dollar sign. These stubs can be replaced with expressions using
    the index operation. Expressions can be:
    
    * plain text that is inserted verbatim in the code
    * a Function object or a call to a funcion
    * a Variable (or Varying) object
    * float, int, tuple are automatically turned into a uniform Variable
    * a VertexBuffer is automatically turned into an attribute Variable
    
    All functions have implicit "$pre" and "$post" placeholders that may be
    used to insert code at the beginning and end of the function.
    
    Examples
    --------
    This example shows the basic usage of the Function class::

        vert_code_template = Function('''
            void main() {
            gl_Position = $pos;
            gl_Position.x += $xoffset;
            gl_Position.y += $yoffset;
        }''')
        
        scale_transform = Function('''
        vec4 transform_scale(vec4 pos){
            return pos * $scale;
        }''')
        
        # If you get the function from a snippet collection, always
        # create new Function objects to ensure they are 'fresh'.
        vert_code = Function(vert_code_template)
        trans1 = Function(scale_transform)
        trans2 = Function(scale_transform)  # trans2 != trans1
        
        # Three ways to assign to template variables:
        #
        # 1) Assign verbatim code
        vert_code['xoffset'] = '(3.0 / 3.1415)'
        
        # 2) Assign a value (this creates a new uniform or attribute)
        vert_code['yoffset'] = 5.0
        
        # 3) Assign a function call expression
        pos_var = Variable('attribute vec4 a_position')
        vert_code['pos'] = trans1(trans2(pos_var))
        
        # Transforms also need their variables set
        trans1['scale'] = 0.5
        trans2['scale'] = (1.0, 0.5, 1.0, 1.0)
        
        # You can actually change any code you want, but use this with care!
        vert_code.replace('gl_Position.y', 'gl_Position.z')
        
        # Finally, you can set special variables explicitly. This generates
        # a new statement at the end of the vert_code function.
        vert_code['gl_PointSize'] = '10.'
    
    
    If we use ``vert_code.compile()`` we get::

        attribute vec4 a_position;
        uniform float u_yoffset;
        uniform float u_scale_1;
        uniform vec4 u_scale_2;
        uniform float u_pointsize;
        
        vec4 transform_scale_1(vec4 pos){
            return pos * u_scale_1;
        }
        
        vec4 transform_scale_2(vec4 pos){
            return pos * u_scale_2;
        }
        
        void main() {
            gl_Position = transform_scale_1(transform_scale_2(a_position));
            gl_Position.x += (3.0 / 3.1415);
            gl_Position.z += u_yoffset;
        
            gl_PointSize = u_pointsize;
        }
    
    Note how the two scale function resulted in two different functions
    and two uniforms for the scale factors.
    
    Function calls
    --------------
    
    As can be seen above, the arguments with which a function is to be
    called must be specified by calling the Function object. The
    arguments can be any of the expressions mentioned earlier. If the
    signature is already specified in the template code, that function
    itself must be given.
    
        code = Function('''
            void main() {
                vec4 position = $pos;
                gl_Position = $scale(position)
            }
        ''')
        
        # Example of a function call with all possible three expressions
        vert_code['pos'] = func1('3.0', 'uniform float u_param', func2())
        
        # For scale, the sigfnature is already specified
        code['scale'] = scale_func  # Must not specify args
    
    Data for uniform and attribute variables
    ----------------------------------------
    To each variable a value can be associated. In fact, in most cases
    the Function class is smart enough to be able to create a Variable
    object if only the data is given.
    
        code['offset'] = Variable('uniform float offset')  # No data
        code['offset'] = Variable('uniform float offset', 3.0)  # With data
        code['offset'] = 3.0  # -> Uniform Variable
        position['position'] = VertexBuffer()  # -> attribute Variable
        
        # Updating variables
        code['offset'].value = 4.0
        position['position'].value.set_data(...)
     __init__ N/A N/A self code dependencies N/A None N/A N/A N/A N/A N/A super Function self __init__ N/A N/A dependencies None N/A N/A dep dependencies N/A N/A N/A N/A self _add_dep dep N/A N/A self code code N/A N/A self _expressions N/A OrderedDict N/A N/A self _replacements N/A OrderedDict N/A N/A self _assignments N/A OrderedDict N/A __setitem__ N/A N/A self key val N/A N/A N/A  Setting of replacements through a dict-like syntax.
        
        Each replacement can be:
        * verbatim code: ``fun1['foo'] = '3.14159'``
        * a FunctionCall: ``fun1['foo'] = fun2()``
        * a Variable: ``fun1['foo'] = Variable(...)`` (can be auto-generated)
         N/A N/A isinstance key Variable N/A N/A N/A N/A key vtype varying N/A N/A N/A N/A self name main N/A N/A N/A Exception Varying assignment only alowed in 'main' function. N/A storage N/A self _assignments N/A N/A N/A TypeError N/A Variable assignment only allowed for varyings, not %s (in %s) N/A N/A key vtype N/A self name N/A N/A N/A isinstance key string_types N/A N/A N/A any N/A map N/A key startswith N/A gl_PointSize gl_Position gl_FragColor N/A N/A storage N/A self _assignments N/A N/A N/A N/A key N/A self template_vars N/A key N/A pre post N/A N/A storage N/A self _expressions N/A N/A N/A KeyError N/A Invalid template variable %r key N/A N/A N/A TypeError In `function[key]` key must be a string or varying. N/A N/A eq N/A N/A storage get key val N/A N/A N/A N/A N/A val None N/A N/A isinstance val Variable N/A N/A variable N/A N/A storage get key None N/A N/A isinstance variable Variable N/A N/A N/A N/A np any N/A N/A variable value val N/A N/A N/A variable value val N/A N/A N/A self changed value_changed True N/A N/A val N/A N/A ShaderObject create val ref key N/A N/A variable val N/A N/A N/A oldval N/A N/A storage pop key None N/A N/A oldval None N/A N/A obj N/A key oldval N/A N/A N/A isinstance obj ShaderObject N/A N/A N/A N/A self _remove_dep obj N/A N/A val None N/A N/A N/A isinstance key Varying N/A N/A N/A N/A key link val N/A N/A storage N/A key val N/A obj N/A key val N/A N/A N/A isinstance obj ShaderObject N/A N/A N/A N/A self _add_dep obj N/A N/A isinstance val TextExpression N/A N/A var N/A N/A parsing find_template_variables N/A N/A val expression N/A N/A N/A var N/A self template_vars N/A N/A N/A N/A N/A self template_vars add N/A N/A var lstrip $ N/A N/A N/A self changed code_changed True value_changed True N/A N/A N/A logger level N/A logging DEBUG N/A N/A traceback N/A last N/A N/A traceback format_list N/A N/A N/A traceback extract_stack N/A -2 -1 N/A N/A N/A logger debug Assignment would trigger shader recompile:
Original:
%r
Replacement:
%r
Source:
%s oldval val N/A N/A join last N/A __getitem__ N/A N/A self key N/A N/A N/A  Return a reference to a program variable from this function.

        This allows variables between functions to be linked together::

            func1['var_name'] = func2['other_var_name']

        In the example above, the two local variables would be assigned to the
        same program variable whenever func1 and func2 are attached to the same
        program.
         N/A N/A N/A N/A N/A self _expressions N/A key N/A N/A N/A KeyError N/A N/A N/A N/A N/A N/A N/A self _assignments N/A key N/A N/A N/A KeyError N/A N/A N/A N/A key N/A self template_vars N/A N/A N/A KeyError N/A Invalid template variable %r key N/A N/A N/A KeyError N/A No value known for key %r key N/A __call__ N/A N/A self N/A args N/A N/A  Set the signature for this function and return an FunctionCall
        object. Each argument can be verbatim code or a FunctionCall object.
         N/A N/A FunctionCall self args N/A signature N/A N/A self N/A N/A N/A N/A N/A self _signature None N/A N/A N/A N/A N/A self _signature N/A N/A parsing parse_function_signature N/A self _code N/A N/A N/A Exception N/A err N/A N/A N/A ValueError N/A Invalid code:  N/A str err N/A N/A self _signature N/A property name N/A N/A self N/A N/A N/A  The function name. The name may be mangled in the final code
        to avoid name clashes.
         N/A N/A N/A self signature N/A 0 N/A property args N/A N/A self N/A N/A N/A 
        List of input arguments in the function signature::

            [(arg_name, arg_type), ...]
         N/A N/A N/A self signature N/A 1 N/A property rtype N/A N/A self N/A N/A N/A 
        The return type of this function.
         N/A N/A N/A self signature N/A 2 N/A property code N/A N/A self N/A N/A N/A  The template code used to generate the definition for this 
        function.
         N/A N/A self _code N/A property code N/A N/A self code N/A N/A N/A N/A isinstance code Function N/A N/A code N/A code _code N/A N/A N/A N/A isinstance code string_types N/A N/A N/A ValueError N/A Function needs a string or Function; got %s. N/A type code N/A N/A self _code N/A N/A self _clean_code code N/A N/A self _signature None N/A N/A self _template_vars None N/A N/A self _static_vars None N/A N/A code setter template_vars N/A N/A self N/A N/A N/A N/A N/A self _template_vars None N/A N/A N/A self _template_vars N/A N/A self _parse_template_vars N/A N/A self _template_vars N/A property static_names N/A N/A self N/A N/A N/A N/A N/A self _static_vars None N/A N/A N/A self _static_vars N/A N/A parsing find_program_variables N/A self _code N/A N/A N/A list N/A N/A N/A self _static_vars keys N/A N/A arg N/A 0 N/A arg N/A self args N/A replace N/A N/A self str1 str2 N/A N/A N/A  Set verbatim code replacement
        
        It is strongly recommended to use function['$foo'] = 'bar' where
        possible because template variables are less likely to changed
        than the code itself in future versions of vispy.
        
        Parameters
        ----------
        str1 : str
            String to replace
        str2 : str
            String to replace str1 with
         N/A N/A str2 N/A N/A N/A self _replacements get str1 None N/A N/A N/A N/A self _replacements N/A str1 str2 N/A N/A N/A self changed code_changed True N/A _parse_template_vars N/A N/A self N/A N/A N/A  find all template variables in self._code, excluding the
        function name. 
         N/A template_vars N/A set N/A var N/A N/A parsing find_template_variables N/A self _code N/A N/A var N/A N/A var lstrip $ N/A N/A var N/A self name N/A N/A N/A N/A var N/A pre post N/A N/A N/A ValueError N/A GLSL uses reserved template variable $%s var N/A N/A N/A template_vars add var N/A template_vars N/A _get_replaced_code N/A N/A self names N/A N/A N/A  Return code, with new name, expressions, and replacements applied.
         N/A code N/A self _code N/A fname N/A names N/A self N/A code N/A N/A code replace N/A N/A N/A self name ( N/A N/A fname ( N/A N/A key val N/A N/A N/A self _replacements items N/A N/A code N/A N/A code replace key val N/A post_lines N/A N/A N/A key val N/A N/A N/A self _assignments items N/A N/A N/A isinstance key Variable N/A N/A key N/A names N/A key N/A N/A isinstance val ShaderObject N/A N/A val N/A N/A val expression names N/A line N/A     %s = %s; N/A key val N/A N/A N/A post_lines append line N/A N/A post N/A self _expressions N/A N/A N/A N/A post_lines append     $post N/A post_text N/A N/A join post_lines N/A post_text N/A N/A post_text N/A N/A post_text N/A code N/A N/A code rpartition } N/A code N/A N/A N/A N/A code N/A 0 post_text N/A code N/A 1 N/A code N/A 2 N/A N/A pre N/A self _expressions N/A N/A m N/A N/A re search N/A fname \s*\([^{]*\)\s*{ code N/A N/A m None N/A N/A N/A RuntimeError N/A Cound not find beginning of function '%s' fname N/A ind N/A N/A N/A m span N/A 1 N/A code N/A N/A N/A code N/A ind 
    $pre
 N/A code N/A ind N/A N/A key val N/A N/A N/A self _expressions items N/A N/A val N/A N/A val expression names N/A search N/A N/A \$ key ($|[^a-zA-Z0-9_]) N/A code N/A N/A re sub search N/A val \1 code N/A N/A $ code N/A N/A v N/A N/A parsing find_template_variables code N/A N/A N/A logger warning Unsubstituted placeholders in code: %s
  replacements made: %s v N/A list N/A N/A N/A self _expressions keys N/A N/A code N/A definition N/A N/A self names N/A N/A N/A N/A N/A self _get_replaced_code names N/A expression N/A N/A self names N/A N/A N/A N/A names N/A self N/A _clean_code N/A N/A self code N/A N/A N/A  Return *code* with indentation and leading/trailing blank lines
        removed. 
         N/A lines N/A N/A code split N/A min_indent 100 N/A line lines N/A N/A N/A N/A N/A line strip N/A N/A indent N/A N/A len line N/A len N/A N/A line lstrip N/A min_indent N/A min indent min_indent N/A N/A min_indent 0 N/A N/A lines N/A N/A line N/A min_indent N/A line lines N/A code N/A N/A join lines N/A code N/A __repr__ N/A N/A self N/A N/A N/A N/A N/A args N/A N/A ,  join N/A N/A N/A join arg N/A arg N/A self args N/A N/A N/A Exception N/A N/A N/A <%s (error parsing signature) at 0x%x> N/A N/A N/A self __class__ __name__ N/A id self N/A N/A <%s "%s %s(%s)" at 0x%x> N/A N/A N/A self __class__ __name__ N/A self rtype N/A self name args N/A id self N/A N/A MainFunction N/A Function N/A N/A  Subclass of Function that allows multiple functions and variables to 
    be defined in a single code string. The code must contain a main() function
    definition.
     __init__ N/A N/A self N/A args kwargs N/A N/A N/A self _chains N/A N/A N/A N/A Function __init__ self args kwargs N/A signature N/A N/A self N/A N/A N/A N/A main N/A void N/A property static_names N/A N/A self N/A N/A N/A N/A N/A self _static_vars None N/A N/A N/A self _static_vars N/A names N/A N/A Function static_names self N/A funcs N/A N/A parsing find_functions N/A self code N/A f funcs N/A N/A N/A N/A f N/A 0 main N/A N/A N/A N/A N/A names append N/A f N/A 0 N/A arg N/A f N/A 1 N/A N/A N/A N/A names append N/A arg N/A 1 N/A N/A self _static_vars names N/A names N/A add_chain N/A N/A self var N/A N/A N/A 
        Create a new ChainFunction and attach to $var.
         N/A chain N/A FunctionChain var N/A N/A N/A N/A self _chains N/A var chain N/A N/A self N/A var chain N/A add_callback N/A N/A self hook func N/A N/A N/A N/A N/A N/A N/A self _chains N/A hook append func N/A remove_callback N/A N/A self hook func N/A N/A N/A N/A N/A N/A N/A self _chains N/A hook remove func N/A N/A FunctionChain N/A Function N/A N/A Subclass that generates GLSL code to call Function list in order

    Functions may be called independently, or composed such that the
    output of each function provides the input to the next.

    Parameters
    ----------
    name : str
        The name of the generated function
    funcs : list of Functions
        The list of Functions that will be called by the generated GLSL code.

    Examples
    --------
    This creates a function chain:

        >>> func1 = Function('void my_func_1() {}')
        >>> func2 = Function('void my_func_2() {}')
        >>> chain = FunctionChain('my_func_chain', [func1, func2])

    If *chain* is included in a ModularProgram, it will generate the following
    output:

        void my_func_1() {}
        void my_func_2() {}

        void my_func_chain() {
            my_func_1();
            my_func_2();
        }

    The return type of the generated function is the same as the return type
    of the last function in the chain. Likewise, the arguments for the
    generated function are the same as the first function in the chain.

    If the return type is not 'void', then the return value of each function
    will be used to supply the first input argument of the next function in
    the chain. For example:

        vec3 my_func_1(vec3 input) {return input + vec3(1, 0, 0);}
        void my_func_2(vec3 input) {return input + vec3(0, 1, 0);}

        vec3 my_func_chain(vec3 input) {
            return my_func_2(my_func_1(input));
        }
     __init__ N/A N/A self name funcs N/A None N/A N/A N/A N/A N/A ShaderObject __init__ self N/A N/A N/A N/A name None N/A isinstance name string_types N/A N/A N/A TypeError Name argument must be string or None. N/A N/A self _funcs N/A N/A N/A self _code None N/A N/A self _name N/A name chain N/A N/A self _args N/A N/A N/A self _rtype void N/A N/A self functions funcs N/A functions N/A N/A self N/A N/A N/A N/A N/A self _funcs N/A N/A property functions N/A N/A self funcs N/A N/A N/A N/A self _funcs N/A N/A N/A N/A self remove N/A N/A self _funcs N/A 0 update False N/A f funcs N/A N/A N/A N/A self append f update False N/A N/A N/A self _update N/A N/A functions setter signature N/A N/A self N/A N/A N/A N/A N/A self _name N/A self _args N/A self _rtype N/A property _update N/A N/A self N/A N/A N/A funcs N/A self _funcs N/A N/A N/A len funcs 0 N/A N/A N/A self _rtype N/A N/A funcs N/A -1 rtype N/A N/A self _args N/A N/A N/A funcs N/A 0 args N/A N/A N/A N/A self _rtype void N/A N/A self _args N/A N/A N/A N/A self changed code_changed True N/A code N/A N/A self N/A N/A N/A None N/A property code N/A N/A self c N/A N/A N/A N/A TypeError Cannot set code property on FunctionChain. N/A N/A code setter template_vars N/A N/A self N/A N/A N/A N/A N/A property append N/A N/A self function update N/A True N/A N/A  Append a new function to the end of this chain.
         N/A N/A N/A N/A self _funcs append function N/A N/A N/A self _add_dep function N/A update N/A N/A N/A N/A self _update N/A __setitem__ N/A N/A self index func N/A N/A N/A N/A N/A self _remove_dep N/A N/A self _funcs N/A index N/A N/A N/A self _add_dep func N/A N/A N/A self _funcs N/A index func N/A N/A N/A self _update N/A __getitem__ N/A N/A self k N/A N/A N/A N/A N/A self functions N/A k N/A insert N/A N/A self index function update N/A True N/A N/A  Insert a new function into the chain at *index*.
         N/A N/A N/A N/A self _funcs insert index function N/A N/A N/A self _add_dep function N/A update N/A N/A N/A N/A self _update N/A remove N/A N/A self function update N/A True N/A N/A  Remove a function from the chain.
         N/A N/A N/A N/A self _funcs remove function N/A N/A N/A self _remove_dep function N/A update N/A N/A N/A N/A self _update N/A definition N/A N/A self obj_names N/A N/A N/A name N/A obj_names N/A self N/A args N/A N/A ,  join N/A N/A %s %s arg N/A arg N/A self args N/A code N/A %s %s(%s) {
 N/A N/A self rtype name args N/A result_index 0 N/A N/A N/A len N/A self args 0 N/A N/A last_rtype void N/A last_result N/A N/A N/A last_rtype last_result N/A N/A N/A self args N/A 0 N/A 2 N/A fn N/A self _funcs N/A N/A N/A last_rtype void N/A N/A args N/A N/A args last_result N/A N/A N/A N/A len N/A fn args 1 N/A last_rtype N/A N/A N/A fn args N/A 0 N/A 0 N/A N/A N/A Exception N/A Cannot chain output '%s' of function to input of '%s' N/A last_rtype N/A fn signature N/A last_rtype N/A fn rtype N/A N/A N/A fn rtype void N/A N/A set_str N/A N/A result_index 1 N/A result N/A result_%d result_index N/A set_str N/A %s %s =  N/A N/A fn rtype result N/A last_result result N/A code N/A     %s%s(%s);
 N/A set_str N/A obj_names N/A fn args N/A N/A N/A self rtype void N/A N/A code N/A     return result_%d;
 result_index N/A code }
 N/A code N/A static_names N/A N/A self N/A N/A N/A N/A N/A __repr__ N/A N/A self N/A N/A N/A fn N/A N/A ,
                 join N/A map repr N/A self functions N/A N/A <FunctionChain [%s] at 0x%x> N/A fn N/A id self N/A N/A StatementList N/A ShaderObject N/A N/A Represents a list of statements. 
     __init__ N/A N/A self N/A N/A N/A N/A self items N/A N/A N/A self order N/A N/A N/A N/A ShaderObject __init__ self N/A add N/A N/A self item position N/A 5 N/A N/A Add an item to the list unless it is already present.
        
        If the item is an expression, then a semicolon will be appended to it
        in the final compiled code.
         N/A N/A item N/A self items N/A N/A N/A N/A N/A self items N/A item position N/A N/A N/A self _add_dep item N/A N/A self order None N/A N/A N/A self changed code_changed True N/A remove N/A N/A self item N/A N/A N/A Remove an item from the list.
         N/A N/A N/A N/A self items pop item N/A N/A N/A self _remove_dep item N/A N/A self order None N/A N/A N/A self changed code_changed True N/A expression N/A N/A self obj_names N/A N/A N/A N/A N/A self order None N/A N/A N/A self order N/A list N/A N/A N/A self items items N/A N/A N/A N/A self order sort key N/A N/A N/A x N/A N/A x N/A 1 N/A code N/A N/A item pos N/A self order N/A N/A code N/A N/A N/A item expression obj_names ;
 N/A code N/A N/A