#### Archived

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

# Validating / Resetting the device

This topic is 6084 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hello, I am wondering is it me, or in DirectX8.1 there must be a new way to validate and restore the device. My code:

HRESULT CGraphics::ValidateDevice(void)
{

HRESULT	hr = 0;

hr = m_pd3dDevice->TestCooperativeLevel();

if(FAILED( hr ))
{
if( hr == D3DERR_DEVICELOST )
return S_OK;

if( hr == D3DERR_DEVICENOTRESET )
{
hr = m_pd3dDevice->Reset( &m_d3dpp );

if(FAILED( hr ))
{
SetError( "Could not reset the device." );
PostQuitMessage( E_FAIL );
return E_FAIL;
}

Clear();
......

Doesn''t seem to reset the device correctly anymore -- any help would be appreciated. the m_d3dpp is a private member of the CGraphics class aka saved after the Initialization of Direct3D (which works fine ... why I don''t get this resetting part - worked in 8.0a ) Thanks for the help, David

##### Share on other sites
Are you remembering to release all video memory resources ?(and their references. And reset stuff like shaders, render states etc.

--
Simon O''''Connor
Creative Asylum Ltd
www.creative-asylum.com

##### Share on other sites
Yes I am, and still getting an error while trying to reset the device

##### Share on other sites
i have got the same problem as you...
weird thing.

if you found the answer , note me plz , thanks .
i''ll do the same.

Will do

##### Share on other sites
Will do You got an email address/aim name/? I think I got it and would like to talk with you directly if you don''t mind ( will e-mail if you don''t have aim ( I don''t have icq but do have mirc )

##### Share on other sites
Hi,

I had the same problem and in fact it seems that some driver
just take some more time to switch into a state that can be
resetted.

I''ve myself encountered this when switching to fullscreen or
windowed mode. My Reset looks a bit like this :

// YES -> Just set the new parameters.if ( FAILED(m_Vars.pD3DDevice->Reset( &d3dpp ) ) ){    HRESULT hr = m_Vars.pD3DDevice->TestCooperativeLevel();    if ( FAILED(hr) )    {	do	{	    ::Sleep(1000);	    hr = m_Vars.pD3DDevice->TestCooperativeLevel();	}	while (hr != D3DERR_DEVICENOTRESET);    }    // YES -> Just set the new parameters.    if ( FAILED(m_Vars.pD3DDevice->Reset( &d3dpp ) ) )    {	return false;    }}

In fact, when trying to reset the first time, the failed hr is
something like D3DERR_INVALIDCALL. The TestCooperativeLevel then
returns D3DERR_DEVICELOST. This result means that the device is
lost but can not be restored at current time. That''s why I wait
for a second and retry to get the result.

It is 100% certain that the result will change to D3DERR_DEVICENOTRESET.

That''s when I do my final reset attempt, which ime did never
fail (unless your reset params are totally false and unusable).

I hope this helps,
Metron

##### Share on other sites
David_Kay: Great! , heres my e-mail address:
velich@matavtv.net , contact me

Metron:
i tried what u wrote , but i still get an error message from the D3D8.DLL

1. 1
2. 2
Rutin
24
3. 3
4. 4
JoeJ
18
5. 5

• 14
• 17
• 11
• 11
• 9
• ### Forum Statistics

• Total Topics
631758
• Total Posts
3002155
×