示例#1
0
        void CreateImageViews()
        {
            if (swapchainImageViews != null)
            {
                foreach (var iv in swapchainImageViews)
                {
                    VK.DestroyImageView(device, iv, alloc);
                }
            }
            swapchainImageViews = new List <VkImageView>(swapchainImages.Count);

            foreach (var image in swapchainImages)
            {
                var info = new VkImageViewCreateInfo();
                info.sType        = CSGL.Vulkan.VkStructureType.ImageViewCreateInfo;
                info.image        = image;
                info.viewType     = CSGL.Vulkan.VkImageViewType._2D;
                info.format       = swapchainImageFormat;
                info.components.r = CSGL.Vulkan.VkComponentSwizzle.Identity;
                info.components.g = CSGL.Vulkan.VkComponentSwizzle.Identity;
                info.components.b = CSGL.Vulkan.VkComponentSwizzle.Identity;
                info.components.a = CSGL.Vulkan.VkComponentSwizzle.Identity;
                info.subresourceRange.aspectMask     = CSGL.Vulkan.VkImageAspectFlags.ColorBit;
                info.subresourceRange.baseMipLevel   = 0;
                info.subresourceRange.levelCount     = 1;
                info.subresourceRange.baseArrayLayer = 0;
                info.subresourceRange.layerCount     = 1;

                VkImageView temp;
                var         result = VK.CreateImageView(device, ref info, alloc, out temp);
                swapchainImageViews.Add(temp);
            }
        }