Пример #1
0
        void buildCommandBuffers()
        {
            dev.WaitIdle();
            cmdPool.Reset();
            for (int i = 0; i < swapChain.ImageCount; ++i)
            {
                PrimaryCommandBuffer cmd = cmds[i];
                FrameBuffer          fb  = frameBuffers[i];

                cmd.Start();

                pipeline.RenderPass.Begin(cmd, fb);

                cmd.SetViewport(fb.Width, fb.Height);
                cmd.SetScissor(fb.Width, fb.Height);
                cmd.BindDescriptorSet(pipeline.Layout, descriptorSet);

                pipeline.Bind(cmd);

                cmd.BindVertexBuffer(vbo, 0);
                cmd.BindIndexBuffer(ibo, VkIndexType.Uint16);
                cmd.DrawIndexed((uint)indices.Length);

                pipeline.RenderPass.End(cmd);

                cmd.End();
            }
        }
Пример #2
0
        void recordDraw(PrimaryCommandBuffer cmd, FrameBuffer fb)
        {
            pipeline.RenderPass.Begin(cmd, fb);

            cmd.SetViewport(fb.Width, fb.Height);
            cmd.SetScissor(fb.Width, fb.Height);

            cmd.BindPipeline(pipeline, descriptorSet);

            cmd.PushConstant(pipeline, textColor);
            cmd.PushConstant(pipeline, outlineColor, 0, 16);

            cmd.BindVertexBuffer(vbo, 0);
            cmd.BindIndexBuffer(ibo, VkIndexType.Uint16);
            cmd.DrawIndexed((uint)ibo.ElementCount, 1, 0, 0, 0);

            pipeline.RenderPass.End(cmd);
        }