Jump to content

View more

Image of the Day

WIP title screen for #DeathOfAPartisan #screenshotsaturday #gamedev https://t.co/qJNhfZCvd4
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Runs in debug, not release

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
3 replies to this topic

#1 trick   Members   

152
Like
0Likes
Like

Posted 28 March 2012 - 04:09 PM

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!

#2 TheUnbeliever   Members   

963
Like
0Likes
Like

Posted 28 March 2012 - 06:40 PM

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.
[TheUnbeliever]

#3 trick   Members   

152
Like
0Likes
Like

Posted 29 March 2012 - 03:32 AM

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!

#4 TheUnbeliever   Members   

963
Like
0Likes
Like

Posted 29 March 2012 - 10:42 AM

Glad to hear :-) Incidentally, you usually want to use an initialization list rather than assignment in the constructor.
[TheUnbeliever]




Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.