void ClearCache() { if (layout != null) { layout.Dispose(); layout = null; } if (outLayout != null) { outLayout.Dispose(); outLayout = null; } }
/// <summary> /// Binds input layout to device. /// </summary> /// <param name="device"></param> public void BindInputLayout([NotNull] GraphicsDevice device) { lock (syncRoot) { if (layout == null) { VertexBindingElement[] elements = new VertexBindingElement[vertexBuffers.Count]; for (int i = 0; i < vertexBuffers.Count; i++) { VertexBindingElement element = new VertexBindingElement(); element.Format = vertexBuffers[i].Format; element.UpdateFrequency = vertexBuffers[i].UpdateFrequency; element.UpdateFrequencyCount = vertexBuffers[i].UpdateFrequencyCount; // Copy the element to array. elements[i] = element; } layout = device.DriverDevice.CreateVertexBinding(elements); } } }