Ejemplo n.º 1
0
 /// <summary>
 /// Insert a variable reference
 /// </summary>
 /// <param name="variable">the variable</param>
 /// <param name="expression">the reference</param>
 public void InsertVariable(Variable variable, ExpressionNodeCouple expression)
 {
     if (!VariablesReferences.ContainsKey(variable))
     {
         VariablesReferences.Add(variable, new HashSet <ExpressionNodeCouple>());
     }
     VariablesReferences[variable].Add(expression);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Insert a variable reference
        /// </summary>
        /// <param name="variable">the variable</param>
        /// <param name="expression">the reference</param>
        public void InsertVariable(Variable variable, ExpressionNodeCouple expression)
        {
            if (!VariablesReferences.ContainsKey(variable))
            {
                VariablesReferences.Add(variable, new HashSet <ExpressionNodeCouple>());
            }

            // Also add all the variables in that buffer so that they are not removed
            var cbuffer = (ConstantBuffer)variable.GetTag(StrideTags.ConstantBuffer);

            if (cbuffer != null)
            {
                foreach (var otherVariable in cbuffer.Members.OfType <Variable>())
                {
                    if (!VariablesReferences.ContainsKey(otherVariable))
                    {
                        VariablesReferences.Add(otherVariable, new HashSet <ExpressionNodeCouple>());
                    }
                }
            }

            VariablesReferences[variable].Add(expression);
        }