2#include <vulkan/vulkan.h>
123 VkFormat
findSupportedFormat(
const std::vector<VkFormat>& candidates, VkImageTiling tiling, VkFormatFeatureFlags features);
127 uint32_t
findMemoryType(uint32_t typeFilter, VkMemoryPropertyFlags properties);
146 VkExtent2D
chooseExtent(
const VkSurfaceCapabilitiesKHR& capabilities);
VkRenderPass getRenderPass() const
Gets default render pass for swapchain buffers.
Definition VulkanSwapChain.hpp:54
VkImage depthImage
GPU depth image allocation handle.
Definition VulkanSwapChain.hpp:86
VkSwapchainKHR swapchain
Raw swapchain handle.
Definition VulkanSwapChain.hpp:70
void createFramebuffers()
Creates framebuffers linking image views to the render pass.
Definition VulkanSwapChain.cpp:223
std::vector< VkFramebuffer > framebuffers
framebuffers wrapping image views.
Definition VulkanSwapChain.hpp:76
void cleanup()
Safely destroys framebuffers, render pass, image views, and swapchain handles.
Definition VulkanSwapChain.cpp:32
~VulkanSwapchain()
Destroy the Vulkan Swapchain object and release swapchain structures.
Definition VulkanSwapChain.cpp:6
VkPresentModeKHR choosePresentMode(const std::vector< VkPresentModeKHR > &modes)
Selects optimal presentation mode (e.g. Mailbox or FIFO).
Definition VulkanSwapChain.cpp:262
void createRenderPass()
Configures render pass layouts.
Definition VulkanSwapChain.cpp:162
VulkanSwapchain()=default
Construct a new Vulkan Swapchain object.
VkSurfaceKHR surface
Reference to presentation surface.
Definition VulkanSwapChain.hpp:67
VkFormat findDepthFormat()
Helper to query and select best depth format.
Definition VulkanSwapChain.cpp:337
VkDevice device
Reference to logical device.
Definition VulkanSwapChain.hpp:63
void createImageViews()
Creates image views for each swapchain image.
Definition VulkanSwapChain.cpp:135
VkPhysicalDevice physicalDevice
Reference to physical device.
Definition VulkanSwapChain.hpp:65
void createSwapchain(uint32_t graphicsQueueFamily)
Establishes the KHR swapchain handle.
Definition VulkanSwapChain.cpp:73
VkExtent2D getExtent() const
Gets resolution extent details.
Definition VulkanSwapChain.hpp:44
uint32_t findMemoryType(uint32_t typeFilter, VkMemoryPropertyFlags properties)
Helper to query suitable GPU memory index.
Definition VulkanSwapChain.cpp:359
std::vector< VkImageView > imageViews
image views wrapping swapchain images.
Definition VulkanSwapChain.hpp:74
VkFormat depthFormat
Selected depth format.
Definition VulkanSwapChain.hpp:92
VkExtent2D chooseExtent(const VkSurfaceCapabilitiesKHR &capabilities)
Resolves swapchain resolution boundaries against hardware limits.
Definition VulkanSwapChain.cpp:274
VkRenderPass renderPass
Render pass used for frame clearing and drawing.
Definition VulkanSwapChain.hpp:83
const std::vector< VkFramebuffer > & getFramebuffers() const
Gets active framebuffers list.
Definition VulkanSwapChain.hpp:49
VkFormat getImageFormat() const
Gets selected swapchain format.
Definition VulkanSwapChain.hpp:39
VkFormat imageFormat
image format of swapchain buffers.
Definition VulkanSwapChain.hpp:79
VkImageView depthImageView
Depth image view wrapper.
Definition VulkanSwapChain.hpp:90
VkExtent2D extent
image extent (resolution) of swapchain buffers.
Definition VulkanSwapChain.hpp:81
VkFormat findSupportedFormat(const std::vector< VkFormat > &candidates, VkImageTiling tiling, VkFormatFeatureFlags features)
Helper to find supported depth formats.
Definition VulkanSwapChain.cpp:345
VkSwapchainKHR getSwapchain() const
Gets raw KHR swapchain.
Definition VulkanSwapChain.hpp:59
void initialize(VkDevice device, VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t graphicsQueueFamily)
Sets up parameters, selects formats, builds KHR swapchain, views, render pass and framebuffers.
Definition VulkanSwapChain.cpp:17
VkDeviceMemory depthImageMemory
GPU depth memory handle.
Definition VulkanSwapChain.hpp:88
VkSurfaceFormatKHR chooseSurfaceFormat(const std::vector< VkSurfaceFormatKHR > &formats)
Selects optimal color format and color space.
Definition VulkanSwapChain.cpp:250
std::vector< VkImage > images
Retrieved swapchain images.
Definition VulkanSwapChain.hpp:72
void createDepthResources()
Creates depth buffers and views.
Definition VulkanSwapChain.cpp:285