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

d3d debugging

Started by Quat Aug 2, 2007 at 1:10 PM 0 replies 900+ views
Original Post
Quat
Quat
Should we continue to check HRESULTs when not in debug mode? I ask because the DXUT.h file has something like this: #if defined(DEBUG) || defined(_DEBUG) #ifndef V #define V(x) { hr = (x); if( FAILED(hr) ) { DXUTTrace( __FILE__, (DWORD)__LINE__, hr, L#x, true ); } } #endif #ifndef V_RETURN #define V_RETURN(x) { hr = (x); if( FAILED(hr) ) { return DXUTTrace( __FILE__, (DWORD)__LINE__, hr, L#x, true ); } } #endif #else #ifndef V #define V(x) { hr = (x); } #endif #ifndef V_RETURN #define V_RETURN(x) { hr = (x); if( FAILED(hr) ) { return hr; } } #endif #endif It seems reasonable not to. After all, once your game is burned to a CD you are out of luck if a resource is missing or you have shader bugs. This is especially true for consoles. On the other hand, displaying the error message, line number and file name can help you figure out the problem if you need to issue a patch online.
-----Quat
Evil Steve
Evil Steve
Always check error codes for functions that create resources or return pointers (E.g. Lock()), since if that fails, you'll just crash when you try to access the pointer.

Macros like that are handy for E.g. SetRenderState() and other less important functions.

Topic Locked

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

Sign in to reply to this topic.