internal MyVertexInputLayout Append(MyVertexInputComponentType type, int slot = 0, MyVertexInputComponentFreq freq = MyVertexInputComponentFreq.PER_VERTEX) { MyVertexInputComponent component = new MyVertexInputComponent(); component.Type = type; component.Slot = slot; component.Freq = freq; int nextHash = MyHashHelper.Combine(m_hash, component.GetHashCode()); MyVertexInputLayout next; if (m_cached.TryGetValue(nextHash, out next)) { return(next); } next = new MyVertexInputLayout(); next.m_hash = nextHash; next.m_id = m_cached.Count; next.m_components = m_components.Concat(component.Yield()).ToArray(); next.Build(); m_cached[nextHash] = next; return(next); }
static MyVertexInputLayout() { var empty = new MyVertexInputLayout(); empty.Build(); m_cached[0] = empty; InitComponentsMap(); }
internal MyVertexInputLayout Append(MyVertexInputComponentType type, int slot = 0, MyVertexInputComponentFreq freq = MyVertexInputComponentFreq.PER_VERTEX) { MyVertexInputComponent component = new MyVertexInputComponent(); component.Type = type; component.Slot = slot; component.Freq = freq; int nextHash = MyHashHelper.Combine(m_hash, component.GetHashCode()); MyVertexInputLayout next; if(m_cached.TryGetValue(nextHash, out next)) { return next; } next = new MyVertexInputLayout(); next.m_hash = nextHash; next.m_id = m_cached.Count; next.m_components = m_components.Concat(component.Yield()).ToArray(); next.Build(); m_cached[nextHash] = next; return next; }