RavEngine
Loading...
Searching...
No Matches
D3D12CommandQueue.hpp
1#pragma once
2#include <RGL/Types.hpp>
3#include <RGL/CommandQueue.hpp>
4
5#include <directx/d3d12.h> // For ID3D12CommandQueue, ID3D12Device2, and ID3D12Fence
6#include <wrl.h> // For Microsoft::WRL::ComPtr
7
8#include <cstdint> // For uint64_t
9
10namespace RGL {
11 struct DeviceD3D12;
12
13 struct CommandQueueD3D12 : public ICommandQueue, public std::enable_shared_from_this<CommandQueueD3D12>{
14
15 RGLCommandBufferPtr CreateCommandBuffer() final;
16
17 CommandQueueD3D12(const DeviceD3D12* device, QueueType type);
18 virtual ~CommandQueueD3D12() {}
19
20 // Execute a command list.
21 // Returns the fence value to wait for for this command list.
22 uint64_t ExecuteCommandList(Microsoft::WRL::ComPtr<ID3D12GraphicsCommandList2> commandList);
23
24 uint64_t Signal();
25 bool IsFenceComplete(uint64_t fenceValue);
26 void WaitForFenceValue(uint64_t fenceValue);
27 void Flush();
28
29 Microsoft::WRL::ComPtr<ID3D12CommandQueue> GetD3D12CommandQueue() const {
30 return m_d3d12CommandQueue;
31 }
32
33 Microsoft::WRL::ComPtr<ID3D12GraphicsCommandList2> CreateCommandList();
34
35 D3D12_COMMAND_LIST_TYPE m_CommandListType;
36 Microsoft::WRL::ComPtr<ID3D12Device2> m_d3d12Device;
37 Microsoft::WRL::ComPtr<ID3D12CommandQueue> m_d3d12CommandQueue;
38 Microsoft::WRL::ComPtr<ID3D12Fence> m_d3d12Fence;
39
40 const DeviceD3D12* owningDevice = nullptr;
41
42 HANDLE m_FenceEvent;
43 uint64_t m_FenceValue;
44
45 void WaitUntilCompleted() final {
46 Flush();
47 }
48
49 QueueData GetQueueData() final;
50 };
51
52}
Definition D3D12CommandQueue.hpp:13
Definition D3D12Device.hpp:21
Definition CommandQueue.hpp:27
Definition CommandQueue.hpp:15