/// <summary> /// Function to retrieve a copy of this buffer as a staging resource. /// </summary> /// <returns>The staging buffer to retrieve.</returns> public GorgonIndexBuffer GetStaging() { var buffer = new GorgonIndexBuffer(Graphics, new GorgonIndexBufferInfo(_info, $"{Name}_Staging") { Binding = VertexIndexBufferBinding.None, Usage = ResourceUsage.Staging }); CopyTo(buffer); return(buffer); }
/// <summary> /// Function to assign an index buffer to the draw call. /// </summary> /// <param name="buffer">The buffer to assign.</param> /// <param name="indexStart">[Optional] The first index in the index buffer to render.</param> /// <param name="indexCountPerInstance">[Optional] The number of indices to render, per instance.</param> /// <returns>The fluent builder interface.</returns> /// <exception cref="ArgumentOutOfRangeException">Thrown when the <paramref name="indexStart"/> parameter is less than 0. /// <para>-or-</para> /// <para>Thrown when the <paramref name="indexCountPerInstance"/> parameter is less than 1.</para> /// </exception> public GorgonInstancedIndexCallBuilder IndexBuffer(GorgonIndexBuffer buffer, int indexStart = 0, int?indexCountPerInstance = null) { if (indexStart < 0) { throw new ArgumentOutOfRangeException(nameof(indexStart), Resources.GORGFX_ERR_INDEX_TOO_SMALL); } if ((indexCountPerInstance != null) && (indexCountPerInstance < 1)) { throw new ArgumentOutOfRangeException(nameof(indexCountPerInstance), Resources.GORGFX_ERR_INDEX_COUNT_TOO_SMALL); } DrawCall.IndexStart = indexStart; DrawCall.IndexCountPerInstance = indexCountPerInstance ?? 0; DrawCall.IndexBuffer = buffer; return(this); }