Sign in to follow this  
trill41

Different render results in Release and Debug builds

Recommended Posts

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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