public ShaderProgram AddFragmentShaderOutput(int colourIndex, string name)
 {
     if (!string.IsNullOrWhiteSpace(name))
     {
         if (FragDataLocation.ContainsKey(colourIndex))
         {
             FragDataLocation[colourIndex] = name;
         }
         else
         {
             FragDataLocation.Add(colourIndex, name);
         }
     }
     return(this);
 }
        public ShaderProgram(ShaderProgram cloneFrom)
        {
            if (cloneFrom == null)
            {
                throw new ArgumentNullException(nameof(cloneFrom));
            }

            if (cloneFrom.ShaderSourceOrFilenames.Count == 0)
            {
                throw new InvalidOperationException($"ShaderProgram: cannot clone from {cloneFrom.Name} due to insufficient shader information");
            }

            Name = cloneFrom.Name;

            foreach (var v in cloneFrom.VariableLocations)
            {
                VariableLocations.Add(v.Key, v.Value);
            }

            foreach (var f in cloneFrom.FragDataLocation)
            {
                FragDataLocation.Add(f.Key, f.Value);
            }

            UsingFilenames = cloneFrom.UsingFilenames;
            foreach (var s in cloneFrom.ShaderSourceOrFilenames)
            {
                ShaderSourceOrFilenames.Add(s);
            }

            if (UsingFilenames)
            {
                InitFromFiles();
            }
            else
            {
                InitFromSource();
            }
        }