unsafe public static void UpdateVertexBuffer <T>(ID3D11DeviceContext context, ID3D11Buffer buffer, int slot, T data) where T : struct { MappedSubresource mappedResource = context.Map(buffer, MapMode.WriteDiscard, MapFlags.None); Unsafe.Write((void *)mappedResource.DataPointer, data); context.Unmap(buffer); context.VSSetConstantBuffer(slot, buffer); }