Sign in to follow this  

MDX AutoDepthStencilFormat causing out of memory exception

This topic is 4034 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 guys, I've been using the same code for weeks now in an MDX project, but yesterday it suddenly started throwing OutOfVideoMemoryExceptions whenever I created the Device. I've tracked the problem down to the PresentParameters, and specifically AutoDepthStencilFormat and EnableAutoDepthStencil. When I remove these, the apps launch as expected. This happens in apps which were working and have been unchanged for weeks. Has anyone else ever come across this? As I said, it just seemed to come out of nowhere. The only thing I can think of that could cause the problem was that I installed an old game a few days ago (The Longest Journey), but I still told it not to install DirectX (7 I think). I tried uninstalling it, but typically it crashed, so I deleted it manually. Here's the code I use for the present params, with the depth stencil code removed. Its fairly typical stuff:
            PresentParameters presentParams = new PresentParameters();
            presentParams.SwapEffect = SwapEffect.Discard;
            presentParams.Windowed = true;
            //presentParams.AutoDepthStencilFormat = DepthFormat.D16;
            //presentParams.EnableAutoDepthStencil = true;
            presentParams.BackBufferHeight = this.Height;
            presentParams.BackBufferWidth = this.Width;
            presentParams.BackBufferCount = 1;

Any help would be massively appreciated, as this is a final year project, and I have no wish to reinstall windows and everything else that goes with it. I'm using the October 2006 SDK- although I only just upgraded to this from possibly the April 2006 one, but it could have been older than that. I only upgraded to see if it would solve the problem, and needless to say it didnt. Could it be an Nvidia driver issue? I've not gotten round to trying that yet, as it usually causes more problems than it solves.

Share this post


Link to post
Share on other sites
I recall an issue where not setting the AutoDepthStencil format (even if EnableAutoDepthStencil was set to false) would fail device creation. I havn't encountered a case where adding it would cause it to fail.

Some ideas:

Do you not have any code before the device creation? Is there any chance you're doing something funky and causing a stack overflow, or some other memory related error?

Do you call CheckDepthStencilMatch to make sure the backbuffer and DS formats match and are supported?

I don't see the backbuffer format anywhere. Did you just not include it in the code you pasted or is it never set? Either way, try setting it to X8R8G8B8, as that should be supported.

If all these fail, try enabling the debug runtimes and look for warnings that might clue you in as to why it's failing.

Hope this helps.

Share this post


Link to post
Share on other sites
Fear not, the panic is over. It turned out that it was indeed a problem with the graphics driver. I uninstalled my old 6600GT drivers and put in the latest, and the problem vanished.

The real question is what caused it to suddenly go all weird with just the Z buffer in the first place? Rest assured I'll be keeping The Longest Journey the hell away from my PC until the project is over. I'm even scared to fire up Oblivion now.

Thanks for the suggestions anyway guys. Steve, the height and width were correct for the form, and Sirob, I tried setting the format before upgrading the drivers, but it had no effect. As I said, all of this code was working prior to installing TLJ. There was also no code at all before the device creation- it was the first line executed that I had control over.

Well, I'l sleep easy now that its all okay. And to anyone running old games on a development PC- don't.

Share this post


Link to post
Share on other sites

This topic is 4034 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.

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

Sign in to follow this