Rework DX12 overlay to use Present to render the overlay

This commit is contained in:
Nemirtingas 2019-10-15 08:41:07 +02:00
parent c006555b01
commit c667dbd3af
2 changed files with 127 additions and 55 deletions

View file

@ -20,8 +20,13 @@ private:
bool hooked;
bool initialized;
DXGI_SWAP_CHAIN_DESC sc_desc;
ID3D12CommandQueue* pCmdQueue;
UINT bufferCount;
D3D12_CPU_DESCRIPTOR_HANDLE* pMainRenderTargets;
ID3D12CommandAllocator** pCmdAlloc;
ID3D12DescriptorHeap* pSrvDescHeap;
ID3D12GraphicsCommandList* pCmdList;
ID3D12DescriptorHeap* pRtvDescHeap;
// Functions
DX12_Hook();
@ -34,13 +39,11 @@ private:
static HRESULT STDMETHODCALLTYPE MyResizeTarget(IDXGISwapChain* _this, const DXGI_MODE_DESC* pNewTargetParameters);
static HRESULT STDMETHODCALLTYPE MyResizeBuffers(IDXGISwapChain* _this, UINT BufferCount, UINT Width, UINT Height, DXGI_FORMAT NewFormat, UINT SwapChainFlags);
static void STDMETHODCALLTYPE MyExecuteCommandLists(ID3D12CommandQueue *_this, UINT NumCommandLists, ID3D12CommandList* const* ppCommandLists);
static HRESULT STDMETHODCALLTYPE MyClose(ID3D12GraphicsCommandList* _this);
decltype(&IDXGISwapChain::Present) Present;
decltype(&IDXGISwapChain::ResizeBuffers) ResizeBuffers;
decltype(&IDXGISwapChain::ResizeTarget) ResizeTarget;
decltype(&ID3D12CommandQueue::ExecuteCommandLists) ExecuteCommandLists;
decltype(&ID3D12GraphicsCommandList::Close) Close;
public:
virtual ~DX12_Hook();
@ -49,7 +52,7 @@ public:
static DX12_Hook* Inst();
virtual const char* get_lib_name() const;
void loadFunctions(ID3D12CommandQueue* pCommandQueue, ID3D12GraphicsCommandList* pCommandList, IDXGISwapChain* pSwapChain);
void loadFunctions(ID3D12CommandQueue* pCommandQueue, IDXGISwapChain* pSwapChain);
};
#endif//NO_OVERLAY