Jump to content

  • Log In with Google      Sign In   
  • Create Account


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


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 Alessio1989   Members   -  Reputation: 1836

Like
0Likes
Like

Posted 05 May 2013 - 11:01 AM

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).

 

Attached File  DirectX 11 Tutorials VS2012.zip   2.45MB   80 downloads


Edited by Alessio1989, 05 May 2013 - 11:03 AM.


Sponsor:

#2 Adam_42   Crossbones+   -  Reputation: 2426

Like
2Likes
Like

Posted 05 May 2013 - 05:37 PM

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.



#3 Alessio1989   Members   -  Reputation: 1836

Like
0Likes
Like

Posted 06 May 2013 - 06:34 PM

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, 06 May 2013 - 06:35 PM.


#4 hupsilardee   Members   -  Reputation: 486

Like
0Likes
Like

Posted 31 May 2013 - 06:21 AM

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 :)






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.



PARTNERS