Advertisement Jump to content
Sign in to follow this  

[D3D11]Visual Studio Graphic Analyzer

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

Sorry if this is the wrong forum for this post, but was hoping someone in here was familiar with the Visual Studio Graphic Analyzer.


I was able to follow MS guide and get this thing to work.  I was able start the Diagnotics.  Capture a frame.. Then when I clicked on the frame I was able to use the Event List and the Graphics pipeline to debug my code, including the HLSL stuff I compile at runtime (the Vertex and Pixel Shaders).


After adding code today for lighting, my program worked nearly perfectly.  Just one triangle was ambient lit when it clearly should have been lit directly.  I assumed it was a problem with normals or something but I encountered this problem:


It started my code, and I get a frame (which showed my sphere perfectly rendered).  But when I click on that frame to start the Graphic Analyzer the frame showed totally black (before it worked just fine and had the proper frame image).   The graphics pipeline also only shows the Input Assembler, Vertex Shader, and the Output Merger.  The Pixel Shader is missing.   When I investigated the Vertex Shader's constant buffer (which is basically the world, view and projection matrices) is set to all 0.0.  So the Graphic Analyzer is just running the VS and I guess setting all the vertices to 0 and thus not needing a pixel shader?   its odd because the program ITSELF is not having this problem.  The Vertex Shader's constant buffer is clearly being set correctly and read by my Vertex Shader or I wouldn't be seeing the Sphere?


Anyone have any idea why the Graphic Analyzer would suddenly stop working correctly.   I can't think of any other way to debug the Vertex and Pixel Shader code without it.

Share this post

Link to post
Share on other sites

This probably means that your app was using some undefined behavior and happening to work correctly, which means the capture tool was unable to see what's going on. Does the D3D11 debug layer have any error messages?

Share this post

Link to post
Share on other sites

Well there was no problems with the D3D11 Debug layer..  But you were right.  I was doing something wrong that I'm suprised did not crash things.


I had this:

result = deviceContext->Map(m_matrixBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);


// code to write data to the buffer


deviceContext->Unmap(m_materialBuffer, 0);


So I was never unmapping m_matrixBuffer.   Somehow it worked in my app, but messed up the Graphic analyzer.


For future reference if anyone has similiar trouble, when you are in Graphic Analyzer the Event List in the top left defaults to Draw Calls.  However, after playing around I noticed I could change it to TimeLine.  This gave a very detailed list of all the D3D calls and made it very easy to track down this bug.     For Example I saw:


obj3->Map(obj12,loads of other stuff)

obj3->Unmap(obj14,loads of other stuff)


Very easy to spot the trouble.

Edited by drwhat

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. 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!