Пример #1
0
        /// <summary>
        /// Sets the pipeline object to use for future rendering commands. The new pipeline must match the renderer
        /// and subpass of the pipeline that <see cref="Begin(Pipeline)"/> was called with.
        /// </summary>
        /// <param name="pipeline">The pipeline to bind for future rendering commands.</param>
        public void BindPipeline(Pipeline pipeline)
        {
            // Validate
            if (!IsRecording)
            {
                throw new InvalidOperationException("Cannot bind a pipeline to an inactive command recorder");
            }
            if (BoundPipeline !.RUID == pipeline.RUID)
            {
                return;                 // Same pipeline object, dont re-bind
            }
            if (!ReferenceEquals(BoundRenderer !, pipeline.Renderer) || (BoundSubpass != pipeline.Subpass))
            {
                throw new ArgumentException("Cannot bind incompatible pipeline", nameof(pipeline));
            }

            // Bind the new pipeline
            _cmd !.Cmd.CmdBindPipeline(VkPipelineBindPoint.Graphics, pipeline.Handle);
            BoundPipeline = pipeline;

            // Prepare for new commands
            resetRenderState();
        }