15 #include <vsg/state/ImageView.h>
16 #include <vsg/vk/Fence.h>
17 #include <vsg/vk/Surface.h>
24 VkSurfaceCapabilitiesKHR capabilities;
25 std::vector<VkSurfaceFormatKHR> formats;
26 std::vector<VkPresentModeKHR> presentModes;
29 extern VSG_DECLSPEC
SwapChainSupportDetails querySwapChainSupport(VkPhysicalDevice device, VkSurfaceKHR surface);
30 extern VSG_DECLSPEC VkSurfaceFormatKHR selectSwapSurfaceFormat(
const SwapChainSupportDetails& details, VkSurfaceFormatKHR preferredSurfaceFormat = {VK_FORMAT_B8G8R8A8_UNORM, VK_COLOR_SPACE_SRGB_NONLINEAR_KHR});
31 extern VSG_DECLSPEC VkExtent2D selectSwapExtent(
const SwapChainSupportDetails& details, uint32_t width, uint32_t height);
32 extern VSG_DECLSPEC VkPresentModeKHR selectSwapPresentMode(
const SwapChainSupportDetails& details, VkPresentModeKHR preferredPresentMode = VK_PRESENT_MODE_MAILBOX_KHR);
37 uint32_t imageCount = 3;
38 VkSurfaceFormatKHR surfaceFormat = {VK_FORMAT_B8G8R8A8_UNORM, VK_COLOR_SPACE_SRGB_NONLINEAR_KHR};
39 VkPresentModeKHR presentMode = VK_PRESENT_MODE_FIFO_KHR;
40 VkImageUsageFlags imageUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
49 operator VkSwapchainKHR()
const {
return _swapchain; }
50 VkSwapchainKHR vk()
const {
return _swapchain; }
52 VkFormat getImageFormat()
const {
return _format; }
54 const VkExtent2D& getExtent()
const {
return _extent; }
56 ImageViews& getImageViews() {
return _imageViews; }
57 const ImageViews& getImageViews()
const {
return _imageViews; }
67 VkSwapchainKHR _swapchain;
70 ImageViews _imageViews;
74 constexpr
bool operator==(
const VkExtent2D& lhs,
const VkExtent2D& rhs)
76 return lhs.width == rhs.width && lhs.height == rhs.height;
79 constexpr
bool operator!=(
const VkExtent2D& lhs,
const VkExtent2D& rhs)
81 return lhs.width != rhs.width || lhs.height != rhs.height;
Device encapsulates VkDevice, a logical handle to the PhysicalDevice with capabilities specified duri...
Definition: Device.h:37
Definition: PhysicalDevice.h:23
Surface encapsulates VkSurfaceKHR.
Definition: Surface.h:22
Swapchain encapsulates vkSwapchainKHR.
Definition: Swapchain.h:45
VkResult acquireNextImage(uint64_t timeout, ref_ptr< Semaphore > semaphore, ref_ptr< Fence > fence, uint32_t &imageIndex)
call vkAcquireNextImageKHR
struct for holding available swapchain capabilities available on device
Definition: Swapchain.h:23
Swapchain preferences passed via WindowTraits::swapchainPreferences to guide swapchain creation assoc...
Definition: Swapchain.h:36