Jump to content
  • Advertisement
Sign in to follow this  
JonasB

[.net] [MDX] Device lost (or something)

This topic is 4242 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'm changing a project of mine so that I can switch between IDE mode (MDI window with tools etc) and "clean mode" (just the rendering form) in runtime. The render control is a User Control, hosted by a form. The switch to IDE mode is done simply by creating a new Mdi form and setting the MdiParent of the render form to the new Mdi form. However, when I do this, I get a D3D error. The device is *not* lost; at least I don't get the DeviceLost event. (Not sure about the actual error, because when I use D3D debug mode the app doesn't even start.) I've tried letting some time pass before Present() after the switch, doesn't work. Any ideas what it could be and how to avoid it? If I have to dispose of the device and recreate it after the switch, what's the best way? Is there some way to automatically reload the data (textures etc), or do I have to do that manually? Thanks a lot, Jonas

Share this post


Link to post
Share on other sites
Advertisement
I think you should be able to keep the same device. You may need to create a new swap chain or something though. I think Device.Present has an overload that takes a control as a parameter, you might try explicitly passing the control you're rendering to.

Share this post


Link to post
Share on other sites
Thanks - I'm a swap-chain illiterate, but your answer was spot-on; Present() does take an optional Control. Setting the Mdi seems to recreate the underlying controls (the Handle changes in the process).

Might be some drawback to this, but it seems just fine.

Share this post


Link to post
Share on other sites
Yeah, that makes sense. The only drawback I could think of is if the render target was resized.. you'd still need to manually resize the back buffer. I normally use SwapChains and just recreate them whenever something happens, so I don't run into this kind of problem.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!