|
nngn
|
Presentation swap chain and associated objects. More...
#include <swapchain.h>

Classes | |
| struct | PresentContext |
| Information used to present an image. More... | |
Public Member Functions | |
| SwapChain (void)=default | |
| ~SwapChain (void) | |
| VkSwapchainKHR | id (void) const |
| VkSurfaceKHR | surface (void) const |
| std::span< const VkImageView > | img_views () const |
| Views for the swap chain images. | |
| std::span< const VkFramebuffer > | frame_buffers () const |
| Frame buffers for each swap chain image. | |
| std::span< const VkFramebuffer > | depth_frame_buffers () const |
| Frame buffers for each depth pass image. | |
| std::size_t | cur_frame () const |
| void | set_present_mode (VkPresentModeKHR m) |
| Changes the presentation mode used on the next recreate. | |
| void | set_surface (VkSurfaceKHR s) |
| void | init (VkInstance inst, DeviceMemory *dev_mem, VkSurfaceFormatKHR format, VkFormat depth_format, VkPresentModeKHR mode) |
| bool | recreate (const Instance &inst, const Device &dev, std::uint32_t n_images, VkRenderPass depth_pass, VkRenderPass render_pass, VkExtent2D extent, VkSurfaceTransformFlagBitsKHR transform, VkExtent2D shadow_map_size, VkExtent2D shadow_cube_size, std::span< const VkImageView > shadow_map, std::span< const VkImageView > shadow_cube) |
| Destroys resources and recreate them. | |
| std::pair< PresentContext, VkResult > | acquire_img () |
| Acquires an image from the swap chain for rendering. | |
Private Member Functions | |
| bool | create_img_views (const Instance &inst) |
| bool | create_depth_img (const Instance &inst, VkExtent2D extent) |
| bool | create_sync_objects (const Instance &inst) |
| bool | create_frame_buffers (const Instance &inst, VkExtent2D extent, VkRenderPass render_pass) |
| bool | create_depth_frame_buffers (const Instance &inst, VkRenderPass render_pass, VkExtent2D shadow_map_size, VkExtent2D shadow_cube_size, std::span< const VkImageView > shadow_map, std::span< const VkImageView > shadow_cube) |
| void | destroy () |
Private Attributes | ||
| VkSwapchainKHR | h = {} | |
| VkInstance | instance = {} | |
| VkSurfaceKHR | m_surface = {} | |
| VkDevice | dev = {} | |
| DeviceMemory * | dev_mem = {} | |
| VkSurfaceFormatKHR | format = {} | |
| VkPresentModeKHR | present_mode = {} | |
| std::vector< VkImageView > | m_img_views = {} | |
| VkFormat | depth_format = {} | |
| Image | depth_img = {} | |
| VkImageView | depth_img_view = {} | |
| struct { | ||
| std::vector< VkSemaphore > render | ||
| Signaled when an image has been acquired and rendering can begin. More... | ||
| std::vector< VkSemaphore > present | ||
| Signaled when an image has been presented. More... | ||
| } | semaphores = {} | |
| struct { | ||
| std::vector< VkFence > render | ||
| Signaled when an image has been acquired and rendering can begin. More... | ||
| std::vector< VkFence > present | ||
| Signaled when all rendering commands targeting an image finished. More... | ||
| } | fences = {} | |
| std::vector< VkFramebuffer > | m_frame_buffers = {} | |
| std::vector< VkFramebuffer > | m_depth_frame_buffers = {} | |
| std::size_t | i_frame = {} | |
Presentation swap chain and associated objects.
|
default |
| nngn::SwapChain::~SwapChain | ( | void | ) |

| auto nngn::SwapChain::acquire_img | ( | ) |
Acquires an image from the swap chain for rendering.


|
private |




|
private |






|
inline |
|
inline |
Frame buffers for each depth pass image.

|
private |


|
inline |
Frame buffers for each swap chain image.

|
inline |
|
inline |
Views for the swap chain images.
| void nngn::SwapChain::init | ( | VkInstance | inst, |
| DeviceMemory * | dev_mem, | ||
| VkSurfaceFormatKHR | format, | ||
| VkFormat | depth_format, | ||
| VkPresentModeKHR | mode ) |

| bool nngn::SwapChain::recreate | ( | const Instance & | inst, |
| const Device & | dev, | ||
| std::uint32_t | n_images, | ||
| VkRenderPass | depth_pass, | ||
| VkRenderPass | render_pass, | ||
| VkExtent2D | extent, | ||
| VkSurfaceTransformFlagBitsKHR | transform, | ||
| VkExtent2D | shadow_map_size, | ||
| VkExtent2D | shadow_cube_size, | ||
| std::span< const VkImageView > | shadow_map, | ||
| std::span< const VkImageView > | shadow_cube ) |
Destroys resources and recreate them.


|
inline |
Changes the presentation mode used on the next recreate.

|
inline |

|
inline |

|
private |
|
private |
|
private |
|
private |
|
private |
| struct { ... } nngn::SwapChain::fences |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
| std::vector<VkSemaphore> nngn::SwapChain::present |
Signaled when an image has been presented.
| std::vector<VkFence> nngn::SwapChain::present |
Signaled when all rendering commands targeting an image finished.
Elements are a permutation of render depending on the order images are made available in the swap chain.
|
private |
| std::vector<VkSemaphore> nngn::SwapChain::render |
Signaled when an image has been acquired and rendering can begin.
| std::vector<VkFence> nngn::SwapChain::render |
Signaled when an image has been acquired and rendering can begin.
| struct { ... } nngn::SwapChain::semaphores |