Jump to content
  • Advertisement


Sign in to follow this  
  • entries
  • comments
  • views

Security through instability.

Sign in to follow this  


So I observed an interesting problem with Managed DirectX, Vista and running Visual Studio 2005 as Administrator (I do this because dbmon doesn't work properly if I run as a normal user).

Yes, I'm still working on Gorgon. I refactored it a couple of times in an attempt to streamline a few things and clean out some leftover garbage.

Anyway, the quirk.

So, after refactoring and removing a lot of junk code regarding lost devices I decided to test it. I switch to full screen mode (which is a fake device loss, as it's initiated by the library), this works beautifully. So I alt+tab back to the desktop. No errors, awesome. I switch back... and the fun begins. The window doesn't even appear, nothing happens at all. Usually this comes from polling for a lost device logic, but after confirming the logic was fine I was at a loss. So I run dbmon and check the debug messages, and this is what I saw:

FATAL ERROR! What the fuck man? I mean really, I had NEVER seen that error before. So I decide to check it outside of the IDE (which I'm doing regularly after a debacle involving multi-threading and VB.NET at work). I perform the tests again and what do you know? I get an error when I go to switch back to the application. I launch a debugging process and it's just a normal problem (that is, I'm dumb and forgot to check for a lost device condition before calling a Device method). So it got me thinking... what's different? I know! I'm running at admin level with the IDE. So I switch it to user level and the device loss and reset works as it should (minus the aforementioned stupidity on my part). So hopefully this will help someone else who might be running into the same problems.

Device loss/reset stuff is very annoying, and requires a bit of thought considering that MDX decides to throw exceptions all over the place if a device is lost (this is incredibly stupid, considering it's pretty harmless to call things while a device is lost in C++, you'll get just an non-SUCCESS HRESULT). I know I can turn off exceptions, but what happens here is that ALL the exceptions get turned off. This is not desirable either since I can't check for an error condition on particular methods/properties. So I'm damned if I do, and damned if I don't. Clearly this part wasn't well thought out.

Hopefully Promit and others can get SlimDX fleshed out sometime.
Sign in to follow this  


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 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!