Swapchains

This section describes the use of high-level, cross-API swapchain objects.


Types

Objects

typedef struct TL_Swapchain_t TL_Swapchain_t

A structure to represent a graphical swapchain.

This opaque structure provides a representation of a swapchain object.

Descriptors

struct TL_SwapchainDescriptor_t

A structure describing a swapchain object to be created.

This structure describes a swapchain object to be created.

Public Members

TL_Extent2D_t resolution

Resolution of images in the swapchain.

TL_WindowSurface_t *window_surface

A Thallium window surface object.

void *swapchain_system_descriptor

NULL or an optional descriptor for the API-specific swapchain system to be created within the swapchain. For example, to specify API-specific options to a Vulkan swapchain system, pass to this parameter a pointer to a TLVK_SwapchainSystemDescriptor_t struct.


Functions

TL_Swapchain_t *TL_SwapchainCreate(const TL_Renderer_t *const renderer, const TL_SwapchainDescriptor_t descriptor)

Create and return a new Thallium swapchain object for use with the given renderer.

This function creates and returns a new Thallium swapchain object for use with the given Thallium renderer object renderer.

Using the resultant swapchain with a different renderer will likely result in errors. Also note that swapchain objects are mostly immutable. You cannot modify a swapchain for use with a different renderer, you must create a new one instead.

See also

TL_Swapchain_t

Parameters:
  • renderer – Renderer to create the swapchain for.

  • descriptor – A swapchain descriptor struct.

Returns:

The new swapchain

void TL_SwapchainDestroy(TL_Swapchain_t *const swapchain)

Free the given swapchain object.

This function frees the specified swapchain object.

Parameters:
  • swapchain – Pointer to the swapchain object to free.