BRE12
AmbientOcclusionCmdListRecorder.h
1 #pragma once
2 
3 #include <DirectXMath.h>
4 #include <vector>
5 
6 #include <CommandManager\CommandListPerFrame.h>
7 #include <ResourceManager\FrameUploadCBufferPerFrame.h>
8 
9 struct D3D12_CPU_DESCRIPTOR_HANDLE;
10 struct ID3D12Resource;
11 
12 namespace BRE {
13 struct FrameCBuffer;
14 
15 // Responsible of command lists recording to be executed by CommandListExecutor.
16 // This class has common data and functionality to record command list for ambient occlusion pass.
18 public:
22  const AmbientOcclusionCmdListRecorder& operator=(const AmbientOcclusionCmdListRecorder&) = delete;
25 
26  static void InitSharedPSOAndRootSignature() noexcept;
27 
28  // Preconditions:
29  // - InitSharedPSOAndRootSignature() must be called first and once
30  void Init(ID3D12Resource& normalSmoothnessBuffer,
31  ID3D12Resource& depthBuffer,
32  const D3D12_CPU_DESCRIPTOR_HANDLE& renderTargetView) noexcept;
33 
34  // Preconditions:
35  // - Init() must be called first
36  void RecordAndPushCommandLists(const FrameCBuffer& frameCBuffer) noexcept;
37 
38  bool ValidateData() const noexcept;
39 
40 private:
41  void CreateSampleKernelBuffer(const std::vector<DirectX::XMFLOAT4>& sampleKernel) noexcept;
42  ID3D12Resource* CreateAndGetNoiseTexture(const std::vector<DirectX::XMFLOAT4>& noiseVector) noexcept;
43  void InitShaderResourceViews(ID3D12Resource& normalSmoothnessBuffer,
44  ID3D12Resource& depthBuffer,
45  ID3D12Resource& noiseTexture,
46  const std::uint32_t sampleKernelSize) noexcept;
47 
48  CommandListPerFrame mCommandListPerFrame;
49 
50  FrameUploadCBufferPerFrame mFrameUploadCBufferPerFrame;
51 
52  UploadBuffer* mSampleKernelUploadBuffer{ nullptr };
53 
54  D3D12_CPU_DESCRIPTOR_HANDLE mRenderTargetView{ 0UL };
55 
56  D3D12_GPU_DESCRIPTOR_HANDLE mStartPixelShaderResourceView{ 0UL };
57 };
58 }
59 
Definition: AmbientOcclusionCmdListRecorder.h:17
Definition: Camera.cpp:8
Definition: FrameUploadCBufferPerFrame.h:11
Definition: CBuffers.h:23
Definition: CommandListPerFrame.h:16
Definition: UploadBuffer.h:9