This is a simple module that allows you to convert the enum from D3DERR to the appropriate text. It might not be the most efficient, but it works.
D3DError.h
D3DError.cppCode:#ifndef D3DERROR #define D3DERROR #include <d3dx9.h> #include <d3d9.h> namespace D3DError { char *GetTextFromD3DError(HRESULT hr); } #endif
Code:#include "D3DError.h" char *D3DError::GetTextFromD3DError(HRESULT hr) { char *text="Undefined error"; switch (hr) { case D3D_OK: text="D3D_OK";break; case D3DOK_NOAUTOGEN: text="D3DOK_NOAUTOGEN";break; case D3DERR_CONFLICTINGRENDERSTATE: text="D3DERR_CONFLICTINGRENDERSTATE";break; case D3DERR_CONFLICTINGTEXTUREFILTER: text="D3DERR_CONFLICTINGTEXTUREFILTER";break; case D3DERR_CONFLICTINGTEXTUREPALETTE: text="D3DERR_CONFLICTINGTEXTUREPALETTE";break; case D3DERR_DEVICELOST: text="D3DERR_DEVICELOST";break; case D3DERR_DEVICENOTRESET: text="D3DERR_DEVICENOTRESET";break; case D3DERR_DRIVERINTERNALERROR: text="D3DERR_DRIVERINTERNALERROR";break; case D3DERR_INVALIDCALL: text="D3DERR_INVALIDCALL";break; case D3DERR_INVALIDDEVICE: text="D3DERR_INVALIDDEVICE";break; case D3DERR_MOREDATA: text="D3DERR_MOREDATA";break; case D3DERR_NOTAVAILABLE: text="D3DERR_NOTAVAILABLE";break; case D3DERR_NOTFOUND: text="D3DERR_NOTFOUND";break; case D3DERR_OUTOFVIDEOMEMORY: text="D3DERR_OUTOFVIDEOMEMORY";break; case D3DERR_TOOMANYOPERATIONS: text="D3DERR_TOOMANYOPERATIONS";break; case D3DERR_UNSUPPORTEDALPHAARG: text="D3DERR_UNSUPPORTEDALPHAARG";break; case D3DERR_UNSUPPORTEDALPHAOPERATION: text="D3DERR_UNSUPPORTEDALPHAOPERATION";break; case D3DERR_UNSUPPORTEDCOLORARG: text="D3DERR_UNSUPPORTEDCOLORARG";break; case D3DERR_UNSUPPORTEDCOLOROPERATION: text="D3DERR_UNSUPPORTEDCOLOROPERATION";break; case D3DERR_UNSUPPORTEDFACTORVALUE: text="D3DERR_UNSUPPORTEDFACTORVALUE";break; case D3DERR_UNSUPPORTEDTEXTUREFILTER: text="D3DERR_UNSUPPORTEDTEXTUREFILTER";break; case D3DERR_WRONGTEXTUREFORMAT: text="D3DERR_WRONGTEXTUREFORMAT";break; case E_FAIL: text="E_FAIL";break; case E_INVALIDARG: text="E_INVALIDARG";break; case E_OUTOFMEMORY: text="E_OUTOFMEMORY";break; } return text; }