Skip to content

Commit edf1de4

Browse files
committed
Added vk::present_mode enum for setting the swapchain presentation mode
1 parent f5b3478 commit edf1de4

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

vulkan-cpp/swapchain.cppm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export namespace vk {
4343
.pQueueFamilyIndices = &p_settings.present_index,
4444
.preTransform = m_surface_params.capabilities.currentTransform,
4545
.compositeAlpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR,
46-
.presentMode = VK_PRESENT_MODE_IMMEDIATE_KHR,
46+
.presentMode = static_cast<VkPresentModeKHR>(p_settings.present_mode),
4747
.clipped = true
4848
};
4949

vulkan-cpp/types.cppm

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -472,14 +472,6 @@ export namespace vk {
472472
std::span<const char*> extensions;
473473
};
474474

475-
struct swapchain_params {
476-
uint32_t width;
477-
uint32_t height;
478-
uint32_t present_index = -1;
479-
480-
VkFormat depth; // depth format
481-
};
482-
483475
struct filter_range {
484476
VkFilter min;
485477
VkFilter max;
@@ -661,6 +653,24 @@ export namespace vk {
661653
// VK_COMMAND_POOL_CREATE_FLAG_BITS_MAX_ENUM
662654
};
663655

656+
enum present_mode : uint32_t {
657+
immediate = VK_PRESENT_MODE_IMMEDIATE_KHR,
658+
mailbox_khr = VK_PRESENT_MODE_MAILBOX_KHR,
659+
fifo_khr = VK_PRESENT_MODE_FIFO_KHR,
660+
fifo_relaxed_khr = VK_PRESENT_MODE_FIFO_RELAXED_KHR,
661+
shared_demand_refresh_khr = VK_PRESENT_MODE_SHARED_DEMAND_REFRESH_KHR,
662+
shared_continuous_refresh_khr = VK_PRESENT_MODE_SHARED_CONTINUOUS_REFRESH_KHR
663+
};
664+
665+
struct swapchain_params {
666+
uint32_t width;
667+
uint32_t height;
668+
uint32_t present_index = -1;
669+
670+
uint64_t depth; // depth format
671+
uint32_t present_mode = present_mode::fifo_khr;
672+
};
673+
664674
/**
665675
* @brief settings for specifying command buffers to construct
666676
*

0 commit comments

Comments
 (0)