Blowbox 2017
A 3D Game Engine by Riko Ophorst using DirectX 12
|
#include <command_context_manager.h>
Public Member Functions | |
CommandContextManager () | |
~CommandContextManager () | |
void | Startup () |
CommandContext * | RequestContext (D3D12_COMMAND_LIST_TYPE type) |
void | DiscardContext (CommandContext *context) |
Private Attributes | |
Vector< CommandContext * > | contexts_pool_ [4] |
Queue< CommandContext * > | available_contexts_ [4] |
Manages the pool of available CommandContexts.
The CommandContextManager manages all the command contexts in the engine. CommandContext instances are never cleared during runtime, they are only generated and placed into this pool. This makes the management of these CommandContext's a lot more efficient, because creating a new CommandContext becomes a lot more quick because of the low overhead costs of this pooling strategy. Ideally, as the user, you never have to interact with this manager, but instead create new CommandContext's via the CommandContext::Begin() methods.
blowbox::CommandContextManager::CommandContextManager | ( | ) |
Constructs the CommandContextManager.
blowbox::CommandContextManager::~CommandContextManager | ( | ) |
Destructs the CommandContextManager.
void blowbox::CommandContextManager::DiscardContext | ( | CommandContext * | context | ) |
By calling this function, you indicate that the CommandContext is free for re-use again. It will be released into the pool of available contexts.
[in] | context | The context you want to release back into the available context pool. |
CommandContext * blowbox::CommandContextManager::RequestContext | ( | D3D12_COMMAND_LIST_TYPE | type | ) |
Allows you to request a new CommandContext, which will be initialized and ready for use when it is returned.
[in] | type | The type of CommandContext you want to request |
void blowbox::CommandContextManager::Startup | ( | ) |
Starts up the CommandContextManager.
|
private |
The available pool of contexts. Any context in these arrays is a context that is ready to be re-used.
|
private |
The complete pool of contexts. This is 4 different arrays of arrays. Every top level array is an array of contexts of a certain type.