Nameless Engine
|
#include <FrameResourceManager.h>
Classes | |
struct | CurrentFrameResource |
Public Member Functions | |
FrameResourceManager (const FrameResourceManager &)=delete | |
FrameResourceManager & | operator= (const FrameResourceManager &)=delete |
std::pair< std::recursive_mutex, CurrentFrameResource > * | getCurrentFrameResource () |
std::pair< std::recursive_mutex *, std::vector< FrameResource * > > | getAllFrameResources () |
Static Public Member Functions | |
static constexpr unsigned int | getFrameResourceCount () |
static std::variant< std::unique_ptr< FrameResourceManager >, Error > | create (Renderer *pRenderer) |
Private Member Functions | |
FrameResourceManager (Renderer *pRenderer) | |
void | switchToNextFrameResource () |
Static Private Member Functions | |
static std::array< std::unique_ptr< FrameResource >, iFrameResourceCount > | createRenderDependentFrameResources (Renderer *pRenderer) |
Private Attributes | |
Renderer * | pRenderer = nullptr |
std::pair< std::recursive_mutex, CurrentFrameResource > | mtxCurrentFrameResource |
std::array< std::unique_ptr< FrameResource >, iFrameResourceCount > | vFrameResources |
Static Private Attributes | |
static constexpr unsigned int | iFrameResourceCount = 2 |
Friends | |
class | Renderer |
class | VulkanRenderer |
Controls GPU resources (mostly constant buffers) that contain frame-specific data.
Used to not wait for the GPU to finish drawing a frame on the CPU side and instead continue drawing another frame (on the CPU side) without touching resources that can be in use by the GPU because it's drawing the previous frame.
|
private |
Creates uninitialized manager.
pRenderer | Renderer that owns this manager. |
|
static |
|
staticprivate |
Creates a render-specific frame resources depending on the renderer used.
pRenderer | Used renderer. |
std::pair< std::recursive_mutex *, std::vector< FrameResource * > > ne::FrameResourceManager::getAllFrameResources | ( | ) |
Returns all frame resources.
std::pair< std::recursive_mutex, FrameResourceManager::CurrentFrameResource > * ne::FrameResourceManager::getCurrentFrameResource | ( | ) |
Returns currently used frame resource. Must be used with mutex.
|
inlinestaticconstexpr |
Returns the number of used frame resources.
|
private |
Uses mutex from getCurrentFrameResource to switch to the next available frame resource.
|
staticconstexprprivate |
Number of frames "in-flight" that the CPU can submit to the GPU without waiting.
|
private |
Points to the currently used item from vFrameResources.
|
private |
Array of frame-specific resources, all contain the same data.