Jump to content
  • Advertisement
Sign in to follow this  
Alessio1989

DX11 converting some rastertek tutorials to directxmath: black screen in debug mode

This topic is 1850 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'm learning the DX11 tutorial of rastertek (http://www.rastertek.com/tutdx11.html).

Since they use the deprecated D3DX APIs family I decided to convert the source code to use DirectXMath and DirectXTK.

 

When I compile the projects with Release configuration everything works fine, but when I switch to Debug configuration they display just a black screen, without any kind of compilation or runtime errors.

 

I'm just a beginner in this world, so I don't have any idea about what could cause this issue.

 

The code is quite the same of the original, with some exception like the maths structures and functions.

 

I attach here the tutorial 4 that I converted. (original source: http://www.rastertek.com/dx11tut04.html).

 

[attachment=15539:DirectX 11 Tutorials VS2012.zip]

Edited by Alessio1989

Share this post


Link to post
Share on other sites
Advertisement

When you have two programs that should be doing the same thing, but aren't the easiest option to debug them is usually to load up two copies of Visual Studio, and step through both programs in the debugger at the same time. At some point you'll find the place where the values in the variables stop being the same - that is where a bug is located.

 

As you know what's changed you won't need to step over all the code. I'd start by looking at the constants that are passed to the shaders, and how they are calculated.

Share this post


Link to post
Share on other sites

After comparing the two different version on debug mode it appears that is a constructor-call problem: since some structures of DirectXMath need aligned allocation I used _aligned_malloc function to have 16-byte aligned data.

 

My bad, I forgot that _aligned_malloc (and all malloc/free etc C-derived memory (de)allocation function) don't call the constructor and the destructor like new and delete...

 

I will try to use the "placement new" syntax, it should solve my problem.

Edited by Alessio1989

Share this post


Link to post
Share on other sites

I suggest you use the SimpleMath library that's part of the DirectXTK. It's a wrapper above DirectXMath, that provides Matrix, Vector2, Vector3, Vector4, Quaternion etc types, that make it much easier to write expressions intuitively.

 

The downside is a slight performance hit due to the way some data has to be unloaded and reloaded more times than necessary into the CPU registers, but it's extremely fast nonetheless.

 

My bottleneck is and will always be the scripting engine rather than the CPU math anyway :)

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!