VkCV Framework  0.0.1
CV Vulkan framework
vkcv::Swapchain Class Referencefinal
Collaboration diagram for vkcv::Swapchain:

Classes

struct  Surface
 

Public Member Functions

 Swapchain (const Swapchain &other)
 
const vk::SwapchainKHR & getSwapchain () const
 
vk::SurfaceKHR getSurface () const
 
vk::Format getFormat () const
 
virtual ~Swapchain ()
 
uint32_t getImageCount () const
 
const vk::Extent2D & getExtent () const
 
const uint32_t & getPresentQueueIndex () const
 

Static Public Member Functions

static Swapchain create (const Window &window, const Context &context)
 

Private Member Functions

 Swapchain (const Surface &surface, vk::SwapchainKHR swapchain, vk::Format format, vk::ColorSpaceKHR colorSpace, vk::PresentModeKHR presentMode, uint32_t imageCount, vk::Extent2D extent) noexcept
 
bool shouldUpdateSwapchain () const
 
void updateSwapchain (const Context &context, const Window &window)
 
void signalSwapchainRecreation ()
 

Private Attributes

Surface m_Surface
 
vk::SwapchainKHR m_Swapchain
 
vk::Format m_Format
 
vk::ColorSpaceKHR m_ColorSpace
 
vk::PresentModeKHR m_PresentMode
 
uint32_t m_ImageCount
 
vk::Extent2D m_Extent
 
std::atomic< bool > m_RecreationRequired
 

Friends

class Core
 
class Window
 
class SwapchainManager
 

Detailed Description

Constructor & Destructor Documentation

◆ Swapchain()

vkcv::Swapchain::Swapchain ( const Surface surface,
vk::SwapchainKHR  swapchain,
vk::Format  format,
vk::ColorSpaceKHR  colorSpace,
vk::PresentModeKHR  presentMode,
uint32_t  imageCount,
vk::Extent2D  extent 
)
privatenoexcept

Constructor of a SwapChain object glfw is not initialized in this class because ist must be sure that there exists a context first glfw is already initialized by the window class

Parameters
surfaceused by the swapchain
swapchainto show images in the window
formatof the swapchain
colorSpaceof the swapchain
presentModeof the swapchain
imageCountof the swapchain
extentof the swapchain

Referenced by create().

Here is the caller graph for this function:

◆ ~Swapchain()

vkcv::Swapchain::~Swapchain ( )
virtual

Destructor of SwapChain

Member Function Documentation

◆ create()

Swapchain vkcv::Swapchain::create ( const Window window,
const Context context 
)
static

creates a swap chain object out of the given window and the given context

Parameters
windowa wrapper that represents a glfw window
contextof the application
Returns
returns an object of swapChain

creates and returns a swapchain with default specs

Parameters
windowof the current application
contextthat keeps instance, physicalDevice and a device.
Returns
swapchain

References vkcv::QueueManager::checkSurfaceSupport(), vkcv::Window::getWindow(), and Swapchain().

Referenced by vkcv::SwapchainManager::createSwapchain().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getExtent()

const vk::Extent2D & vkcv::Swapchain::getExtent ( ) const
Returns
the 2d extent of the swapchain

Referenced by vkcv::gui::GUI::beginGUI(), vkcv::gui::GUI::endGUI(), and vkcv::Core::setSwapchainImages().

Here is the caller graph for this function:

◆ getFormat()

vk::Format vkcv::Swapchain::getFormat ( ) const

gets the chosen swapchain format

Returns
gets the chosen swapchain format

Referenced by vkcv::SwapchainManager::createSwapchainImageViews(), vkcv::gui::GUI::GUI(), and vkcv::Core::setSwapchainImages().

Here is the caller graph for this function:

◆ getImageCount()

uint32_t vkcv::Swapchain::getImageCount ( ) const
Returns
number of images in swapchain

Referenced by vkcv::gui::GUI::beginGUI(), and vkcv::gui::GUI::GUI().

Here is the caller graph for this function:

◆ getPresentQueueIndex()

const uint32_t & vkcv::Swapchain::getPresentQueueIndex ( ) const
Returns
the familyQueueIndex for the surface

◆ getSurface()

vk::SurfaceKHR vkcv::Swapchain::getSurface ( ) const

gets the current surface object

Returns
current surface

◆ getSwapchain()

const vk::SwapchainKHR & vkcv::Swapchain::getSwapchain ( ) const
Returns
The swapchain linked with the #SwapChain class
Note
The reference to our Swapchain variable is needed for the recreation step

Referenced by vkcv::Core::getSwapchain(), vkcv::Core::getSwapchainOfCurrentWindow(), and vkcv::Core::setSwapchainImages().

Here is the caller graph for this function:

◆ shouldUpdateSwapchain()

bool vkcv::Swapchain::shouldUpdateSwapchain ( ) const
private

checks if the update flag is true

Returns
if an update is needed

◆ signalSwapchainRecreation()

void vkcv::Swapchain::signalSwapchainRecreation ( )
private

signal that the swapchain needs to be recreated

Referenced by updateSwapchain().

Here is the caller graph for this function:

◆ updateSwapchain()

void vkcv::Swapchain::updateSwapchain ( const Context context,
const Window window 
)
private

recreates the swapchain context window

References signalSwapchainRecreation().

Here is the call graph for this function:

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