public void EnsureType(ShaderElementType expect) { if (Type != expect) { throw new TypeMismatchException(expect, Type); } }
internal ShaderAttribute(string name, ShaderElementType type, int loc) { if (string.IsNullOrWhiteSpace(name)) { throw new ArgumentNullException(nameof(name)); } Name = name; Type = type ?? throw new ArgumentNullException(nameof(type)); _location = loc; }
internal Uniform(string nm, ShaderElementType t, int loc) { if (string.IsNullOrWhiteSpace(nm)) { throw new ArgumentNullException(nameof(nm)); } Name = nm; _location = loc; Type = t ?? throw new ArgumentNullException(nameof(t)); }
public TypeMismatchException(ShaderElementType e, ShaderElementType g) : base($"Expected type '{e}', got '{g}'!") { ExpectedType = e ?? throw new ArgumentNullException(nameof(e)); GivenType = g ?? throw new ArgumentNullException(nameof(g)); }