TGUI 1.14-dev
Loading...
Searching...
No Matches
tgui::SwapchainVulkan Class Reference

Public Member Functions

 SwapchainVulkan (std::shared_ptr< BackendRendererVulkan > renderer, VkSurfaceKHR surface)
 Constructor.
 ~SwapchainVulkan ()
 Destructor.
 SwapchainVulkan (const SwapchainVulkan &)=delete
SwapchainVulkan & operator= (const SwapchainVulkan &)=delete
VkCommandBuffer beginFrame (Vector2u framebufferSize, Color clearColor)
 Starts a new frame.
void endFrame ()
 Ends the render pass, submits the command buffer and presents the frame.
VkRenderPass getRenderPass () const
 Returns the render pass that is started by beginFrame.
VkFormat getColorFormat () const
 Returns the format of the swapchain images.
bool isSurfaceLost () const
 Returns whether the surface was lost and the swapchain can no longer be used.

Static Public Attributes

static constexpr std::uint32_t FramesInFlight = 2

Constructor & Destructor Documentation

◆ SwapchainVulkan()

tgui::SwapchainVulkan::SwapchainVulkan ( std::shared_ptr< BackendRendererVulkan > renderer,
VkSurfaceKHR surface )

Constructor.

Parameters
rendererRenderer that holds the Vulkan device
surfaceSurface of the window. Ownership is transferred, the destructor will destroy the surface.
Exceptions
Exceptionwhen the queue of the renderer can't present to the surface or when an object couldn't be created

Member Function Documentation

◆ beginFrame()

VkCommandBuffer tgui::SwapchainVulkan::beginFrame ( Vector2u framebufferSize,
Color clearColor )
nodiscard

Starts a new frame.

Parameters
framebufferSizeSize of the window in pixels
clearColorColor to clear the window with
Returns
Command buffer in which a render pass was started, or VK_NULL_HANDLE if nothing can be rendered now (e.g. because the window is minimized). The endFrame function must only be called when the returned command buffer wasn't VK_NULL_HANDLE.

◆ getColorFormat()

VkFormat tgui::SwapchainVulkan::getColorFormat ( ) const
nodiscard

Returns the format of the swapchain images.

Returns
Color format of the attachment in the render pass

◆ getRenderPass()

VkRenderPass tgui::SwapchainVulkan::getRenderPass ( ) const
nodiscard

Returns the render pass that is started by beginFrame.

Returns
Render pass, which remains the same during the lifetime of this object

◆ isSurfaceLost()

bool tgui::SwapchainVulkan::isSurfaceLost ( ) const
nodiscard

Returns whether the surface was lost and the swapchain can no longer be used.

Returns
True when the surface was lost, in which case a new object has to be created with a new surface

This happens on Android when the app is put in the background, as the window surface is destroyed then.


The documentation for this class was generated from the following file: