Archived

This topic is now archived and is closed to further replies.

Impz0r

D3D lost device problem

Recommended Posts

hi, I''ve coding an D3D Renderer and will support window und fullscreen modus (window only for debuging). I''ve reading some tutorials about task-switching, mean from fullscreen to window moduns and vise-versa. So and there i run in to an problem, i''ve write this in my BeginScene Methode from the D3D Renderer attention code snipped :D VOID cD3DRenderer::BeginScene (VOID) { HRESULT hResult = m_pDevice->TestCooperativeLevel (); if (hResult == D3DERR_DEVICELOST) return; if (hResult == D3DERR_DEVICENOTRESET) { m_pDevice->Reset (&m_sD3DParams); } m_pDevice->Clear (0, NULL, D3DCLEAR_TARGET, 0, 1.0f, 0); m_pDevice->BeginScene (); } so but the DirectX SDK help tells me when i call the Reset() Method all resources would deleted. And this is bad, while i have to create all D3D textures and states and whatever more... Did someone had the same problem, and can me give an good solution how to avoid this? Thx Imp bugs are uncommented features...

Share this post


Link to post
Share on other sites
Not all resources are deleted. All vid mem resources are deleted.
Use managed resources (D3DPOOL_MANAGED). Then all vid mem resources are copied sysmem and back when required.
edit:
also remember to set all render states.


Edited by - stefu on July 29, 2001 7:23:20 AM

Share this post


Link to post
Share on other sites
hi,

hmmm, i''ve used the D3DPOOL_MANAGED flag but in several cases it wont work for me, i don''t no why.

is there an other way to do this?

thx imp

Share this post


Link to post
Share on other sites
You can also manually invalidate and restore resources. It''s done that way ind d3dapp examples (in D3D8 SDK). However, I use managed resources without any problems.

I had a problem when using ALT-TAB and resetting device.
I got nothing to screen after switching back to my game. The problem was that I didn''t set renderstates. After you called the pDevice->Reset(&m_d3dpp) you should call your function to set all render states. That includes also view/worl/proj matrices.

Share this post


Link to post
Share on other sites
hi,

yes i have the same behavior, my screen is totaly black after task switching, hmmm render states update, ok i will check this out. Thx m8

Imp

Share this post


Link to post
Share on other sites