From 8d9aea99870dc9f10efee69aab33da838f5733cd Mon Sep 17 00:00:00 2001 From: Matthew Pohlmann Date: Thu, 21 Jul 2022 22:39:19 -0700 Subject: [PATCH] Swapchain stores the VkColorSpaceKHR actually used when creating swapchains so users can query the final value --- src/VkBootstrap.cpp | 1 + src/VkBootstrap.h | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/VkBootstrap.cpp b/src/VkBootstrap.cpp index 29910e3..9d2a4c8 100644 --- a/src/VkBootstrap.cpp +++ b/src/VkBootstrap.cpp @@ -1852,6 +1852,7 @@ detail::Result SwapchainBuilder::build() const { } swapchain.device = info.device; swapchain.image_format = surface_format.format; + swapchain.color_space = surface_format.colorSpace; swapchain.extent = extent; detail::vulkan_functions().get_device_proc_addr( info.device, swapchain.internal_table.fp_vkGetSwapchainImagesKHR, "vkGetSwapchainImagesKHR"); diff --git a/src/VkBootstrap.h b/src/VkBootstrap.h index 1d24f15..b48fdc8 100644 --- a/src/VkBootstrap.h +++ b/src/VkBootstrap.h @@ -752,7 +752,8 @@ struct Swapchain { VkDevice device = VK_NULL_HANDLE; VkSwapchainKHR swapchain = VK_NULL_HANDLE; uint32_t image_count = 0; - VkFormat image_format = VK_FORMAT_UNDEFINED; + VkFormat image_format = VK_FORMAT_UNDEFINED; // THe image format actually used when creating the swapchain. + VkColorSpaceKHR color_space = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR; // The color space actually used when creating the swapchain. VkExtent2D extent = { 0, 0 }; uint32_t requested_min_image_count = 0; // The value of minImageCount actually used when creating the swapchain; note that the presentation engine is always free to create more images than that. VkPresentModeKHR present_mode = VK_PRESENT_MODE_IMMEDIATE_KHR; // The present mode actually used when creating the swapchain.