• Advertisement

Archived

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

Validating / Resetting the device

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
i have got the same problem as you...
weird thing.

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

Share this post


Link to post
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 this post


Link to post
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 this post


Link to post
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

Share this post


Link to post
Share on other sites

  • Advertisement