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); } }
public void Dispose() { VK.DestroySemaphore(device, imageAvailableSemaphore, alloc); VK.DestroySemaphore(device, renderFinishedSemaphore, alloc); VK.DestroyCommandPool(device, commandPool, alloc); foreach (var fb in swapchainFramebuffers) { VK.DestroyFramebuffer(device, fb, alloc); } VK.DestroyPipeline(device, pipeline, alloc); VK.DestroyPipelineLayout(device, pipelineLayout, alloc); VK.DestroyRenderPass(device, renderPass, alloc); foreach (var iv in swapchainImageViews) { VK.DestroyImageView(device, iv, alloc); } destroySwapchain(device, swapchain, alloc); VK.DestroyDevice(device, alloc); destroySurface(instance, surface, alloc); VK.DestroyInstance(instance, alloc); GLFW.Terminate(); }