vengine  0.0.1
3D graphics engine
Loading...
Searching...
No Matches
ven::SwapChain Class Reference

Class for swap chain. More...

#include <SwapChain.hpp>

+ Collaboration diagram for ven::SwapChain:

Public Member Functions

 SwapChain (Device &deviceRef, const VkExtent2D windowExtentRef)
 
 SwapChain (Device &deviceRef, const VkExtent2D windowExtentRef, std::shared_ptr< SwapChain > previous)
 
 ~SwapChain ()
 
 SwapChain (const SwapChain &)=delete
 
SwapChainoperator= (const SwapChain &)=delete
 
 SwapChain (SwapChain &&)=delete
 
SwapChainoperator= (SwapChain &&)=delete
 
VkFramebuffer getFrameBuffer (const unsigned long index) const
 
VkRenderPass getRenderPass () const
 
VkImageView getImageView (const int index) const
 
size_t imageCount () const
 
VkFormat getSwapChainImageFormat () const
 
VkExtent2D getSwapChainExtent () const
 
uint32_t width () const
 
uint32_t height () const
 
float extentAspectRatio () const
 
VkFormat findDepthFormat () const
 
VkResult acquireNextImage (uint32_t *imageIndex) const
 
VkResult submitCommandBuffers (const VkCommandBuffer *buffers, const uint32_t *imageIndex)
 
bool compareSwapFormats (const SwapChain &swapChain) const
 

Private Member Functions

void init ()
 
void createSwapChain ()
 
void createImageViews ()
 
void createDepthResources ()
 
void createRenderPass ()
 
void createFrameBuffers ()
 
void createSyncObjects ()
 
VkExtent2D chooseSwapExtent (const VkSurfaceCapabilitiesKHR &capabilities) const
 

Static Private Member Functions

static VkSurfaceFormatKHR chooseSwapSurfaceFormat (const std::vector< VkSurfaceFormatKHR > &availableFormats)
 
static VkPresentModeKHR chooseSwapPresentMode (const std::vector< VkPresentModeKHR > &availablePresentModes)
 

Private Attributes

VkFormat m_swapChainImageFormat {}
 
VkFormat m_swapChainDepthFormat {}
 
VkExtent2D m_swapChainExtent {}
 
std::vector< VkFramebuffer > m_swapChainFrameBuffers
 
VkRenderPass m_renderPass {}
 
std::vector< VkImage > m_depthImages
 
std::vector< VkDeviceMemory > m_depthImageMemory
 
std::vector< VkImageView > m_depthImageViews
 
std::vector< VkImage > m_swapChainImages
 
std::vector< VkImageView > m_swapChainImageViews
 
Devicem_device
 
VkExtent2D m_windowExtent
 
VkSwapchainKHR m_swapChain {}
 
std::shared_ptr< SwapChainm_oldSwapChain
 
std::vector< VkSemaphore > m_imageAvailableSemaphores
 
std::vector< VkSemaphore > m_renderFinishedSemaphores
 
std::vector< VkFence > m_inFlightFences
 
std::vector< VkFence > m_imagesInFlight
 
size_t m_currentFrame {0}
 

Detailed Description

Class for swap chain.

Definition at line 22 of file SwapChain.hpp.

Constructor & Destructor Documentation

◆ SwapChain() [1/4]

ven::SwapChain::SwapChain ( Device & deviceRef,
const VkExtent2D windowExtentRef )
inline

Definition at line 26 of file SwapChain.hpp.

References init().

+ Here is the call graph for this function:

◆ SwapChain() [2/4]

ven::SwapChain::SwapChain ( Device & deviceRef,
const VkExtent2D windowExtentRef,
std::shared_ptr< SwapChain > previous )
inline

Definition at line 27 of file SwapChain.hpp.

References init(), and m_oldSwapChain.

+ Here is the call graph for this function:

◆ ~SwapChain()

◆ SwapChain() [3/4]

ven::SwapChain::SwapChain ( const SwapChain & )
delete

◆ SwapChain() [4/4]

ven::SwapChain::SwapChain ( SwapChain && )
delete

Member Function Documentation

◆ acquireNextImage()

VkResult ven::SwapChain::acquireNextImage ( uint32_t * imageIndex) const

Definition at line 49 of file swapChain.cpp.

◆ chooseSwapExtent()

VkExtent2D ven::SwapChain::chooseSwapExtent ( const VkSurfaceCapabilitiesKHR & capabilities) const
nodiscardprivate

Definition at line 362 of file swapChain.cpp.

◆ chooseSwapPresentMode()

VkPresentModeKHR ven::SwapChain::chooseSwapPresentMode ( const std::vector< VkPresentModeKHR > & availablePresentModes)
staticprivate

Definition at line 342 of file swapChain.cpp.

◆ chooseSwapSurfaceFormat()

VkSurfaceFormatKHR ven::SwapChain::chooseSwapSurfaceFormat ( const std::vector< VkSurfaceFormatKHR > & availableFormats)
staticprivate

Definition at line 331 of file swapChain.cpp.

◆ compareSwapFormats()

bool ven::SwapChain::compareSwapFormats ( const SwapChain & swapChain) const
inlinenodiscard

Definition at line 50 of file SwapChain.hpp.

References m_swapChainDepthFormat, and m_swapChainImageFormat.

◆ createDepthResources()

void ven::SwapChain::createDepthResources ( )
private

Definition at line 262 of file swapChain.cpp.

◆ createFrameBuffers()

void ven::SwapChain::createFrameBuffers ( )
private

Definition at line 240 of file swapChain.cpp.

◆ createImageViews()

void ven::SwapChain::createImageViews ( )
private

Definition at line 160 of file swapChain.cpp.

◆ createRenderPass()

void ven::SwapChain::createRenderPass ( )
private

Definition at line 181 of file swapChain.cpp.

◆ createSwapChain()

void ven::SwapChain::createSwapChain ( )
private

Definition at line 103 of file swapChain.cpp.

◆ createSyncObjects()

void ven::SwapChain::createSyncObjects ( )
private

Definition at line 308 of file swapChain.cpp.

References ven::MAX_FRAMES_IN_FLIGHT.

◆ extentAspectRatio()

float ven::SwapChain::extentAspectRatio ( ) const
inlinenodiscard

Definition at line 44 of file SwapChain.hpp.

References m_swapChainExtent.

◆ findDepthFormat()

VkFormat ven::SwapChain::findDepthFormat ( ) const
nodiscard

Definition at line 374 of file swapChain.cpp.

◆ getFrameBuffer()

VkFramebuffer ven::SwapChain::getFrameBuffer ( const unsigned long index) const
inlinenodiscard

Definition at line 35 of file SwapChain.hpp.

References m_swapChainFrameBuffers.

◆ getImageView()

VkImageView ven::SwapChain::getImageView ( const int index) const
inlinenodiscard

Definition at line 37 of file SwapChain.hpp.

References m_swapChainImageViews.

◆ getRenderPass()

VkRenderPass ven::SwapChain::getRenderPass ( ) const
inlinenodiscard

Definition at line 36 of file SwapChain.hpp.

References m_renderPass.

◆ getSwapChainExtent()

VkExtent2D ven::SwapChain::getSwapChainExtent ( ) const
inlinenodiscard

Definition at line 40 of file SwapChain.hpp.

References m_swapChainExtent.

◆ getSwapChainImageFormat()

VkFormat ven::SwapChain::getSwapChainImageFormat ( ) const
inlinenodiscard

Definition at line 39 of file SwapChain.hpp.

References m_swapChainImageFormat.

◆ height()

uint32_t ven::SwapChain::height ( ) const
inlinenodiscard

Definition at line 42 of file SwapChain.hpp.

References m_swapChainExtent.

◆ imageCount()

size_t ven::SwapChain::imageCount ( ) const
inlinenodiscard

Definition at line 38 of file SwapChain.hpp.

References m_swapChainImages.

◆ init()

void ven::SwapChain::init ( )
private

Definition at line 39 of file swapChain.cpp.

Referenced by SwapChain(), and SwapChain().

+ Here is the caller graph for this function:

◆ operator=() [1/2]

SwapChain & ven::SwapChain::operator= ( const SwapChain & )
delete

◆ operator=() [2/2]

SwapChain & ven::SwapChain::operator= ( SwapChain && )
delete

◆ submitCommandBuffers()

VkResult ven::SwapChain::submitCommandBuffers ( const VkCommandBuffer * buffers,
const uint32_t * imageIndex )

Definition at line 56 of file swapChain.cpp.

References ven::MAX_FRAMES_IN_FLIGHT.

◆ width()

uint32_t ven::SwapChain::width ( ) const
inlinenodiscard

Definition at line 41 of file SwapChain.hpp.

References m_swapChainExtent.

Member Data Documentation

◆ m_currentFrame

size_t ven::SwapChain::m_currentFrame {0}
private

Definition at line 89 of file SwapChain.hpp.

◆ m_depthImageMemory

std::vector<VkDeviceMemory> ven::SwapChain::m_depthImageMemory
private

Definition at line 74 of file SwapChain.hpp.

Referenced by ~SwapChain().

◆ m_depthImages

std::vector<VkImage> ven::SwapChain::m_depthImages
private

Definition at line 73 of file SwapChain.hpp.

Referenced by ~SwapChain().

◆ m_depthImageViews

std::vector<VkImageView> ven::SwapChain::m_depthImageViews
private

Definition at line 75 of file SwapChain.hpp.

Referenced by ~SwapChain().

◆ m_device

Device& ven::SwapChain::m_device
private

Definition at line 79 of file SwapChain.hpp.

Referenced by ~SwapChain().

◆ m_imageAvailableSemaphores

std::vector<VkSemaphore> ven::SwapChain::m_imageAvailableSemaphores
private

Definition at line 85 of file SwapChain.hpp.

Referenced by ~SwapChain().

◆ m_imagesInFlight

std::vector<VkFence> ven::SwapChain::m_imagesInFlight
private

Definition at line 88 of file SwapChain.hpp.

◆ m_inFlightFences

std::vector<VkFence> ven::SwapChain::m_inFlightFences
private

Definition at line 87 of file SwapChain.hpp.

Referenced by ~SwapChain().

◆ m_oldSwapChain

std::shared_ptr<SwapChain> ven::SwapChain::m_oldSwapChain
private

Definition at line 83 of file SwapChain.hpp.

Referenced by SwapChain().

◆ m_renderFinishedSemaphores

std::vector<VkSemaphore> ven::SwapChain::m_renderFinishedSemaphores
private

Definition at line 86 of file SwapChain.hpp.

Referenced by ~SwapChain().

◆ m_renderPass

VkRenderPass ven::SwapChain::m_renderPass {}
private

Definition at line 71 of file SwapChain.hpp.

Referenced by getRenderPass(), and ~SwapChain().

◆ m_swapChain

VkSwapchainKHR ven::SwapChain::m_swapChain {}
private

Definition at line 82 of file SwapChain.hpp.

Referenced by ~SwapChain().

◆ m_swapChainDepthFormat

VkFormat ven::SwapChain::m_swapChainDepthFormat {}
private

Definition at line 67 of file SwapChain.hpp.

Referenced by compareSwapFormats().

◆ m_swapChainExtent

VkExtent2D ven::SwapChain::m_swapChainExtent {}
private

Definition at line 68 of file SwapChain.hpp.

Referenced by extentAspectRatio(), getSwapChainExtent(), height(), and width().

◆ m_swapChainFrameBuffers

std::vector<VkFramebuffer> ven::SwapChain::m_swapChainFrameBuffers
private

Definition at line 70 of file SwapChain.hpp.

Referenced by getFrameBuffer(), and ~SwapChain().

◆ m_swapChainImageFormat

VkFormat ven::SwapChain::m_swapChainImageFormat {}
private

Definition at line 66 of file SwapChain.hpp.

Referenced by compareSwapFormats(), and getSwapChainImageFormat().

◆ m_swapChainImages

std::vector<VkImage> ven::SwapChain::m_swapChainImages
private

Definition at line 76 of file SwapChain.hpp.

Referenced by imageCount().

◆ m_swapChainImageViews

std::vector<VkImageView> ven::SwapChain::m_swapChainImageViews
private

Definition at line 77 of file SwapChain.hpp.

Referenced by getImageView(), and ~SwapChain().

◆ m_windowExtent

VkExtent2D ven::SwapChain::m_windowExtent
private

Definition at line 80 of file SwapChain.hpp.


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