Blowbox 2017
A 3D Game Engine by Riko Ophorst using DirectX 12
|
#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_ |
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.
blowbox::CommandAllocatorPool::CommandAllocatorPool | ( | D3D12_COMMAND_LIST_TYPE | type | ) |
Constructs a CommandAllocatorPool with CommandAllocators of a given type.
[in] | type | The type of CommandAllocators that this pool holds. |
blowbox::CommandAllocatorPool::~CommandAllocatorPool | ( | ) |
Destructs the CommandAllocatorPool.
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)
[in] | fence_value | The fence point at which the discarded allocator is available again |
[in] | allocator | The allocator that is getting discarded |
|
inline |
ID3D12CommandAllocator * blowbox::CommandAllocatorPool::RequestAllocator | ( | uint64_t | completed_fence_value | ) |
This requests an allocator that will be available past the given fence point.
[in] | completed_fence_value | Fence point (point in time, essentially) at which the given allocator should be available |
|
private |
All command allocators exist within this pool.
|
private |
Allocators that have been discarded, are put into this Queue, accomponied by their expiry fence point.
|
private |
The type of command allocator pool.