A swapchain handles the creation and presentation of the backbuffer, along with GPU work submission and synchronization.
More...
#include <Swapchain.hpp>
|
|
GPUContext * | _context = nullptr |
| | The GPU internal context.
|
| |
|
VkSwapchainKHR | _swapchain = VK_NULL_HANDLE |
| | Native handle.
|
| |
|
std::vector< Texture > | _colors |
| | Backbuffers.
|
| |
|
Texture | _depth |
| | The shared depth texture.
|
| |
|
Texture * | _backbuffer = nullptr |
| | The current backbuffer.
|
| |
|
std::vector< VkSemaphore > | _imagesAvailable |
| | Semaphores signaling when swapchain images are available for a new frame.
|
| |
|
std::vector< VkSemaphore > | _framesFinished |
| | Semaphores signaling when a frame has been completed.
|
| |
|
std::vector< VkFence > | _framesInFlight |
| | Fences ensuring that frames are properly ordered.
|
| |
|
uint | _imageCount = 0 |
| | Number of images in the swapchain.
|
| |
|
uint | _minImageCount = 0 |
| | Minimum number of images required by the swapchain.
|
| |
|
bool | _vsync = false |
| | Is V-sync enabled.
|
| |
|
uint32_t | _imageIndex = 0 |
| | Current image index.
|
| |
|
bool | _frameStarted = false |
| | Has a frame been previously submitted.
|
| |
A swapchain handles the creation and presentation of the backbuffer, along with GPU work submission and synchronization.
◆ Swapchain()
Create a swapchain.
- Parameters
-
| context | the GPU internal context |
| config | the renderer configuration |
◆ ~Swapchain()
| Swapchain::~Swapchain |
( |
| ) |
|
◆ clean()
| void Swapchain::clean |
( |
| ) |
|
|
private |
Destroy internal structures.
◆ color()
- Returns
- the swapchain color texture
◆ count()
| uint Swapchain::count |
( |
| ) |
|
|
inline |
- Returns
- the number of backbuffers handled by the swapchain.
◆ depth()
- Returns
- the swapchain depth texture
◆ finishFrame()
| bool Swapchain::finishFrame |
( |
| ) |
|
|
private |
Submit the current frame's work.
- Returns
- true if the submission was successful
◆ getFormats()
| void Swapchain::getFormats |
( |
VkFormat & |
color, |
|
|
VkFormat & |
depth, |
|
|
VkFormat & |
stencil |
|
) |
| |
Query the formats used by the swapchain backbuffer
- Parameters
-
| color | will contain the color format |
| depth | will contain the depth format |
| stencil | will contain the stencil format |
◆ minCount()
| uint Swapchain::minCount |
( |
| ) |
|
|
inline |
- Returns
- the minimum number of backbuffers required by the swapchain.
◆ nextFrame()
| bool Swapchain::nextFrame |
( |
| ) |
|
Submit the current frame's work and start the next one.
- Returns
- true if a new frame has been successfully started
◆ resize()
| void Swapchain::resize |
( |
uint |
w, |
|
|
uint |
h |
|
) |
| |
Resize an existing swapchain, recreating backbuffers.
- Parameters
-
| w | the new width |
| h | the new height |
◆ setup()
| void Swapchain::setup |
( |
uint32_t |
width, |
|
|
uint32_t |
height |
|
) |
| |
|
private |
Setup the swapchain for a given size
- Parameters
-
| width | the new width |
| height | the new height |
The documentation for this class was generated from the following files:
- src/engine/graphics/Swapchain.hpp
- src/engine/graphics/Swapchain.cpp