Skip to content

Commit

Permalink
D3D9: fixed device failing to reset
Browse files Browse the repository at this point in the history
This is because backbuffer did not have matching number of Releases after querying initial render target, causing it to stay in resources.

Was broken by aa0647d
  • Loading branch information
ivan-mogilko committed Feb 18, 2024
1 parent a246d0b commit 5994b90
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Engine/platform/windows/gfx/ali3dd3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,7 @@ void D3DGraphicsDriver::SetupViewport()
direct3ddevice->GetRenderTarget(0, &backbuffer);
_screenBackbuffer = BackbufferState(backbuffer, Size(_mode.Width, _mode.Height), _srcRect.GetSize(),
_dstRect, mat_ortho, _scaling, _filter ? _filter->GetSamplerStateForStandardSprite() : D3DTEXF_POINT);
backbuffer->Release();

// View and Projection matrixes are currently fixed in Direct3D renderer
_stageMatrixes.View = identity;
Expand Down Expand Up @@ -769,8 +770,8 @@ HRESULT D3DGraphicsDriver::ResetD3DDevice()
{
DestroyDDB(_nativeSurface);
_nativeSurface = nullptr;
_nativeBackbuffer = BackbufferState();
}
_nativeBackbuffer = BackbufferState();
ReleaseRenderTargetData();
HRESULT hr = direct3ddevice->Reset(&d3dpp);
if (hr != D3D_OK)
Expand Down

0 comments on commit 5994b90

Please sign in to comment.