Jump to content
  • Advertisement
Sign in to follow this  
trick

Runs in debug, not release

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

I am using Visual C++ 2010 Express, and I just finished the basics of my engine code, and wanted to test under release to ensure it worked properly. I started by changing the settings in the directx control panel to force debug layer off, swapped to release mode, and added the include and lib directories (same as the debug directories). The program compiles and links fine, with no errors, but when I try to run the executable it crashes. I am using DirectInput for all input and XAudio2 for sound. The sounds I have playing actually start before the program crashes, so I'm sure it's in the graphics.

The odd thing in, I can navigate in windows to the debug executable, and it runs perfectly fine. Is there some other step that must be taken when switching to release mode for it to run properly, when running D3D11? I've been looking for a while now, and the only things I can find are questions about getting an app to run on a different computer, not just swapping from debug to release.

Thanks!

Share this post


Link to post
Share on other sites
Advertisement
When you switch to release mode, a lot more optimizations are enabled by default, and the runtime no longer initializes variables and memory for you. If you're unlucky, this will uncover a bug when you've been unwittingly relying on this behaviour. I would recommend running a release build with the debugger attached (e.g. by switching profile to 'release' and hitting F5). What will probably happen is that you'll discover that you're doing something like dereferencing an uninitalized pointer. Note that, because of said optimizations, release-mode debugging can be an interesting experience.

Share this post


Link to post
Share on other sites
Awesome, managed to get it fixed! The problem was happening around this code:

if(numVSBuffers > 0){
DevCon->VSSetConstantBuffers(0, numVSBuffers, reinterpret_cast<ID3D11Buffer* const*>(g_pVSConstantBuffers));
}

where numVSBuffers is an int. I added "numVSBuffers = 0;" to the constructor for the class, and the problem went away.
Thanks!

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!