public void GetOrCreate(VertexInputLayout layout, out InputLayoutPair currentPassPreviousPair) { lock (Cache) { if (!Cache.TryGetValue(layout, out currentPassPreviousPair)) { currentPassPreviousPair = new InputLayoutPair(layout, ToDispose(new InputLayout(device, Bytecode, layout.InputElements))); Cache.Add(layout, currentPassPreviousPair); } } }
public void GetOrCreate(VertexInputLayout layout, out InputLayoutPair currentPassPreviousPair) { if (!ContextCache.TryGetValue(layout, out currentPassPreviousPair)) { lock (DeviceCache) { if (!DeviceCache.TryGetValue(layout, out currentPassPreviousPair)) { currentPassPreviousPair.InputLayout = new InputLayout(device, Bytecode, layout.InputElements); currentPassPreviousPair.VertexInputLayout = layout; DeviceCache.Add(layout, currentPassPreviousPair); } } ContextCache.Add(layout, currentPassPreviousPair); } }