Jump to content
  • Advertisement
Sign in to follow this  
Medo Mex

Depth Problem In Release Mode

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

Hello,
 
Sometimes, when I run the EXE file in release mode, I either don't see the depth working at all (most common) or I see a depth problem as it appear in the screenshot:
[attachment=31589:D Problem.png]
 
I'm doing assert(SUCCEEDED(hr)) on HRESULT for D3D11 initialization functions
 
I don't have this problem in debug mode, and mostly I don't have this problem if I'm running release mode from visual studio, the problem mostly appear if I'm running the EXE directly from release folder.
 
I'm using C++ / D3D11
 
Anyone know what could be causing the problem or how do I debug that kind of problem?
 

Share this post


Link to post
Share on other sites
Advertisement

 

what could be causing the problem or how do I debug that kind of problem?

 

 

Could be uninitialized variables.

When compiled in debug mode, visual studio will initialize all variables with well-known values.

It doesn't mean it is initialized to something your code would expect, but at least program's behaviour will be deterministic.

In release mode uninitialized variables will have random garbage, so actual behavior will change randomly between runs, giving weird results.

Share this post


Link to post
Share on other sites

@vstrakh: I'm doing ZeroMemory() on all the structures that I give to D3D11 in the initialization before I put any values, the weird thing is that the problem occur most of the time when I run the release EXE (but not all the time)

Share this post


Link to post
Share on other sites

Use RenderDoc to inspect the depthstencil state during your draw calls, in both the broken case and the working case.

Share this post


Link to post
Share on other sites

I'm doing ZeroMemory() on all the structures that I give to D3D11 in the initialization before I put any values, the weird thing is that the problem occur most of the time when I run the release EXE (but not all the time)

And you don't change render states between draw calls?

You may fill D3D structures correctly, but uninitialized variables in other place makes your code to take wrong actions.

It could be you're filling D3D structs based on wrong inputs.

Edited by vstrakh

Share this post


Link to post
Share on other sites

1. add "while(true){Sleep(0);}" at the beginning of "main"

2. start the application externally

3. attach the debugger

4. break at the Sleep

5. set the next line as the point to continue the execution (right click context menu)

6. debug what's different :)

7. fix it

8. transfer out of gratefulness all your moneyz to my account (that's optional, but 7. might break if you don't.)

Share this post


Link to post
Share on other sites

@Hodgman: When I start it with RenderDoc, the game crash after few seconds (during loading), when I attach VS debugger, I see it's crashing during a call to D3DX11CreateShaderResourceViewFromFile()

 

Unhandled exception at 0x0fa813e0 (renderdoc.dll) in Program.exe: 0xC0000005: Access violation writing location 0x00000000.

 

It's only crashing when I run the program from RenderDoc.

Share this post


Link to post
Share on other sites

Okay, all the comments were helpful here.

 

With RenderDoc, I found a warning that the depth stencil buffer size is not the same as the render target view size, so I had to create a depth stencil view for each render target view based on it's size.

 

I also found that I have uninitialized variable m_depthEnabled

 

@Hodgman: I'm still trying to get RenderDoc to work, it's still crashing, please check out my above comment

 

@Krypt0n: Number 8 failed hence number 7 failed as well :D

Share this post


Link to post
Share on other sites

Do you have any repro details you can share for the RenderDoc crash? e.g. is your application available online anywhere to test?

 

I found some source project that was using D3DX11CreateShaderResourceViewFromFile(), but it works OK - so I guess it's something particular that's crashing. If you download one of the latest nightly builds it comes with pdbs too, so getting the callstack with file:line information would be helpful.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!