In CD3D9Driver::reset() the pID3DDevice is reset, i believe the check for the result isnt in the correct place.
I believe the code should be changed:
- cpp Code: Select all
HRESULT hr = pID3DDevice->Reset(&present);
/* Code to be moved*/
if (FAILED(hr))
{
/* All the error checks */
return false;
}
/*Move the code here */
this way the function will return false before it can use the surfaces which might not be freed up.
In my situation the reset resulted in D3DERR_INVALIDCALL, but since the following line is above the error checking it throws an exception.
- cpp Code: Select all
pID3DDevice->GetDepthStencilSurface(&(DepthBuffers[0]->Surface));
