Example #1
0
 public FrameBuffer(GraphicsDevice device, RenderPass renderPass, DepthStencil depthStencil, Swapchain swapchain, uint swapchainImageIndex)
 {
     this.device              = device;
     this.renderPass          = renderPass;
     this.depthStencil        = depthStencil;
     this.swapchain           = swapchain;
     this.swapchainImageIndex = swapchainImageIndex;
     Setup();
 }
Example #2
0
        /// <summary>
        /// Must be called outside of a renderpass scope.
        /// </summary>
        /// <param name="depthStencil"></param>
        /// <param name="clearValue"></param>
        public void ClearDepthStencil(DepthStencil depthStencil, VkClearDepthStencilValue clearValue)
        {
            CheckBegun();
            CheckNotInRenderPass();
            VkImageSubresourceRange imageRange = new VkImageSubresourceRange();

            imageRange.aspectMask = VkImageAspectFlags.Depth;
            imageRange.levelCount = 1;
            imageRange.layerCount = 1;

            vkCmdClearDepthStencilImage(vkCmd, depthStencil.vkImage, VkImageLayout.General, &clearValue, 1, &imageRange);
        }
        public void SetupFrameBuffersAndRenderPass()
        {
            depthStencil           = new DepthStencil(this, mainSwapchain);
            startOfFrameRenderPass = RenderPass.ClearTargetsPass(this, mainSwapchain);
            renderPass             = RenderPass.Default(this, mainSwapchain);
            presentRenderPass      = RenderPass.Present(this, mainSwapchain);
            singlePass             = RenderPass.Single(this, mainSwapchain);

            pipelineCache = new PipelineCache(this);

            uint buffercount = mainSwapchain.vkSwapchain.Buffers.Count;

            frameBuffers = new FrameBuffer[buffercount];
            for (uint i = 0; i < buffercount; i++)
            {
                frameBuffers[i] = new FrameBuffer(this, startOfFrameRenderPass, depthStencil, mainSwapchain, i);
            }
        }