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

#include <command_allocator_pool.h>

Public Member Functions

 CommandAllocatorPool (D3D12_COMMAND_LIST_TYPE type)
 
 ~CommandAllocatorPool ()
 
ID3D12CommandAllocator * RequestAllocator (uint64_t completed_fence_value)
 
void DiscardAllocator (uint64_t fence_value, ID3D12CommandAllocator *allocator)
 
size_t GetPoolSize ()
 

Private Attributes

D3D12_COMMAND_LIST_TYPE type_
 
Vector< ID3D12CommandAllocator * > allocator_pool_
 
Queue< Pair< uint64_t, ID3D12CommandAllocator * > > available_allocators_
 

Detailed Description

Controls a pool of allocators of a certain type.

The CommandAllocatorPool holds a pool of command allocators. It dynamically creates more CommandAllocators when they run out, and releases them back into the pool of available all- ocators when they are done processing on the GPU.

Constructor & Destructor Documentation

blowbox::CommandAllocatorPool::CommandAllocatorPool ( D3D12_COMMAND_LIST_TYPE  type)

Constructs a CommandAllocatorPool with CommandAllocators of a given type.

Parameters
[in]typeThe type of CommandAllocators that this pool holds.
blowbox::CommandAllocatorPool::~CommandAllocatorPool ( )

Destructs the CommandAllocatorPool.

Member Function Documentation

void blowbox::CommandAllocatorPool::DiscardAllocator ( uint64_t  fence_value,
ID3D12CommandAllocator *  allocator 
)

Discards a given allocator. It will be available after a given fence point (point in time, essentially)

Parameters
[in]fence_valueThe fence point at which the discarded allocator is available again
[in]allocatorThe allocator that is getting discarded
size_t blowbox::CommandAllocatorPool::GetPoolSize ( )
inline
Returns
The number of command allocators in the pool currently.
ID3D12CommandAllocator * blowbox::CommandAllocatorPool::RequestAllocator ( uint64_t  completed_fence_value)

This requests an allocator that will be available past the given fence point.

Parameters
[in]completed_fence_valueFence point (point in time, essentially) at which the given allocator should be available

Member Data Documentation

Vector<ID3D12CommandAllocator*> blowbox::CommandAllocatorPool::allocator_pool_
private

All command allocators exist within this pool.

Queue<Pair<uint64_t, ID3D12CommandAllocator*> > blowbox::CommandAllocatorPool::available_allocators_
private

Allocators that have been discarded, are put into this Queue, accomponied by their expiry fence point.

D3D12_COMMAND_LIST_TYPE blowbox::CommandAllocatorPool::type_
private

The type of command allocator pool.


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