Danil S
Danil S

Reputation: 87

Vulkan swapchain format UNORM to SRGB using VK_KHR_swapchain_mutable_format?

Creating swapchain images with wrong format result this obviously:

vkCreateImageView() format VK_FORMAT_B8G8R8A8_UNORM differs from VkImage 
0x40000000004[] format VK_FORMAT_B8G8R8A8_SRGB.  Formats MUST be IDENTICAL unless 
VK_IMAGE_CREATE_MUTABLE_FORMAT BIT was set on image creation.

VK_KHR_swapchain_mutable_format Requires Vulkan 1.0

it result this:

The Vulkan spec states: If flags contains VK_SWAPCHAIN_CREATE_MUTABLE_FORMAT_BIT_KHR 
then the pNext chain must include a VkImageFormatListCreateInfo structure with a viewFormatCount 
greater than zero and pViewFormats must have an element equal to imageFormat 

VkImageFormatListCreateInfo Provided by VK_VERSION_1_2

Question - how Vulkan 1.0 extension require 1.2 structure? (maybe I'm missing something idk)

And as I see on https://vulkan.gpuinfo.org/listextensions.php VK_KHR_swapchain_mutable_format supported only by 60% of Vulkan GPUs... so better write "hand conversion"?

Upvotes: 1

Views: 878

Answers (1)

Nicol Bolas
Nicol Bolas

Reputation: 473447

VkImageFormatListCreateInfo Provided by VK_VERSION_1_2

You linked to the Vulkan 1.2 specification. So of course it cites itself. The extension in question is a core part of 1.2, as is VkImageFormatListCreateInfo.

The actual extension cites another extension:

Requires VK_KHR_image_format_list

Which defines the VkImageFormatListCreateInfoKHR structure used by the swapchain format extension. This structure is of course equivalent to the core 1.2 structure VkImageFormatListCreateInfo, since "image_format_list" was promoted to core in Vulkan 1.2.

Upvotes: 1

Related Questions