Page 1 of 1

help~ Lost & Reset D3DDevice error

Posted: Thu Mar 06, 2008 05:24
by chendot
Hi,
I've got a problem like this, I used d3d and CEGUI in my project, and when I change the program between window mode and fullscreen mode or resize the window form, I should lost and reset the d3ddevice as below.

Code: Select all

case WM_SIZE:
   // ...
   OnLostDevice();
   m_pD3DDevice->Reset(&m_D3DPP);
   OnResetDevice();
   // ...

everything goes ok before I add CEGUI. when I added CEGUI to my project, and the m_pDX9Renderer->preD3DReset() and postD3DReset() methods are added in OnLostDevice() and OnResetDevice() sparately. it always report error at reset(&m_D3DPP) step. any advice please...Are these enough when reset the D3D device? many thanks!

Posted: Thu Mar 06, 2008 09:56
by CrazyEddie
Hi,

I did not personally test this yet as I'm not on Windows much, in the mean time if you can give any additional information regarding the exact error you're getting from the call to Reset, that would be most helpful.

I'll try to test the reset logic for myself later on today, though I can't promise that I will get to it until maybe the weekend.

CE.

Posted: Thu Mar 06, 2008 11:26
by chendot
Hi CE, thank you for replying:)

The output information about this error is "d:\projects\cfscene\cfd3dapp.cpp(176): m_pD3DDevice->Reset(&m_D3DPP) hr=D3DERR_INVALIDCALL (0x8876086c)", and I guess it cause by the CEGUI::DirectX9Renderer object fail to Lost D3D device, which I first thought preD3DReset should help to do that.

Posted: Thu Mar 06, 2008 19:23
by CrazyEddie
Hello,

thanks for the extra information. You are correct that this call should allow the device reset to proceed. It seems that we are not releasing something that we should be; I did not get a chance to look at this today, but will definitely get around to it tomorrow.

By all accounts it's a bug in the renderer module, so has been added to mantis as ticket #174. I'll update the ticket after I've confirmed this issue tomorrow.

CE.

Posted: Fri Mar 07, 2008 12:05
by CrazyEddie
Hi,

I have tested this and was unable to reproduce the issue. I added logging calls to the D3D9 renderer to log when the pre/post reset calls are made, and rigged the test framework to run fullscreen and did alt-tab to cause the device to be lost (don't ask, it was the easiest way to run a test of the device lost handling built into the example framework). Upon re-activating the demo app, everything was restored as it should be, with the pre/post reset calls being logged.

"D3DERR_INVALIDCALL" is supposed to signal that the call / argument value is incorrect rather than the device still being lost (in which case the return should have been D3DERR_DEVICELOST).

I'm not sure what else to suggest at the moment, since it all appears to work ok here. If you could do some more checking and maybe create a minimal example that sill exhibits the behaviour and report back, I'll check it again.

CE.

Posted: Sun Mar 09, 2008 16:59
by chendot
Hi CE,

My mistake :oops: , I've found what the problem is. Originally I call the OnResetDevice() at the constructor, that cause the error after adding the postResetD3D() to OnResetDevice() method.

Thank you for your attention:)

Posted: Sun Mar 09, 2008 17:30
by CrazyEddie
:D

Thanks for letting me know; I'll close the mantis ticket.

CE.