Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

99 lines
2.8 KiB

  1. /*==========================================================================;
  2. *
  3. *
  4. * File: dxerr.h
  5. * Content: DirectX Error Library Include File
  6. *
  7. ****************************************************************************/
  8. #ifndef _DXERR_H_
  9. #define _DXERR_H_
  10. #ifdef __cplusplus
  11. extern "C" {
  12. #endif //__cplusplus
  13. //
  14. // DXGetErrorString
  15. //
  16. // Desc: Converts a DirectX HRESULT to a string
  17. //
  18. // Args: HRESULT hr Can be any error code from
  19. // XACT D3D10 D3DX10 D3D9 D3DX9 D3D8 D3DX8 DDRAW DPLAY8 DMUSIC DSOUND DINPUT DSHOW
  20. //
  21. // Return: Converted string
  22. //
  23. const char* WINAPI DXGetErrorStringA(HRESULT hr);
  24. const WCHAR* WINAPI DXGetErrorStringW(HRESULT hr);
  25. #ifdef UNICODE
  26. #define DXGetErrorString DXGetErrorStringW
  27. #else
  28. #define DXGetErrorString DXGetErrorStringA
  29. #endif
  30. //
  31. // DXGetErrorDescription
  32. //
  33. // Desc: Returns a string description of a DirectX HRESULT
  34. //
  35. // Args: HRESULT hr Can be any error code from
  36. // XACT D3D10 D3DX10 D3D9 D3DX9 D3D8 D3DX8 DDRAW DPLAY8 DMUSIC DSOUND DINPUT DSHOW
  37. //
  38. // Return: String description
  39. //
  40. const char* WINAPI DXGetErrorDescriptionA(HRESULT hr);
  41. const WCHAR* WINAPI DXGetErrorDescriptionW(HRESULT hr);
  42. #ifdef UNICODE
  43. #define DXGetErrorDescription DXGetErrorDescriptionW
  44. #else
  45. #define DXGetErrorDescription DXGetErrorDescriptionA
  46. #endif
  47. //
  48. // DXTrace
  49. //
  50. // Desc: Outputs a formatted error message to the debug stream
  51. //
  52. // Args: CHAR* strFile The current file, typically passed in using the
  53. // __FILE__ macro.
  54. // DWORD dwLine The current line number, typically passed in using the
  55. // __LINE__ macro.
  56. // HRESULT hr An HRESULT that will be traced to the debug stream.
  57. // CHAR* strMsg A string that will be traced to the debug stream (may be NULL)
  58. // BOOL bPopMsgBox If TRUE, then a message box will popup also containing the passed info.
  59. //
  60. // Return: The hr that was passed in.
  61. //
  62. HRESULT WINAPI DXTraceA( const char* strFile, DWORD dwLine, HRESULT hr, const char* strMsg, BOOL bPopMsgBox );
  63. HRESULT WINAPI DXTraceW( const char* strFile, DWORD dwLine, HRESULT hr, const WCHAR* strMsg, BOOL bPopMsgBox );
  64. #ifdef UNICODE
  65. #define DXTrace DXTraceW
  66. #else
  67. #define DXTrace DXTraceA
  68. #endif
  69. //
  70. // Helper macros
  71. //
  72. #if defined(DEBUG) | defined(_DEBUG)
  73. #define DXTRACE_MSG(str) DXTrace( __FILE__, (DWORD)__LINE__, 0, str, FALSE )
  74. #define DXTRACE_ERR(str,hr) DXTrace( __FILE__, (DWORD)__LINE__, hr, str, FALSE )
  75. #define DXTRACE_ERR_MSGBOX(str,hr) DXTrace( __FILE__, (DWORD)__LINE__, hr, str, TRUE )
  76. #else
  77. #define DXTRACE_MSG(str) (0L)
  78. #define DXTRACE_ERR(str,hr) (hr)
  79. #define DXTRACE_ERR_MSGBOX(str,hr) (hr)
  80. #endif
  81. #ifdef __cplusplus
  82. }
  83. #endif //__cplusplus
  84. #endif // _DXERR_H_