BRE12
RenderTargetDescriptorManager.h
1 #pragma once
2 
3 #include <d3d12.h>
4 #include <mutex>
5 #include <wrl.h>
6 
7 #include <Utils/DebugUtils.h>
8 
9 namespace BRE {
10 // To create render target descriptor heaps
11 // To create render target descriptors
13 public:
17  const RenderTargetDescriptorManager& operator=(const RenderTargetDescriptorManager&) = delete;
20 
21  static void Init() noexcept;
22 
23  //
24  // The following methods return GPU descriptor handle for the render target views.
25  //
26  // In the case of methods that creates several views, it returns the GPU desc handle
27  // to the first element. As we guarantee all the other views are contiguous, then
28  // you can easily build GPU desc handle for other view.
29  //
30  // You can pass an optional D3D12_CPU_DESCRIPTOR_HANDLE to the first element.
31  // As we guarantee all the other views are contiguous, then
32  // you can easily build GPU desc handle for other view.
33  //
34 
35  static D3D12_GPU_DESCRIPTOR_HANDLE CreateRenderTargetView(ID3D12Resource& resource,
36  const D3D12_RENDER_TARGET_VIEW_DESC& descriptor,
37  D3D12_CPU_DESCRIPTOR_HANDLE* firstViewCpuDescriptorHandle = nullptr) noexcept;
38 
39  // Preconditions:
40  // - "resources" must not be nullptr
41  // - "descriptors" must not be nullptr
42  // - "descriptorCount" must be greater than zero
43  static D3D12_GPU_DESCRIPTOR_HANDLE CreateRenderTargetViews(ID3D12Resource* *resources,
44  const D3D12_RENDER_TARGET_VIEW_DESC* descriptors,
45  const std::uint32_t descriptorCount,
46  D3D12_CPU_DESCRIPTOR_HANDLE* firstViewCpuDescriptorHandle = nullptr) noexcept;
47 
48 private:
49  static Microsoft::WRL::ComPtr<ID3D12DescriptorHeap> mRenderTargetViewDescriptorHeap;
50 
51  static D3D12_GPU_DESCRIPTOR_HANDLE mCurrentRenderTargetViewDescriptorHandle;
52  static D3D12_CPU_DESCRIPTOR_HANDLE mCurrentRenderTargetViewCpuDescriptorHandle;
53 
54  static std::mutex mMutex;
55 };
56 
57 }
58 
Definition: RenderTargetDescriptorManager.h:12
Definition: Camera.cpp:8