/// <summary>
        /// Adds a layout (or replaces it) at specified index. May not add out of range.
        /// </summary>
        /// <param name="index">The index of layout.</param>
        /// <param name="layout">Constant buffer layout.</param>
        public void AddLayout(uint index, [NotNull] ConstantBufferLayout layout)
        {
            if (index > layouts.Count)
            {
                throw new IndexOutOfRangeException("Cannot add at index out of range.");
            }

            if (layouts.Count == index)
            {
                layouts.Add(layout);
            }
            else
            {
                layouts[(int)index] = layout;
            }
        }
 /// <summary>
 /// Appends a layout. Index of buffer is returned.
 /// </summary>
 /// <param name="layout">The layout.</param>
 public uint AppendLayout([NotNull] ConstantBufferLayout layout)
 {
     layouts.Add(layout);
     return((uint)(layouts.Count - 1));
 }