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

            var shadersOfType = shaders[shader.Type];

            shadersOfType.Add(name, shader); // will throw if name already taken

            shaderNames.Add(shader, name);
        }
示例#3
0
 public ProgramBuilder With(ReloadableShader shader)
 {
     shaders.Add(shader);
     return(this);
 }
 public bool ReloadIfContains(ReloadableShader shader)
 {
     return(reloadIf(Shaders.Contains(shader)));
 }
示例#5
0
 public ProgramBuilder With(ReloadableShader shader)
 {
     this.shaders.Add(shader);
     return this;
 }
示例#6
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);
        }
示例#7
0
 private bool tryReloadShader(ReloadableShader shader)
 {
     try
     {
         return shader.TryReload();
     }
     catch (Exception e)
     {
         // reloading shader failed, probably invalid file or code
     }
     return false;
 }