Jump to content
  • Advertisement
Sign in to follow this  
Kija

IDirect3DDevice9::Reset() - unsupported mode? *solved*

This topic is 4842 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

Hi, I know there has been alot of threads about Reset() but I still couldn't find the solution (or at least not the explanation) to why I get this error. So I have a application with some resources loaded and in fullscreen, standard problem: I tab out and go in again, lost device. So I followed the guidelines. I released my resources, tried to reset when I get D3DERR_DEVICENOTRESET from TestCooperateLevel. When it didn't work I enabled debugging info and found that I had a couple of resources that wasn't released. So I fixed that and now I get this: Direct3D9: :StartExclusiveMode Direct3D9: (ERROR) :The specified mode is unsupported. CreateDevice/Reset Fails Direct3D9: (ERROR) :Unable to set the new mode. CreateDevice/Reset Fails Direct3D9: (ERROR) :Reset failed and Reset/TestCooperativeLevel/Release are the only legal APIs to be called subsequently Direct3D9: :DoneExclusiveMode Direct3D9: :INACTIVE: 00000d78: Restoring original mode (1280x1024x22x85) at adapter index 0 Direct3D9: :Unsubclassing window 000602c2 Direct3D9: :Subclassing window 000602c2 The thing I find strange is that the only thing I send to that reset is the presentParameters that I use when I started the application (and then it works great). So why whould the "specified mode" be unsupported, just because I tab out and in again? I initialize the presentparameters right at the start of the application, and I never touch it again. So why would the mode suddenly be unsupported? Forget me if I'm stupid, I'm fairly new to DirectX. EDIT: And a followup question. In a "big" game / application. Wouldn't it be terrible slow to release all huge textures / meshes and other stuff and then reload them everytime you tab out? Or maybe 99% of the resources is D3DPOOL_MANAGED and then there's no need to free / reload them? [Edited by - Kija on August 15, 2005 5:40:47 AM]

Share this post


Link to post
Share on other sites
Advertisement
Hello Kija!

Could you post here your device reset code? That is strange error, never had that one. Im also using same pp foir device init and reset, and all works fine...

Share this post


Link to post
Share on other sites

hr = d3dDevice->TestCooperativeLevel();

if (SUCCEEDED(hr))
{
HandleInput();
Render();
}
else if (hr == D3DERR_DEVICELOST) // This is just here for testing purposes
{
// Do nothing, device is not ready for reset
}
else if(hr == D3DERR_DEVICENOTRESET)
{
FreeResources();
if (SUCCEEDED(d3dDevice->Reset(&d3dpp)))
ReloadResources();
}




EDIT: I'll add my presentParameters too since I'm very unsure if they are right :) But they work when I start the app so I find it strange that they don't work when I try to reset.


if (FULLSCREEN) d3dpp.Windowed = FALSE;
else d3dpp.Windowed = TRUE;
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
if (FULLSCREEN) d3dpp.BackBufferFormat = D3DFMT_A8R8G8B8;
else d3dpp.BackBufferFormat = D3DFMT_UNKNOWN;
d3dpp.EnableAutoDepthStencil = TRUE;
d3dpp.AutoDepthStencilFormat = D3DFMT_D16;
d3dpp.BackBufferWidth = APP_WIDTH;
d3dpp.BackBufferHeight = APP_HEIGHT;
d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;



FULLSCREEN is set to true.

Share this post


Link to post
Share on other sites
hmmm.. try it this way:

HRESULT hr = lpD3DDevice->TestCooperativeLevel();

if(FAILED(hr)){ // Device propably lost

if(hr==D3DERR_DEVICELOST){

// yup its lost

}else if(hr==D3DERR_DEVICENOTRESET){



FreeResources();



lpD3DDevice->Reset(pp);

hr=lpD3DDevice->TestCooperativeLevel();

if(hr==D3D_OK){

ReloadResources();

}
}
}else{

HandleInput();
Render();
}

edit: hell, how do you add code tags, so its displayed formatted?

Share this post


Link to post
Share on other sites
Hmm, still doesn't work. The only thing changed in your version is that the ReloadResources() call is made depending on another criteria than before. The Reset() call is still the one that is not falling through. Well, I have no idea what could be wrong so any and all ideas are welcome.

Share this post


Link to post
Share on other sites
What card do you have? Have you tried different BackBufferFormat and AutoDepthStencilFormats ?

Share this post


Link to post
Share on other sites
GeForce 6800GT, and I haven't really tried to change the presentParameters, but I can't really see why that would make any difference since the presentParameters define a mode that works when I start the app, but the same presentParameters define a mode that is unsupported when I alt tab. Very strange... :S It has to be some really basic problem though. Since I'm very new to DirectX I've probably done something terribly stupid heh :)

Share this post


Link to post
Share on other sites
Im affraid thats propably the case here ;-), no but seriously:

I tried google - dont know if you have seen taht one, but worth trying:

http://www.flipcode.org/cgi-bin/fcmsg.cgi?thread_show=15524

Problem was similar and it was connected with driver.. also i noticed that your desktop works in hires, so it may be the case..

Share this post


Link to post
Share on other sites

1) Try Freeing your resources on the DEVICELOST message, not DEVICENOTRESET

2) Set a breakpoint (or use printf debugging) and examine your present parameters to make sure they're what you think they are. Lots of things (including memory stomping bugs) could explain why they aren't what you think.

Share this post


Link to post
Share on other sites
I had the same problem a couple of months ago, if you are using an effect file, the reset of the device would fail. Sorry, i can't remember how i fixed it and my hard drive just got reformated. Everything would load and unload fine, but if i created and ID3DXEffect, when m_pD3DDevice->Reset(), wouldn't work.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!