How do I debug DirectX applications?
When developing an application, it is worthwhile to use the debugging version of the DirectX runtime (selected when you install the SDK). The Debug version performs some parameter validation and outputs useful messages to the debugger window.To debug Direct3D Applications in DirectX9 there is a utility called d3dspy in Bin\DXUtils. It monitors function calls to the Direct3D API, and shows a representation of Direct3D's internal state. This is valuable when writing a Direct3D program, or when trying to understand why a program is misbehaving. It can also be used to improve the performance of a Direct3D program by identifying redundant or inefficient use of the Direct3D API. Also you can interact with D3DSpy through your program (You can programmatically generate a breakpoint in D3DSpy at a certain point in your program)
For older versions of DirectX the most common problem with debugging was an attempt to debug while a DirectDraw surface is locked. This situation can cause a "Win16 Lock" on Microsoft Windows 9x systems, which prevents the debugger window from painting. Specifying D3DLOCK_NOSYSLOCK flag when locking the surface can usually eliminate this. Windows 2000 does not suffer from this problem. Forcing to a software-only device (Turning off hardware acceleration even when it is available) and Forcing surfaces into system memory can also help to prevent the Win16 Lock problem. In addition to the above-mentioned techniques, the following tips can also be helpful
- Check the error outputs. Check if the error output during a device creation is D3DERR_OUTOFVIDEOMEMORY
- Create an option to run in a window, so that you can use an integrated debugger.
- Although several Direct3D Immediate Mode methods impose limits on the values that they can accept, these limits are often only checked and enforced by the debug version of the Direct3D Immediate Mode run time. Applications must conform to these limits, or unpredictable and undesirable results can occur when running on the retail version of Direct3D.Use the DirectX control panel applet, switch to the debug runtime if necessary, and check the "Break on D3DError" option. This option will force the runtime to use the Windows DebugBreak method in order to force the application to stop when an application bug is detected.
- Add the following entries to Win.ini
[Direct3D] debug=3 [DirectDraw] debug=3
This shows the debug output message level produced by the corresponding API set. Setting to a higher debug value will make the applications using the debug runtimes run slower as their will be more and more error checks and assertions.
FAQ Menu
Sponsored links
Build IT Knowledge with Current & Trusted Content
Helps Employees Develop & Hone New Technical Programming Skills. Sign Up & Get Full Access.
Helps Employees Develop & Hone New Technical Programming Skills. Sign Up & Get Full Access.
Check Out IT Certification Preparation Materials
Sign Up With SkillSoft & Get Access to Training Materials for Over 50 Professional Certifications.
Sign Up With SkillSoft & Get Access to Training Materials for Over 50 Professional Certifications.
Six Sigma Certification
100% Online-Six Sigma Certificate from Villanova - Find Out More Now.
100% Online-Six Sigma Certificate from Villanova - Find Out More Now.
SSH and SFTP support for .NET
Add complete SSH and SFTP support to your .NET framework application
Add complete SSH and SFTP support to your .NET framework application
ASP.NET 3.5 Hosting on Windows 2008!
ASP.NET 3.5/2.0 Hosting on Windows 2008 & 2003! AJAX, LINQ, & Silverlight Ready! 3 Mo. Free!!
ASP.NET 3.5/2.0 Hosting on Windows 2008 & 2003! AJAX, LINQ, & Silverlight Ready! 3 Mo. Free!!
