public bool ReloadIfContains(ReloadableShader shader)
 {
     var contains = this.shaders.Contains(shader);
     if (!contains)
         return false;
     this.Reload();
     return true;
 }
Example #2
0
        public void Add(ReloadableShader shader, string name)
        {
            if(this.shaderNames.ContainsKey(shader))
                throw new ArgumentException(string.Format("Shader already known by name '{0}'.", this.shaderNames[shader]));

            var dict = this.shaders[shader.Type];
            dict.Add(name, shader); // will throw if name already taken

            this.shaderNames.Add(shader, name);
        }
Example #3
0
 public ProgramBuilder With(ReloadableShader shader)
 {
     this.shaders.Add(shader);
     return this;
 }
Example #4
0
 private bool tryReloadShader(ReloadableShader shader)
 {
     try
     {
         return shader.TryReload();
     }
     catch (Exception e)
     {
         // reloading shader failed, probably invalid file or code
     }
     return false;
 }