vengine  0.1.0
3D graphics engine made with Vulkan
Loading...
Searching...
No Matches
ven::SwapChain Class Reference

#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
 
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 &swapChainp) const
 

Static Public Attributes

static constexpr int MAX_FRAMES_IN_FLIGHT = 2
 

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 swapChainImageFormat {}
 
VkFormat swapChainDepthFormat {}
 
VkExtent2D m_swapChainExtent {}
 
std::vector< VkFramebuffer > swapChainFramebuffers
 
VkRenderPass renderPass {}
 
std::vector< VkImage > depthImages
 
std::vector< VkDeviceMemory > depthImageMemorys
 
std::vector< VkImageView > depthImageViews
 
std::vector< VkImage > swapChainImages
 
std::vector< VkImageView > swapChainImageViews
 
Devicedevice
 
VkExtent2D windowExtent
 
VkSwapchainKHR swapChain {}
 
std::shared_ptr< SwapChainoldSwapChain
 
std::vector< VkSemaphore > imageAvailableSemaphores
 
std::vector< VkSemaphore > renderFinishedSemaphores
 
std::vector< VkFence > inFlightFences
 
std::vector< VkFence > imagesInFlight
 
size_t currentFrame = 0
 

Detailed Description

Definition at line 16 of file SwapChain.hpp.

Constructor & Destructor Documentation

◆ SwapChain() [1/3]

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

Definition at line 22 of file SwapChain.hpp.

References init().

+ Here is the call graph for this function:

◆ SwapChain() [2/3]

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

Definition at line 23 of file SwapChain.hpp.

References init(), and oldSwapChain.

+ Here is the call graph for this function:

◆ ~SwapChain()

◆ SwapChain() [3/3]

ven::SwapChain::SwapChain ( const 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
private

Definition at line 366 of file swapChain.cpp.

◆ chooseSwapPresentMode()

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

Definition at line 346 of file swapChain.cpp.

◆ chooseSwapSurfaceFormat()

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

Definition at line 335 of file swapChain.cpp.

◆ compareSwapFormats()

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

Definition at line 44 of file SwapChain.hpp.

References swapChainDepthFormat, and swapChainImageFormat.

◆ createDepthResources()

void ven::SwapChain::createDepthResources ( )
private

Definition at line 266 of file swapChain.cpp.

◆ createFramebuffers()

void ven::SwapChain::createFramebuffers ( )
private

Definition at line 244 of file swapChain.cpp.

◆ createImageViews()

void ven::SwapChain::createImageViews ( )
private

Definition at line 164 of file swapChain.cpp.

◆ createRenderPass()

void ven::SwapChain::createRenderPass ( )
private

Definition at line 185 of file swapChain.cpp.

◆ createSwapChain()

◆ createSyncObjects()

void ven::SwapChain::createSyncObjects ( )
private

Definition at line 312 of file swapChain.cpp.

◆ extentAspectRatio()

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

Definition at line 38 of file SwapChain.hpp.

References m_swapChainExtent.

◆ findDepthFormat()

VkFormat ven::SwapChain::findDepthFormat ( ) const

Definition at line 378 of file swapChain.cpp.

◆ getFrameBuffer()

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

Definition at line 29 of file SwapChain.hpp.

References swapChainFramebuffers.

◆ getImageView()

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

Definition at line 31 of file SwapChain.hpp.

References swapChainImageViews.

◆ getRenderPass()

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

Definition at line 30 of file SwapChain.hpp.

References renderPass.

◆ getSwapChainExtent()

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

Definition at line 34 of file SwapChain.hpp.

References m_swapChainExtent.

◆ getSwapChainImageFormat()

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

Definition at line 33 of file SwapChain.hpp.

References swapChainImageFormat.

◆ height()

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

Definition at line 36 of file SwapChain.hpp.

References m_swapChainExtent.

◆ imageCount()

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

Definition at line 32 of file SwapChain.hpp.

References 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=()

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

◆ submitCommandBuffers()

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

Definition at line 56 of file swapChain.cpp.

◆ width()

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

Definition at line 35 of file SwapChain.hpp.

References m_swapChainExtent.

Member Data Documentation

◆ currentFrame

size_t ven::SwapChain::currentFrame = 0
private

Definition at line 85 of file SwapChain.hpp.

◆ depthImageMemorys

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

Definition at line 70 of file SwapChain.hpp.

Referenced by ~SwapChain().

◆ depthImages

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

Definition at line 69 of file SwapChain.hpp.

Referenced by ~SwapChain().

◆ depthImageViews

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

Definition at line 71 of file SwapChain.hpp.

Referenced by ~SwapChain().

◆ device

Device& ven::SwapChain::device
private

Definition at line 75 of file SwapChain.hpp.

Referenced by ~SwapChain().

◆ imageAvailableSemaphores

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

Definition at line 81 of file SwapChain.hpp.

Referenced by ~SwapChain().

◆ imagesInFlight

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

Definition at line 84 of file SwapChain.hpp.

◆ inFlightFences

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

Definition at line 83 of file SwapChain.hpp.

Referenced by ~SwapChain().

◆ m_swapChainExtent

VkExtent2D ven::SwapChain::m_swapChainExtent {}
private

Definition at line 64 of file SwapChain.hpp.

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

◆ MAX_FRAMES_IN_FLIGHT

int ven::SwapChain::MAX_FRAMES_IN_FLIGHT = 2
staticconstexpr

◆ oldSwapChain

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

Definition at line 79 of file SwapChain.hpp.

Referenced by SwapChain().

◆ renderFinishedSemaphores

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

Definition at line 82 of file SwapChain.hpp.

Referenced by ~SwapChain().

◆ renderPass

VkRenderPass ven::SwapChain::renderPass {}
private

Definition at line 67 of file SwapChain.hpp.

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

◆ swapChain

VkSwapchainKHR ven::SwapChain::swapChain {}
private

Definition at line 78 of file SwapChain.hpp.

Referenced by ~SwapChain().

◆ swapChainDepthFormat

VkFormat ven::SwapChain::swapChainDepthFormat {}
private

Definition at line 63 of file SwapChain.hpp.

Referenced by compareSwapFormats().

◆ swapChainFramebuffers

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

Definition at line 66 of file SwapChain.hpp.

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

◆ swapChainImageFormat

VkFormat ven::SwapChain::swapChainImageFormat {}
private

Definition at line 62 of file SwapChain.hpp.

Referenced by compareSwapFormats(), and getSwapChainImageFormat().

◆ swapChainImages

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

Definition at line 72 of file SwapChain.hpp.

Referenced by imageCount().

◆ swapChainImageViews

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

Definition at line 73 of file SwapChain.hpp.

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

◆ windowExtent

VkExtent2D ven::SwapChain::windowExtent
private

Definition at line 76 of file SwapChain.hpp.


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