Blowbox 2017
A 3D Game Engine by Riko Ophorst using DirectX 12
Public Member Functions | Private Attributes | List of all members
blowbox::CommandContextManager Class Reference

#include <command_context_manager.h>

Public Member Functions

 CommandContextManager ()
 
 ~CommandContextManager ()
 
void Startup ()
 
CommandContextRequestContext (D3D12_COMMAND_LIST_TYPE type)
 
void DiscardContext (CommandContext *context)
 

Private Attributes

Vector< CommandContext * > contexts_pool_ [4]
 
Queue< CommandContext * > available_contexts_ [4]
 

Detailed Description

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.

Constructor & Destructor Documentation

blowbox::CommandContextManager::CommandContextManager ( )

Constructs the CommandContextManager.

blowbox::CommandContextManager::~CommandContextManager ( )

Destructs the CommandContextManager.

Member Function Documentation

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.

Parameters
[in]contextThe 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.

Parameters
[in]typeThe type of CommandContext you want to request
Returns
A CommandContext for the requested command list type.
void blowbox::CommandContextManager::Startup ( )

Starts up the CommandContextManager.

Member Data Documentation

Queue<CommandContext*> blowbox::CommandContextManager::available_contexts_[4]
private

The available pool of contexts. Any context in these arrays is a context that is ready to be re-used.

Vector<CommandContext*> blowbox::CommandContextManager::contexts_pool_[4]
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.


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