Class SwapChain#

Inheritance Relationships#

Derived Type#

Class Documentation#

class SwapChain#

Subclassed by TRAP::Graphics::API::VulkanSwapChain

Public Functions

virtual ~SwapChain()#

Destructor.

consteval SwapChain(const SwapChain&) noexcept = delete#

Copy constructor.

consteval SwapChain &operator=(const SwapChain&) noexcept = delete#

Copy assignment operator.

constexpr SwapChain(SwapChain&&) noexcept = default#

Move constructor.

SwapChain &operator=(SwapChain&&) noexcept = default#

Move assignment operator.

virtual std::optional<u32> AcquireNextImage(Semaphore &signalSemaphore, Fence &fence) const = 0#

Acquire the next presentable image from the swapchain to render to.

Parameters:
  • signalSemaphoreSemaphore to signal when the image is ready to be presented.

  • fenceFence to wait for the image to be ready to be presented.

Returns:

Acquired image index.

virtual std::optional<u32> AcquireNextImage(Semaphore &signalSemaphore) const = 0#

Acquire the next presentable image from the swapchain to render to.

Parameters:

signalSemaphoreSemaphore to signal when the image is ready to be presented.

Returns:

Acquired image index.

virtual std::optional<u32> AcquireNextImage(Fence &fence) const = 0#

Acquire the next presentable image from the swapchain to render to.

Parameters:

fenceFence to wait for the image to be ready to be presented.

Returns:

Acquired image index.

constexpr const std::vector<TRAP::Ref<RenderTarget>> &GetRenderTargets() const noexcept#

Retrieve the render targets used by the swapchain.

Returns:

Render targets used by the swapchain.

virtual void ToggleVSync() = 0#

Toggle Vsync on and off.

virtual void UpdateFramebufferSize() = 0#

Updates the framebuffer size and recreates the swap chain.

Public Static Functions

static TRAP::Ref<SwapChain> Create(RendererAPI::SwapChainDesc &desc)#

Create a new swap chain from the given description.

Remark

Headless mode: This function is not available in headless mode.

Parameters:

desc – Swap chain description.

Returns:

Created swap chain.

Protected Functions

SwapChain()#

Constructor.

Protected Attributes

std::vector<TRAP::Ref<RenderTarget>> m_renderTargets = {}#