internal static MyMaterialShadersBundleId Get(MyStringId material, MyStringId materialPass, VertexLayoutId vertexLayout, MyShaderUnifiedFlags flags) { int hash = 0; MyHashHelper.Combine(ref hash, material.GetHashCode()); MyHashHelper.Combine(ref hash, materialPass.GetHashCode()); MyHashHelper.Combine(ref hash, vertexLayout.GetHashCode()); MyHashHelper.Combine(ref hash, unchecked ((int)flags)); if (HashIndex.ContainsKey(hash)) { return(HashIndex[hash]); } var id = new MyMaterialShadersBundleId { Index = BundleInfo.Allocate() }; MyArrayHelpers.Reserve(ref Bundles, id.Index + 1); HashIndex[hash] = id; BundleInfo.Data[id.Index] = new MyMaterialShadersInfo { Material = material, Pass = materialPass, Layout = vertexLayout, Flags = flags }; Bundles[id.Index] = new MyMaterialShadersBundle { }; InitBundle(id); return(id); }
public override int GetHashCode() { return((int)((((uint)TypeId.GetHashCode()) << 16) ^ ((uint)SubtypeId.GetHashCode()))); }
internal static MyMaterialShadersBundleId Get(MyStringId material, MyStringId materialPass, VertexLayoutId vertexLayout, MyShaderUnifiedFlags flags) { int hash = 0; MyHashHelper.Combine(ref hash, material.GetHashCode()); MyHashHelper.Combine(ref hash, materialPass.GetHashCode()); MyHashHelper.Combine(ref hash, vertexLayout.GetHashCode()); MyHashHelper.Combine(ref hash, unchecked((int)flags)); if(HashIndex.ContainsKey(hash)) { return HashIndex[hash]; } var id = new MyMaterialShadersBundleId { Index = BundleInfo.Allocate() }; MyArrayHelpers.Reserve(ref Bundles, id.Index + 1); HashIndex[hash] = id; BundleInfo.Data[id.Index] = new MyMaterialShadersInfo { Material = material, Pass = materialPass, Layout = vertexLayout, Flags = flags }; Bundles[id.Index] = new MyMaterialShadersBundle { }; InitBundle(id); return id; }