MDX, VC# 2005 Express and D3D debug output - it's possible!!!

Started by
8 comments, last by Gage64 16 years, 4 months ago
I've seen many posts that ask how you can enable the Direct3D debug output when using VC# 2005 Express and MDX. The only reply I've ever seen to this was: "The Express edition of VC# doesn't support unmanaged debugging, so you're screwed". As far as I know, this hasn't changed in VC# 2008 Express, but I could be wrong. Recently, however, I discovered that there's an application called dbmon.exe that captures debug output (or something like it) and can be used with MDX (BTW, different places list different locations for this file. In my case, I found it in PSDK\Bin\winnt, where PSDK is the folder that I installed the platform SDK to (for use with VC++ 2005 express)). This sounded too good to be true, but I just tried it and it works! It would have been nice to discover this when MDX was still relevant, but some people still use it (myself included), and it might be useful for users of SlimDX/XNA as well (Never used these so I don't know). EDIT: See supamike's post for a similar (but much more useful) utility. The purpose of this post is two-fold. The first is to tell other people about this incredibly useful program (and ask why the hell hasn't this been mentioned in a million other places?!?!?). The second is to ask for help with a problem I'm having. When running an MDX application, I get this line in the console window of dbmon: "D3DDebugging disabled: Application was not compiled with D3D_DEBUG_INFO" (note that despite this I still get many useful messages (like performance warnings)). I've defined this constant in Project Settings\Build\Conditional Compilation Flags, but it didn't change anything. I've also made sure that the "Use Debug Version of Direct3D" option was selected in the control panel, and that the debug output level is at the maximum setting. Does any one know how to solve this? Thanks in advance. [Edited by - Gage64 on January 8, 2008 2:48:35 AM]
Advertisement
Quote:Original post by Gage64
The second is to ask for help with a problem I'm having. When running an MDX application, I get this line in the console window of dbmon: "D3DDebugging disabled: Application was not compiled with D3D_DEBUG_INFO" (note that despite this I still get many useful messages (like performance warnings)). I've defined this constant in Project Settings\Build\Conditional Compilation Flags, but it didn't change anything. I've also made sure that the "Use Debug Version of Direct3D" option was selected in the control panel, and that the debug output level is at the maximum setting. Does any one know how to solve this?
I'm not sure about C#, but in C++ that's used to allow you to inspect member variables of D3D objects in the debugger, so you can see e.g. the present parameters used to create a device, given a D3D device pointer. I wouldn't worry about it for C#, and to be honest I've never really found it all that useful.
Somehow I fear there may not be a way to fix it.

Setting the D3D_DEBUG_INFO is essntially writing #define D3D_DEBUG_INFO, which is a pre-prcoessor directive. Preprocessor directives are used by the processor and, once compiled, are removed from the code as far as I know). Thus, when you compile your code, and if VC# does not support debugging, it probably just thinks it's a random constant, scraps it after the compile, and your debugger isn't told of its existence. Or at least, that's my theory on it.
Comrade, Listen! The Glorious Commonwealth's first Airship has been compromised! Who is the saboteur? Who can be saved? Uncover what the passengers are hiding and write the grisly conclusion of its final hours in an open-ended, player-driven adventure. Dziekujemy! -- Karaski: What Goes Up...
Quote:
Original post by Evil Steve
I'm not sure about C#, but in C++ that's used to allow you to inspect member variables of D3D objects in the debugger, so you can see e.g. the present parameters used to create a device, given a D3D device pointer. I wouldn't worry about it for C#, and to be honest I've never really found it all that useful.


So just to make sure, if I do manage to enable this, it will not cause any additional debug output messages (i.e., if I'm not interested in inspecting properties like you said, I'm not missing out on anything)? Also, why do you say that you wouldn't worry about it for C#?

Still, even if the above is true I would still like to know how to do it so any help is appreciated.
Quote:
The second is to ask for help with a problem I'm having. When running an MDX application, I get this line in the console window of dbmon: "D3DDebugging disabled: Application was not compiled with D3D_DEBUG_INFO" (note that despite this I still get many useful messages (like performance warnings)). I've defined this constant in Project Settings\Build\Conditional Compilation Flags, but it didn't change anything. I've also made sure that the "Use Debug Version of Direct3D" option was selected in the control panel, and that the debug output level is at the maximum setting. Does any one know how to solve this?

Use SlimDX. The debug version of SlimDX compiles with D3D_DEBUG_INFO enabled (or should, and its easy to change).

You shouldn't need the extra information D3D_DEBUG_INFO gives you, neccessarily; the important part are the state-based messages, usually. Since you don't have unmanaged debugging, I'm not sure D3D_DEBUG_INFO will even give you much of use except suppress that initial warning.
Quote:
Original post by jpetrie
Since you don't have unmanaged debugging, I'm not sure D3D_DEBUG_INFO will even give you much of use except suppress that initial warning.


Not sure what you mean. Are you saying that because I don't have unmanaged debugging, there are some messages that I will not see? In other words, dbmon alone isn't enough to get the effect of unmanaged debugging? That doesn't sound right because I am seeing messages that I haven't seen in VC#'s debug output, like performance warnings (but if it's true then that would explain the lack of interest in this thread).

Also, as far as I know SlimDX is just a managed wrapper around the native DirectX (just like MDX is), so it shouldn't give me any benefits in terms of debugging unless it does some extra checks that MDX/native DX doesn't do (of course there are other reasons for why it's a better choice than MDX, but that is beside the point).
Quote:
Are you saying that because I don't have unmanaged debugging, there are some messages that I will not see? In other words, dbmon alone isn't enough to get the effect of unmanaged debugging? That doesn't sound right because I am seeing messages that I haven't seen in VC#'s debug output, like performance warnings (but if it's true then that would explain the lack of interest in this thread).

D3D_DEBUG_INFO provides the ability to inspect the contents of the native D3D objects in a meaninful fashion. From a managed environment, you also need to have unmanaged debugging enabled to even get to the point where you can inspect the unmanaged object. Since you don't have unmanaged debugging, you cannot get to that point, and so D3D_DEBUG_INFO will provide very little benefit to you.

Quote:
Also, as far as I know SlimDX is just a managed wrapper around the native DirectX (just like MDX is), so it shouldn't give me any benefits in terms of debugging unless it does some extra checks that MDX/native DX doesn't do (of course there are other reasons for why it's a better choice than MDX, but that is beside the point).

SlimDX in general performs fewer checks than MDX does; we rely purely on the native API to perform error checking for us except in cases where managed environment constraints would be violated.

SlimDX, however, has its source available. Unlike MDX. That means you can compile it with the D3D_DEBUG_INFO define enabled; you cannot do this with MDX, so unless one of the debug versions of the MDX assemblies was compiled with it, you can never enable the extra debugger watch information provided by D3D_DEBUG_INFO in MDX.
OK, so I guess that D3D_DEBUG_INFO is useless for users of VC# express, so I won't worry about it.

BTW, given that SlimDX is a managed wrapper, doesn't that mean that dbmon is equally useful for SlimDX users (who are using VC# expresss)?

In fact, isn't XNA also a wrapper around native DirectX (of course, it provides a lot of additional functionality), so this is equally useful for XNA users? If the latter is true, then this is incredibly valuable. I wonder why this isn't more widely known?
Also check out DebugView. This has been around for awhile and MS seem to push it quite abit, at least on their forums.
Quote:
Original post by supamike
Also check out DebugView. This has been around for awhile and MS seem to push it quite abit, at least on their forums.


Just tried it, and it looks like a much improved version of dbmon (Win32 window vs. console window, lots of options, includes documentation!).

Thanks for posting this!

This topic is closed to new replies.

Advertisement