Skip to main content
GameDev.net gamedev.net
🔒 Locked

LostDevice problem

Started by Noxil Oct 3, 2010 at 4:40 PM 1 replies 750+ views
Original Post
Noxil
Noxil

Hello,

I have read some of the other posts on this forum regarding this but I dident find anyone that could help me.

So here it goes.

When I toggle from fullscreen to windowed mode, it works perfect.
Untill I use a shader...

If I have loaded a shader, it enters fullscreen and the instantly switches back to windowed.

This problem disappears if I dont load the shader.

This is how I load my shader:
D3DXCreateEffectFromFile(direct3d->device, path.c_str(), 0, 0, 0, 0, &shader, &compilationError);


And I simply use the OnLostDevice and OnResetDevice functions when I detect a lost device.
Buckeye
Buckeye
Quote:
it enters fullscreen and the instantly switches back to windowed

That's controlled by your code - how you reset the device when the device status changes. Are you sure you have a LOST device? Do you call effect->OnLostDevice() before you reset the device?

Perhaps you should post your code for resetting the device.
Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly. You don't forget how to play when you grow old; you grow old when you forget how to play.
Noxil
Noxil

Ah you gave me an ide and I fixed the problem!
Thank you :)

The problem was when I switched from fullscreen to windowed all I did was handle the OnLostDevice etc for the device, parameters and sprite.

I was somehow hoping that all shaders and other objects would be taken care of during:

HRESULT hr = direct3d->device->TestCooperativeLevel();	if(hr == D3DERR_DEVICELOST)	{		Sleep(20);		return true;	}	else if(hr == D3DERR_DRIVERINTERNALERROR)	{		MessageBox(NULL, "Internal Driver Error... Exiting", "Error", MB_OK | MB_ICONERROR);		PostQuitMessage(0);		return true;	}	else if(hr == D3DERR_DEVICENOTRESET)	{		ResetDevice();	}	return false;


But when I also added that all objects such as shaders and textures where handled when I toggled the problem was gone!

But what I can see now when I draw a small box(in wireframe) is that when I switch back to windowed it has really rough edges, it dident have that befor.

Its probably something simple! It tends to be :p

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.