Vulkan swapchain systems

This section documents the swapchain systems found in swapchain objects created for Vulkan renderers, and their associated functions.


Types

Objects

typedef struct TLVK_SwapchainSystem_t TLVK_SwapchainSystem_t

A renderer system to hold Vulkan-specific swapchain data.

This structure holds data for a Vulkan swapchain.

Descriptors

struct TLVK_SwapchainSystemDescriptor_t

Descriptor struct to configure the creation of a Thallium swapchain system for Vulkan.

This descriptor structure provides options for the creation of Vulkan swapchains via Thallium Vulkan swapchain systems.

Public Members

TL_Extent2D_t resolution

Resolution of images in the swapchain. Both values must be above 0 in this struct. If you are specifying this descriptor as an add-on to a TL_SwapchainDescriptor_t (i.e. calling TL_SwapchainCreate()), then setting this will override the resolution specified to that descriptor - keeping this zero-initialised will use the resolution specified to that descriptor.

VkSurfaceKHR vk_surface

NULL or a Vulkan surface to use in swapchain creation. If this is NULL, a surface will be created based on the specified Thallium window surface (i.e. platform window handles). Otherwise, that window will be disregarded and this surface will be directly used instead.

VkSurfaceFormatKHR vk_surface_format

Explicit surface format to use in swapchain creation. To automatically select surface format (which is default behaviour), set the format member of this struct to -1.

VkPresentModeKHR vk_present_mode

Explicit presentation mode to use in swapchain creation. To automatically select optimal present mode (which is default behaviour), set this to -1.


Functions

TLVK_SwapchainSystem_t *TLVK_SwapchainSystemCreate(const TLVK_RendererSystem_t *const renderer_system, const TLVK_SwapchainSystemDescriptor_t descriptor, const TL_WindowSurface_t *const window_surface)

Create and return a heap-allocated swapchain system with Vulkan swapchain data.

This function creates a new Vulkan swapchain system, including its Vulkan swapchain object and returns it. If there were any errors in creation, NULL will be returned instead.

See also

TLVK_SwapchainSystem_t

Note

The parent renderer of the given Thallium renderer system renderer_system must have been created with the presentation feature.

Note

The window_surface parameter can be NULL only if a Vulkan surface is directly supplied to descriptor.vk_surface - otherwise, this parameter must be a valid Thallium window surface object, in which case a new Vulkan surface will be created and stored by the swapchain.

Parameters:
  • renderer_system – a valid Thallium Vulkan renderer system object

  • descriptor – a Thallium Vulkan swapchain system descriptor

  • window_surface – a Thallium window surface object (can conditionally be NULL - see note above)

Returns:

The new swapchain system

void TLVK_SwapchainSystemDestroy(TLVK_SwapchainSystem_t *const swapchain_system)

Free the given Thallium Vulkan swapchain system object.

This function frees the specified swapchain system object.

See also

TLVK_SwapchainSystem_t

Parameters:
  • swapchain_system – Pointer to the Thallium Vulkan swapchain system to free.