Cannot reset device

Started by
13 comments, last by Uriel 20 years ago
After enabling dxdebug it turned out that dx is ''idiotenaparat'' after all.. i had many stupid bugs in code but it compiled under retail d3d and was running without problems.

Now all is corrected, but still Reset() fails. But now i get this from debug:

Direct3D9: (ERROR) :The following D3DPOOL_DEFAULT surfaces/buffers/textures still exist
Direct3D9: (ERROR) : D3DRTYPE_SURFACE
Direct3D9: (ERROR) : D3DRTYPE_TEXTURE
[...] // many more textures here
Direct3D9: (ERROR) : D3DRTYPE_TEXTURE
Direct3D9: (ERROR) : D3DRTYPE_VERTEXBUFFER
Direct3D9: (ERROR) : D3DRTYPE_VERTEXBUFFER
Direct3D9: (ERROR) : D3DRTYPE_VERTEXBUFFER
Direct3D9: (ERROR) : D3DRTYPE_SURFACE
Direct3D9: (ERROR) :All user created D3DPOOL_DEFAULT surfaces must be freed before Reset can succeed. Reset Fails.
Unhandled exception at 0x77f813b1 in dupa.exe: User breakpoint.

I have all textures in one place, and all are D3DPOOL_MANAGED.. same thing with VertexBuffers. I release surfaces before calling Reset() (same thing with VertexBuffers).
Advertisement
Are you sure that it needs to be reset?

For ex. When a fullscreen app gets minimized, the device gets lost, but you don''t want to reset until, it exits the minimized state...
Yes, im sure it has to be reseted since TestCooperativeLevel() returns D3DERR_DEVICELOST. For example when i mninimalize my fullscreen app to taskbar, it loses focus and device is lost. Then i test in loop until i encounter DEVICENORESET state, then i release all POOL_DEFAULT res and i call Reset().

Now here is the funny part: sometimes when i trigger DEVICELOST by pressing [ctrl alt del] or [alt tab] TestCooperativeLevel() somehow returns D3D_OK and app enters render loop - and crashes in random place inside.
Sometimes it detects DEVICELOST properly but crashes inside
Reset() and dx debug says that it was due to unfreed POOL_DEFAULT textures/surfaces/meshes. But i release _all_ textures/surfaces/meshes (even those not POOL_DEFAULT) i use just before calling Reset().

I dont think its normal since according to docs it should ''silently fail'' and render grey screen, not crash..
This might actually be indicative of more problems throughout your code. Are you sure you get/release and correctly?

Every time you GetSurfaceLevel on a texture, you need to release the surface. Every time you GetRenderTarget or GetDepthStencilSurface, you need to release the surface. If you''ve somehow kept something locked, your release for Reset won''t actually free the texture/vb.
How very true.. most errors where in my water surface rendering, where i render to texture.. i deleted whole code and ill rewrite it later.

Now i can reset device properly.
Thank you all for help

And i have another question :>

When in fullscreen, if i [ALT TAB] device is reseted properly.
But if press [CTRL ALT DEL] i get memory write exception and app crashes in random place. It happens only when i use lights.

Is there a difference between loosing device with ALT TAB and CTRL ALT DEL ? And why light has smth to do with it?

Ed: it crashes on that line:
lpD3DDevice->EndScene();
if just before it i call TestCooperativeLevel() it crashes on Test..



[edited by - Uriel on April 17, 2004 5:03:20 PM]

This topic is closed to new replies.

Advertisement