Hello guys,
recently I’ve started studying again and because I always wanted to program games, I’ve decided to choose Vulkan as the topic of my thesis to learn something about graphics etc. I went through the tutorials available and briefly read the spec and now I’m working on my own code. At the moment I’m trying to understand the swapchain creation and I’m stuck at the following things:
VkSwapchainCreateFlagsKHR flags: the current spec (1.1.98) defines several flags
- VK_SWAPCHAIN_CREATE_SPLIT_INSTANCE_BIND_REGIONS_BIT_KHR
- VK_SWAPCHAIN_CREATE_PROTECTED_BIT_KHR
The spec discusses only the MUTABLE bit.
Regarding the first flag, I’ve no clue what that means. It appears to me like several physical devices can split the job and work on a single image, where each part of the image is dedicated to one device. But that’s just my guess, as the spec it to abstract for me in this case.
I went through the spec and the protected bit is related to some memory protection, but I’m missing the background, why is that, what’s the usage or requirement for such functionality? I was not able to find anything in the appendix.
uint32_t minImageCount and VK_PRESENT_MODE_FIFO_KHR:
The VkSurfaceCapabilitiesKHR structure holds minImageCount and maxImageCount.
The spec says:
minImageCount is the minimum number of images the specified device supports for a swapchain created for the surface, and will be at least one.
maxImageCount is the maximum number of images the specified device supports for a swapchain created for the surface, and will be either 0, or greater than or equal to minImageCount.
So the spec allows to have minImageCount = maxImageCount = 1. However the spec also guarantees to support the VK_PRESENT_MODE_FIFO_KHR, which requires for its functionality at least 2 images (double buffering) in the swapchain, right?
VkFormat imageFormat vs VkColorSpaceKHR imageColorSpace:
Different types/different names, but same thing?
I understand that we need to
specify the color space of the surface/display and color space of the images, so the driver can perform transformations from the image color space to the display color space.
So why are there two different naming conventions?
Ideally these “formats” should be the same, but from what I read it’s inconvenient to use sRGB for any computations (color addition/subtraction; non-linear operations), while for
presenting its the way how display works and presents the colors, right?
Another thing is the newly introduced option MUTABLE, which allows to have different format of the swapchain images and image views. I thought one would prefer to stick to one format instead of multiple formats.
One thing I can imagine is, that the surface supports only a limited format/color space pairs which is inconvenient for the use case, so this is another way how to work
with format you want. Em I right?
VkImageUsageFlags imageUsage:
For the swapchain the only meaningful flag is the VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, isn’t it?
Thank you for your help,
Renegade