Пример #1
0
        /// <summary>
        /// Binds the index buffer as the source of index data for following indexed draw commands.
        /// </summary>
        /// <param name="buffer">The index buffer to bind.</param>
        public void BindIndexBuffer(IndexBuffer buffer)
        {
            // Validate
            if (!IsRecording)
            {
                throw new InvalidOperationException("Cannot bind a vertex buffer in a non-recording command recorder");
            }
            if (buffer.IsDisposed)
            {
                throw new ObjectDisposedException(nameof(buffer));
            }

            // Bind index buffer
            var handle = buffer.Handle.Handle;
            var idxt   = (buffer.IndexType == IndexType.Short) ? VkIndexType.Uint16 : VkIndexType.Uint32;

            _cmd !.Cmd.CmdBindIndexBuffer(handle, 0, idxt);
            _boundIndexBuffer = true;
        }