private void Draw() { // update instance data // NOTE: this is called here instead of in `Update` because buffers can only be updated once per frame _instanceBuffer.Update(_positions.AsMemory().Slice(0, _currentParticleCount)); // begin a frame buffer render pass var pass = BeginDefaultPass(Rgba32F.Black); // describe the binding of the buffers var resourceBindings = default(ResourceBindings); resourceBindings.VertexBuffer() = _vertexBuffer; resourceBindings.VertexBuffer(1) = _instanceBuffer; resourceBindings.IndexBuffer = _indexBuffer; // apply the render pipeline and bindings for the render pass pass.ApplyPipeline(_pipeline); pass.ApplyBindings(ref resourceBindings); // apply the mvp matrix to the vertex shader pass.ApplyShaderUniforms(ShaderStageType.VertexStage, ref _modelViewProjectionMatrix); // draw the particles into the target of the render pass pass.DrawElements(24, instanceCount: _currentParticleCount); // end frame buffer render pass pass.End(); }