Blowbox 2017
A 3D Game Engine by Riko Ophorst using DirectX 12
|
#include <command_manager.h>
Public Member Functions | |
CommandManager () | |
~CommandManager () | |
void | Startup () |
void | CreateCommandList (D3D12_COMMAND_LIST_TYPE type, ID3D12GraphicsCommandList **out_list, ID3D12CommandAllocator **out_allocator) |
CommandQueue * | GetQueue (D3D12_COMMAND_LIST_TYPE type=D3D12_COMMAND_LIST_TYPE_DIRECT) |
CommandQueue * | GetCommandQueue () |
CommandQueue * | GetGraphicsQueue () |
CommandQueue * | GetComputeQueue () |
CommandQueue * | GetCopyQueue () |
bool | IsFenceComplete (uint64_t fence_value) |
void | WaitForIdleGPU () |
void | WaitForFence (uint64_t fence_value) |
Private Attributes | |
CommandQueue * | graphics_queue_ |
CommandQueue * | compute_queue_ |
CommandQueue * | copy_queue_ |
Manages all the CommandQueues in the application.
The CommandManager manages all the different CommandQueues in the engine. At any time, there are three different queues: a graphics queue, a compute queue and a copy queue. A big convenience that the CommandManager offers is the CPU/GPU synchronization features. Fence values are constructed in a unique way. The first (highest order) 8 bits are reserved for data that specifies the type of command queue the fence value is for. So by calling CommandManager::WaitForFence() and passing in a Blowbox generated fence value, it will automatically figure out which command queue needs to be waited on. This way, CPU/GPU synchronization becomes tentalizingly easy. That is the main purpose of the CommandManager.
blowbox::CommandManager::CommandManager | ( | ) |
Constructs the CommandManager.
blowbox::CommandManager::~CommandManager | ( | ) |
Destructs the CommandManager.
void blowbox::CommandManager::CreateCommandList | ( | D3D12_COMMAND_LIST_TYPE | type, |
ID3D12GraphicsCommandList ** | out_list, | ||
ID3D12CommandAllocator ** | out_allocator | ||
) |
Creates a ID3D12GraphicsCommandList with an ID3D12CommandAllocator that is ready for use.
[in] | type | The type of ID3D12GraphicsCommandList that should be created. |
[out] | out_list | The generated ID3D12GraphicsCommandList will be output here. |
[out] | out_allocator | The generated ID3D12CommandAllocator willl be output here. |
CommandQueue * blowbox::CommandManager::GetCommandQueue | ( | ) |
CommandQueue * blowbox::CommandManager::GetComputeQueue | ( | ) |
CommandQueue * blowbox::CommandManager::GetCopyQueue | ( | ) |
CommandQueue * blowbox::CommandManager::GetGraphicsQueue | ( | ) |
CommandQueue * blowbox::CommandManager::GetQueue | ( | D3D12_COMMAND_LIST_TYPE | type = D3D12_COMMAND_LIST_TYPE_DIRECT | ) |
[in] | type | The type of CommandQueue you want. |
bool blowbox::CommandManager::IsFenceComplete | ( | uint64_t | fence_value | ) |
Checks if a given fence value (point in time) has been passed by the corresponding command queue.
[in] | fence_value | The fence value that you want to check whether it has been passed. |
void blowbox::CommandManager::Startup | ( | ) |
Starts up the CommandManager.
void blowbox::CommandManager::WaitForFence | ( | uint64_t | fence_value | ) |
This function is blocking until a given fence point is hit by the corresponding CommandQueue.
[in] | fence_value | The fence value that has to be waited for. |
void blowbox::CommandManager::WaitForIdleGPU | ( | ) |
This function is blocking until all pending work in the CommandQueues is done executing.
|
private |
The compute CommandQueue.
|
private |
The copy CommandQueue.
|
private |
The graphics CommandQueue.