예제 #1
0
        public void buildCommandBuffers(PrimaryCommandBuffer cmd)
        {
            renderPass.Begin(cmd, frameBuffer);

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

            cmd.BindDescriptorSet(gBuffPipeline.Layout, dsMain);

            envCube.RecordDraw(cmd);

            renderPass.BeginSubPass(cmd);

            if (model != null)
            {
                gBuffPipeline.Bind(cmd);
                model.Bind(cmd);
                model.DrawAll(cmd, gBuffPipeline.Layout);
            }

            renderPass.BeginSubPass(cmd);

            //cmd.BindDescriptorSet (composePipeline.Layout, dsMain);
            cmd.BindDescriptorSet(composePipeline.Layout, dsGBuff, 1);

            if (currentDebugView == DebugView.none)
            {
                composePipeline.Bind(cmd);
            }
            else
            {
                debugPipeline.Bind(cmd);
                uint debugValue = (uint)currentDebugView - 1;
                if (currentDebugView == DebugView.shadowMap)
                {
                    debugValue += (uint)((lightNumDebug << 8));
                }
                else
                {
                    debugValue += (uint)((debugFace << 8) + (debugMip << 16));
                }
                cmd.PushConstant(debugPipeline.Layout, VkShaderStageFlags.Fragment, debugValue, (uint)Marshal.SizeOf <Matrix4x4> ());
            }

            cmd.Draw(3, 1, 0, 0);

            //renderPass.BeginSubPass (cmd);
            //toneMappingPipeline.Bind (cmd);
            //cmd.Draw (3, 1, 0, 0);

            renderPass.End(cmd);
        }
예제 #2
0
 public void RecordDraw(PrimaryCommandBuffer cmd)
 {
     cmd.BindDescriptorSet(Layout, dsMain);
     envCube.RecordDraw(cmd);
     drawModel(cmd);
 }