Advertisement
RRRella

D3D12Core

Jan 27th, 2021
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.63 KB | None | 0 0
  1. class D3D12Core
  2.     {
  3.     public:
  4.         D3D12Core();
  5.         ~D3D12Core() = default;
  6.         static D3D12Core& Get()
  7.         {
  8.             if(s_Instance == nullptr)
  9.                 s_Instance = new D3D12Core();
  10.             return *s_Instance;
  11.         }
  12.         ComPtr<ID3D12Device2> GetDevice() const { return m_Device; }
  13.         Ref<CommandQueue> GetCommandQueue(D3D12_COMMAND_LIST_TYPE type);
  14.         ComPtr<ID3D12Resource> GetCurrentBackBuffer(UINT current) { return m_BackBuffers[current]; }
  15.         uint32_t GetClientWidth() const {return m_ClientWidth;}
  16.         uint32_t GetClientHeight() const { return m_ClientHeight; }
  17.         ComPtr<ID3D12Device2> CreateDevice(bool bUseWarp);
  18.         ComPtr<ID3D12DescriptorHeap> CreateDescriptorHeap(UINT numDescriptors, D3D12_DESCRIPTOR_HEAP_TYPE type);
  19.         ComPtr<IDXGISwapChain4> CreateSwapChain(HWND windowHandle,ComPtr<ID3D12CommandQueue> commandqueue, uint32_t width, uint32_t Height);
  20.         void UpdateRenderTargetViews(ComPtr<IDXGISwapChain4> swapChain, ComPtr<ID3D12DescriptorHeap> descriptorHeap);
  21.         bool CheckTearingSupport();
  22.         static const uint8_t m_BufferCount = 3;
  23.         ComPtr<ID3D12Resource> m_BackBuffers[m_BufferCount];
  24.         uint64_t m_FenceValues[m_BufferCount];
  25.     private:
  26.         void ParseCommandLineArguments();
  27.         uint32_t m_ClientWidth = 1280;
  28.         uint32_t m_ClientHeight = 720;
  29.         Ref<CommandQueue> m_DirectCommandQueue;
  30.         Ref<CommandQueue> m_ComputeCommandQueue;
  31.         Ref<CommandQueue> m_CopyCommandQueue;
  32.         ComPtr<ID3D12Device2> m_Device;
  33.         bool m_UseWarp;
  34.         static D3D12Core* s_Instance;
  35.     };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement