Skip to content

Commit

Permalink
Re-added backbuffer RTV to always draw to the right buffer on all sys…
Browse files Browse the repository at this point in the history
…tems.
  • Loading branch information
Friendly0Fire committed Feb 28, 2022
1 parent 4e2413d commit ac9916f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 2 additions & 0 deletions GW2Radial/include/Core.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ class Core : public Singleton<Core>

ComPtr<ID3DUserDefinedAnnotation> annotations_;

ComPtr<ID3D11RenderTargetView> backBufferRTV_;

RENDERDOC_API_1_5_0* rdoc_ = nullptr;
};
}
12 changes: 11 additions & 1 deletion GW2Radial/src/Core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,17 @@ LRESULT Core::WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)

void Core::PreResizeSwapChain()
{

backBufferRTV_.Reset();
}

void Core::PostResizeSwapChain(uint w, uint h)
{
screenWidth_ = w;
screenHeight_ = h;

ComPtr<ID3D11Texture2D> backbuffer;
swc_->GetBuffer(0, IID_PPV_ARGS(backbuffer.GetAddressOf()));
device_->CreateRenderTargetView(backbuffer.Get(), nullptr, backBufferRTV_.ReleaseAndGetAddressOf());
}

void Core::PostCreateSwapChain(HWND hwnd, ID3D11Device* device, IDXGISwapChain* swc)
Expand Down Expand Up @@ -181,6 +185,10 @@ void Core::PostCreateSwapChain(HWND hwnd, ID3D11Device* device, IDXGISwapChain*

context_->QueryInterface(annotations_.ReleaseAndGetAddressOf());

ComPtr<ID3D11Texture2D> backbuffer;
swc_->GetBuffer(0, IID_PPV_ARGS(backbuffer.GetAddressOf()));
device_->CreateRenderTargetView(backbuffer.Get(), nullptr, backBufferRTV_.GetAddressOf());

DXGI_SWAP_CHAIN_DESC desc;
swc_->GetDesc(&desc);

Expand Down Expand Up @@ -303,6 +311,8 @@ void Core::Draw()
StateBackupD3D11 d3dstate;
BackupD3D11State(context_.Get(), d3dstate);

context_->OMSetRenderTargets(1, backBufferRTV_.GetAddressOf(), nullptr);

// This is the closest we have to a reliable "update" function, so use it as one
Input::i().OnUpdate();

Expand Down

0 comments on commit ac9916f

Please sign in to comment.