Blowbox 2017
A 3D Game Engine by Riko Ophorst using DirectX 12
command_allocator_pool.h
1 #pragma once
2 
3 #include "util/vector.h"
4 #include "util/queue.h"
5 #include "util/utility.h"
6 #include "renderer/d3d12_includes.h"
7 
8 namespace blowbox
9 {
19  {
20  public:
25  CommandAllocatorPool(D3D12_COMMAND_LIST_TYPE type);
26 
29 
34  ID3D12CommandAllocator* RequestAllocator(uint64_t completed_fence_value);
35 
41  void DiscardAllocator(uint64_t fence_value, ID3D12CommandAllocator* allocator);
42 
44  inline size_t GetPoolSize() { return allocator_pool_.size(); }
45 
46  private:
47  D3D12_COMMAND_LIST_TYPE type_;
50  };
51 }
eastl::vector< T > Vector
Typedef for wrapping the EASTL vector.
Definition: vector.h:14
Vector< ID3D12CommandAllocator * > allocator_pool_
All command allocators exist within this pool.
Definition: command_allocator_pool.h:48
void DiscardAllocator(uint64_t fence_value, ID3D12CommandAllocator *allocator)
Discards a given allocator. It will be available after a given fence point (point in time...
Definition: command_allocator_pool.cc:59
~CommandAllocatorPool()
Destructs the CommandAllocatorPool.
Definition: command_allocator_pool.cc:16
Controls a pool of allocators of a certain type.
Definition: command_allocator_pool.h:18
Queue< Pair< uint64_t, ID3D12CommandAllocator * > > available_allocators_
Allocators that have been discarded, are put into this Queue, accomponied by their expiry fence point...
Definition: command_allocator_pool.h:49
eastl::queue< T > Queue
Typedef for wrapping the EASTL queue.
Definition: queue.h:14
D3D12_COMMAND_LIST_TYPE type_
The type of command allocator pool.
Definition: command_allocator_pool.h:47
The main Blowbox namespace.
Definition: image.cc:8
ID3D12CommandAllocator * RequestAllocator(uint64_t completed_fence_value)
This requests an allocator that will be available past the given fence point.
Definition: command_allocator_pool.cc:27
size_t GetPoolSize()
Definition: command_allocator_pool.h:44
CommandAllocatorPool(D3D12_COMMAND_LIST_TYPE type)
Constructs a CommandAllocatorPool with CommandAllocators of a given type.
Definition: command_allocator_pool.cc:9