コード例 #1
0
        private void createDepthResources(VkContext context)
        {
            var depthFormat = VkHelper.FindDepthFormat(context);
            var depthImage  = VkHelper.CreateImage(context,
                                                   this.wrapper.Extent.Width, this.wrapper.Extent.Height,
                                                   depthFormat, Vk.ImageTiling.Optimal, Vk.ImageUsageFlags.DepthStencilAttachment,
                                                   Vk.MemoryPropertyFlags.DeviceLocal);

            var depthImageView = VkHelper.CreateImageView(context, depthImage.Image, depthFormat,
                                                          Vk.ImageAspectFlags.Depth);

            context.TransitionImageLayout(depthImage.Image, depthFormat, Vk.ImageLayout.Undefined,
                                          Vk.ImageLayout.DepthStencilAttachmentOptimal);

            this.wrapper.DepthImage       = depthImage.Image;
            this.wrapper.DepthImageMemory = depthImage.Memory;
            this.wrapper.DepthImageView   = depthImageView;
        }