CD3D9Driver::reset() HRESULT check

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
Qps
Posts: 18
Joined: Thu Jan 27, 2011 2:02 pm

CD3D9Driver::reset() HRESULT check

Post by Qps »

Hi

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:

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.

Code: Select all

pID3DDevice->GetDepthStencilSurface(&(DepthBuffers[0]->Surface));
Post Reply