Swapchain stores the VkColorSpaceKHR actually used when creating swapchains so users can query the final value

This commit is contained in:
Matthew Pohlmann 2022-07-21 22:39:19 -07:00 committed by Charles Giessen
parent f8573e117c
commit 8d9aea9987
2 changed files with 3 additions and 1 deletions

View File

@ -1852,6 +1852,7 @@ detail::Result<Swapchain> SwapchainBuilder::build() const {
} }
swapchain.device = info.device; swapchain.device = info.device;
swapchain.image_format = surface_format.format; swapchain.image_format = surface_format.format;
swapchain.color_space = surface_format.colorSpace;
swapchain.extent = extent; swapchain.extent = extent;
detail::vulkan_functions().get_device_proc_addr( detail::vulkan_functions().get_device_proc_addr(
info.device, swapchain.internal_table.fp_vkGetSwapchainImagesKHR, "vkGetSwapchainImagesKHR"); info.device, swapchain.internal_table.fp_vkGetSwapchainImagesKHR, "vkGetSwapchainImagesKHR");

View File

@ -752,7 +752,8 @@ struct Swapchain {
VkDevice device = VK_NULL_HANDLE; VkDevice device = VK_NULL_HANDLE;
VkSwapchainKHR swapchain = VK_NULL_HANDLE; VkSwapchainKHR swapchain = VK_NULL_HANDLE;
uint32_t image_count = 0; 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 }; 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. 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. VkPresentModeKHR present_mode = VK_PRESENT_MODE_IMMEDIATE_KHR; // The present mode actually used when creating the swapchain.