public bool ReloadIfContains(ReloadableShader shader) { var contains = this.shaders.Contains(shader); if (!contains) return false; this.Reload(); return true; }
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); }
public ProgramBuilder With(ReloadableShader shader) { shaders.Add(shader); return(this); }
public bool ReloadIfContains(ReloadableShader shader) { return(reloadIf(Shaders.Contains(shader))); }
public ProgramBuilder With(ReloadableShader shader) { this.shaders.Add(shader); return this; }
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); }
private bool tryReloadShader(ReloadableShader shader) { try { return shader.TryReload(); } catch (Exception e) { // reloading shader failed, probably invalid file or code } return false; }