mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 19:48:20 +02:00
Expand DX reinit check
This commit is contained in:
parent
be0c4e5d88
commit
a17d666c57
2 changed files with 240 additions and 236 deletions
|
@ -1658,6 +1658,14 @@ void DXRenderWindow::SetAsTarget()
|
|||
mRenderDevice->mCurRenderTarget = this;
|
||||
}
|
||||
|
||||
void DXRenderWindow::CheckDXResult(HRESULT hr)
|
||||
{
|
||||
if ((hr == DXGI_ERROR_DEVICE_REMOVED) || (hr == DXGI_ERROR_DEVICE_RESET))
|
||||
((DXRenderDevice*)mRenderDevice)->mNeedsReinitNative = true;
|
||||
else
|
||||
DXCHECK(hr);
|
||||
}
|
||||
|
||||
void DXRenderWindow::Resized()
|
||||
{
|
||||
mRenderDevice->mResizeCount++;
|
||||
|
@ -1679,13 +1687,8 @@ void DXRenderWindow::Resized()
|
|||
mD3DRenderTargetView->Release();
|
||||
mD3DDepthStencilView->Release();
|
||||
|
||||
HRESULT hr = mDXSwapChain->ResizeBuffers(0, mWidth, mHeight, DXGI_FORMAT_UNKNOWN,
|
||||
DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH /*| DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT*/);
|
||||
|
||||
if ((hr == DXGI_ERROR_DEVICE_REMOVED) || (hr == DXGI_ERROR_DEVICE_RESET))
|
||||
((DXRenderDevice*)mRenderDevice)->mNeedsReinitNative = true;
|
||||
else
|
||||
DXCHECK(hr);
|
||||
CheckDXResult(mDXSwapChain->ResizeBuffers(0, mWidth, mHeight, DXGI_FORMAT_UNKNOWN,
|
||||
DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH /*| DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT*/));
|
||||
|
||||
D3D11_TEXTURE2D_DESC descDepth;
|
||||
ZeroMemory(&descDepth, sizeof(descDepth));
|
||||
|
@ -1702,9 +1705,9 @@ void DXRenderWindow::Resized()
|
|||
descDepth.MiscFlags = 0;
|
||||
mDXRenderDevice->mD3DDevice->CreateTexture2D(&descDepth, NULL, &mD3DDepthBuffer);
|
||||
|
||||
DXCHECK(mDXSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&mD3DBackBuffer));
|
||||
DXCHECK(mDXRenderDevice->mD3DDevice->CreateRenderTargetView(mD3DBackBuffer, NULL, &mD3DRenderTargetView));
|
||||
DXCHECK(mDXRenderDevice->mD3DDevice->CreateDepthStencilView(mD3DDepthBuffer, NULL, &mD3DDepthStencilView));
|
||||
CheckDXResult(mDXSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&mD3DBackBuffer));
|
||||
CheckDXResult(mDXRenderDevice->mD3DDevice->CreateRenderTargetView(mD3DBackBuffer, NULL, &mD3DRenderTargetView));
|
||||
CheckDXResult(mDXRenderDevice->mD3DDevice->CreateDepthStencilView(mD3DDepthBuffer, NULL, &mD3DDepthStencilView));
|
||||
|
||||
/*if (mRenderDevice->mCurRenderTarget == this)
|
||||
mRenderDevice->mCurRenderTarget = NULL;
|
||||
|
|
|
@ -161,6 +161,7 @@ public:
|
|||
|
||||
public:
|
||||
virtual void PhysSetAsTarget();
|
||||
void CheckDXResult(HRESULT result);
|
||||
|
||||
public:
|
||||
DXRenderWindow(DXRenderDevice* renderDevice, WinBFWindow* window, bool windowed);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue