Skip to main content
GameDev.net gamedev.net
🔒 Locked

Directx Debugging

Started by wforl Oct 2, 2008 at 4:46 AM 2 replies 650+ views
Original Post
wforl
wforl
Could someone just clarify i have all the right settings here? //common headers #include #include #include //only needed for debug //Release -Preprocessor- WIN32 ;_WINDOWS -RunTimeLibrary- Multi-threaded DLL (/MD) -LinkerInput- d3d9.lib d3dx9.lib //Debug -Preprocessor- WIN32;_WINDOWS; D3D_DEBUG_INFO -RunTimeLibrary- Multi-threaded Debug DLL (/MDd) -LinkerInput- d3d9.lib d3dx9d.lib DxErr9.lib Some code i see also has the preprocess _DEBUG or DEBUG, and in their code #ifdef _DEBUG | DEBUG //define debug stuff If im using D3D_DEBUG_INFO in the preprocess in the project settings, do i still need to define _DEBUG or DEBUG? Do they set up other debug stuff? Do i still need to adjust the items in the directx control panel? Do my settings above over ride the control panel options?
MJP
MJP
DEBUG is defined for you by Visual Studio. You can use it for doing things like logging stuff or displaying data to the screen for debug builds.

And yes, you'll still need to activate the debug runtimes in the control panel. Linking to the debug version of d3dx will only give you debug output for d3dx calls, and not for the core API functions and methods.
Evil Steve
Evil Steve
In addition to the above, D3D_DEBUG_INFO just shows some more information in the debug watch windows, sop yes you'll still need _DEBUG or DEBUG (I believe Visual Studio defines _DEBUG, I'm not sure if it defines DEBUG).

Also, you may want to link to dxerr9.lib in release builds too. Without it, DXGetErrorString() will be unavailable (Will cause a linker error if you use it). If that's ok, then it's fine to drop it from release.
sirob
sirob
To avoid having to switch settings in the control panel when using DX9, I usually use LoadLibrary to load the D3D DLL. This allows me to load up d3d9d.dll instead of the standard dll when DEBUG is defined, which is exactly what happens if you change the settings in the DX control panel.

From a finished product point-of-view, this also allows you to catch issues where D3D fails to load correctly, and display a proper error message or dump memory.

While this might be a bit complex for someone just getting started, for someone with a bit of programming experience this is really just a couple of lines of code. When compared to the sanity you gain by not having to about leaving the debug runtimes on when you go gaming, this is well worth it.
Sirob Yes.» - status: Work-O-Rama.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.