Raven Engine v0.1
Loading...
Searching...
No Matches
Raven::VulkanSwapchain Class Reference

Holds semaphores used for synchronizing image acquisition and rendering. More...

#include <VulkanSwapchain.h>

Inheritance diagram for Raven::VulkanSwapchain:
Raven::Swapchain

Public Member Functions

 VulkanSwapchain (u32 *width, u32 *height, bool vsync)
 Constructs a VulkanSwapchain.
void Shutdown () override
 Destroys the Vulkan swapchain and associated resources.
void Present () override
 Presents the currently rendered image to the display.
void SetVSync (bool vsync) override
 Enables or disables vertical sync.
void Resize (u32 width, u32 height)
 Triggers a resize of the swapchain.
float GetAspectRatio () const override
 Returns the current aspect ratio of the swapchain.
void BeginFrame ()
 Begins a new frame for rendering.
 operator VkSwapchainKHR () const
 Implicit conversion to VkSwapchainKHR.
std::pair< u32, u32GetExtent ()
 Returns the current width and height of the swapchain.
u32 AcquireNextImage ()
 Acquires the next available image from the swapchain.
u32 GetImageIndex () const
 Gets the index of the current swapchain image.
u8 GetCurrentFrame () const
 Gets the current frame index for frame-in-flight tracking.
void * GetFence () const override
 Returns the fence used for synchronizing the current frame.
const SemaphoresGetSemaphores () const
 Gets the semaphores used for synchronization.
VkImage GetImage (u32 index)
 Gets a Vulkan image by index.
std::vector< VkImageView > GetImageViews () const
 Returns all swapchain image views.
u32 GetImageCount ()
 Returns the total number of swapchain images.
Public Member Functions inherited from Raven::Swapchain
virtual ~Swapchain ()=default

Static Public Member Functions

static VulkanSwapchainGet ()
 Returns a reference to the active VulkanSwapchain instance.
Static Public Member Functions inherited from Raven::Swapchain
static Scope< SwapchainCreate (u32 *width, u32 *height, bool vsync)
 Factory method to create a platform-specific swapchain instance.

Detailed Description

Holds semaphores used for synchronizing image acquisition and rendering.

Vulkan implementation of the platform-agnostic Swapchain.

Each frame-in-flight uses a pair of semaphores:

  • ImageAvailableSemaphore: signals when the swapchain image is ready to be rendered to.
  • RenderFinishedSemaphore: signals when rendering is complete and ready for presentation.

Handles Vulkan-specific swapchain creation, synchronization, resizing, and presentation.

Constructor & Destructor Documentation

◆ VulkanSwapchain()

Raven::VulkanSwapchain::VulkanSwapchain ( u32 * width,
u32 * height,
bool vsync )

Constructs a VulkanSwapchain.

Parameters
widthPointer to the current window width.
heightPointer to the current window height.
vsyncWhether vertical synchronization is enabled.

Member Function Documentation

◆ AcquireNextImage()

u32 Raven::VulkanSwapchain::AcquireNextImage ( )

Acquires the next available image from the swapchain.

Returns
Index of the acquired image.

◆ BeginFrame()

void Raven::VulkanSwapchain::BeginFrame ( )

Begins a new frame for rendering.

Acquires a new image from the swapchain and prepares for rendering.

◆ Get()

VulkanSwapchain & Raven::VulkanSwapchain::Get ( )
inlinestatic

Returns a reference to the active VulkanSwapchain instance.

◆ GetAspectRatio()

float Raven::VulkanSwapchain::GetAspectRatio ( ) const
inlineoverridevirtual

Returns the current aspect ratio of the swapchain.

Implements Raven::Swapchain.

◆ GetCurrentFrame()

u8 Raven::VulkanSwapchain::GetCurrentFrame ( ) const
inline

Gets the current frame index for frame-in-flight tracking.

◆ GetExtent()

std::pair< u32, u32 > Raven::VulkanSwapchain::GetExtent ( )
inline

Returns the current width and height of the swapchain.

◆ GetFence()

void * Raven::VulkanSwapchain::GetFence ( ) const
inlineoverridevirtual

Returns the fence used for synchronizing the current frame.

Implements Raven::Swapchain.

◆ GetImage()

VkImage Raven::VulkanSwapchain::GetImage ( u32 index)
inline

Gets a Vulkan image by index.

Parameters
indexIndex of the image.
Returns
The Vulkan image.

◆ GetImageCount()

u32 Raven::VulkanSwapchain::GetImageCount ( )
inline

Returns the total number of swapchain images.

◆ GetImageIndex()

u32 Raven::VulkanSwapchain::GetImageIndex ( ) const
inline

Gets the index of the current swapchain image.

◆ GetImageViews()

std::vector< VkImageView > Raven::VulkanSwapchain::GetImageViews ( ) const
inline

Returns all swapchain image views.

◆ GetSemaphores()

const Semaphores & Raven::VulkanSwapchain::GetSemaphores ( ) const
inline

Gets the semaphores used for synchronization.

◆ operator VkSwapchainKHR()

Raven::VulkanSwapchain::operator VkSwapchainKHR ( ) const
inline

Implicit conversion to VkSwapchainKHR.

◆ Present()

void Raven::VulkanSwapchain::Present ( )
overridevirtual

Presents the currently rendered image to the display.

Implements Raven::Swapchain.

◆ Resize()

void Raven::VulkanSwapchain::Resize ( u32 width,
u32 height )
virtual

Triggers a resize of the swapchain.

Parameters
widthNew width.
heightNew height.

Implements Raven::Swapchain.

◆ SetVSync()

void Raven::VulkanSwapchain::SetVSync ( bool vsync)
overridevirtual

Enables or disables vertical sync.

Parameters
vsyncTrue to enable, false to disable.

Implements Raven::Swapchain.

◆ Shutdown()

void Raven::VulkanSwapchain::Shutdown ( )
overridevirtual

Destroys the Vulkan swapchain and associated resources.

Implements Raven::Swapchain.


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