60 const VkSurfaceCapabilitiesKHR& capabilities, GLFWwindow* window);
73 const std::vector<VkSurfaceFormatKHR>& availableFormats);
89 VkPhysicalDevice device, VkSurfaceKHR surface);
255 const std::vector<VkPresentModeKHR>& availablePresentModes);
This initializes, manages and destroys the logical and physical devices(GPU).
void createImageViews()
Creates the image views of the swapchain images.
std::vector< VkImageView > swapChainImageViews
Image views of the swapchain textures(images, aka window)
VkExtent2D swapChainExtent
Dimenisons of the current swapchain.
Chronos::Engine::Device * device
Device to which swapchain needs to be created.
VkSurfaceKHR surface
Surface to which we need to present the swapchain images.
VkPresentModeKHR preferredPresentMode
Preferred present mode for the swapchain.
void create()
Creates the swapchain image resources and chooses the optimal settings for given hardware.
VkImageView colorImageView
image view of the color attachement
VkFormat swapChainImageFormat
Chosen swapchain image format.
VkDeviceMemory colorImageMemory
Memory to store the color image.
VkImage colorImage
The color image.
void cleanup()
Cleans up the assets that are rendered invalid during MSAA changes or swapchain.
std::vector< VkImage > swapChainImages
Swapchaim images to render and present to.
GLFWwindow * window
The window to present the surface to.
VkSwapchainKHR swapChain
Vulkan swapchain object.
void recreate()
When the swapchain is rendered invalid, recreate it.
void init(Chronos::Engine::Device *device, VkSurfaceKHR surface, GLFWwindow *window)
Initilize the swapchain.
void createColorResources()
Creates the color images along with the associated objects.
VkPresentModeKHR chooseSwapPresentMode(const std::vector< VkPresentModeKHR > &availablePresentModes)
From the available present mode, this chooses the the best present mode.
void changeMsaa()
Changes the MSAA count of the swapchain images.
Contains the Device class.
VkExtent2D chooseSwapExtent(const VkSurfaceCapabilitiesKHR &capabilities, GLFWwindow *window)
Gets the maximum extent of the swapchain images(framebuffer size).
VkSurfaceFormatKHR chooseSwapSurfaceFormat(const std::vector< VkSurfaceFormatKHR > &availableFormats)
Chooses the best present mode among the supported modes.
SwapChainSupportDetails querySwapChainSupport(VkPhysicalDevice device, VkSurfaceKHR surface)
For a given swapchain mode, it gets the capabilites, formats and present modes.
Contains the fields to the support details of a physical device.
VkSurfaceCapabilitiesKHR capabilities
std::vector< VkSurfaceFormatKHR > formats
std::vector< VkPresentModeKHR > presentModes