BRE12
CommandListPerFrame.h
1 #pragma once
2 
3 #include <cstdint>
4 
5 #include <SettingsManager\SettingsManager.h>
6 #include <Utils\DebugUtils.h>
7 
8 struct ID3D12CommandAllocator;
9 struct ID3D12GraphicsCommandList;
10 struct ID3D12PipelinesState;
11 
12 namespace BRE {
13 // We support to have different number of queued frames.
14 // This class provides a command list that can be reset
15 // with a different command allocator per queued frame.
17 public:
19  ~CommandListPerFrame() = default;
21  const CommandListPerFrame& operator=(const CommandListPerFrame&) = delete;
23  CommandListPerFrame& operator=(CommandListPerFrame&&) = default;
24 
25  ID3D12GraphicsCommandList& ResetWithNextCommandAllocator(ID3D12PipelineState* pso) noexcept;
26  __forceinline ID3D12GraphicsCommandList& GetCommandList() noexcept
27  {
28  BRE_ASSERT(mCommandList != nullptr);
29  return *mCommandList;
30  }
31 
32 private:
33  ID3D12CommandAllocator* mCommandAllocators[SettingsManager::sQueuedFrameCount]{ nullptr };
34  ID3D12GraphicsCommandList* mCommandList{ nullptr };
35  std::uint32_t mCurrentFrameIndex{ 0U };
36 };
37 }
38 
Definition: Camera.cpp:8
Definition: CommandListPerFrame.h:16