Different render results in Release and Debug builds

Started by
1 comment, last by trill41 7 years ago

Hi,

I'm trying to make a simple 3D rendering engine (nothing useful, just for learning) with D3D11 and VC++ 2015.

I have a quick question, the scene looks different in release and debug build. In release everything is grayscale (see release.png), in debug build it is colored, as it should be (see debug.png).

When I turn Optimization off (Disabled (/Od)) in the release build the problem is fixed, and the release build is also colored. This problem exists when any optimization (Minimize Size (/O1), Maximize Speed (/O2) or Full Optimization (/Ox)) is on.

Did somebody experience this problem already?

Thanks in advance.

Advertisement

Behavior differences between debug and release builds are typically associated with uninitialized variables.

Debug build will initialize all variables with some known value that helps to detect uninitialized variable use. If you ignore that, your debug build probably will behave incorrectly (say, boolean value might be not equal to true and not equal to false at the same time), but will be stable, even if exact value in uninitialized variable is not what you expect. Release build won't touch your variables, so behavior will differ from debug build, and even can change between runs.

Hi,

thank you for your reply.

You are right, I did not correctly initialize the vertex structure when loading the models. Initializing it fixes the problem.

Thank you very much.

This topic is closed to new replies.

Advertisement