Example #1
0
        /// <summary>
        /// Draw multiple instances of a number of vertices using the bound vertex buffer(s).
        /// </summary>
        /// <param name="vertexCount">The number of vertices to draw.</param>
        /// <param name="instanceCount">The number of instances to draw.</param>
        /// <param name="firstVertex">The index of the first vertex to draw.</param>
        /// <param name="firstInstance">The index of the first instance to draw.</param>
        public void DrawInstanced(uint vertexCount, uint instanceCount, uint firstVertex = 0, uint firstInstance = 0)
        {
            // Validate
            if (!IsRecording)
            {
                throw new InvalidOperationException("Cannot draw in a non-recording command recorder");
            }
            if (_vertexBufferCount != BoundPipeline !.VertexBindingCount)
            {
                throw new InvalidOperationException("Vertex buffers not fully bound in command recorder");
            }

            updateBindings();

            // Record
            _cmd !.Cmd.CmdDraw(vertexCount, instanceCount, firstVertex, firstInstance);
        }