--------------------------------------------------------------------------------------
| 3114 | |
| 3115 | //-------------------------------------------------------------------------------------- |
| 3116 | void WINAPI DXGetErrorDescriptionW( _In_ HRESULT hr, _Out_cap_(count) wchar* desc, _In_ size_t count ) |
| 3117 | { |
| 3118 | if ( !count ) |
| 3119 | return; |
| 3120 | |
| 3121 | *desc = 0; |
| 3122 | |
| 3123 | // First try to see if FormatMessage knows this hr |
| 3124 | LPWSTR errorText = nullptr; |
| 3125 | |
| 3126 | DWORD result = FormatMessageW( FORMAT_MESSAGE_FROM_SYSTEM |FORMAT_MESSAGE_ALLOCATE_BUFFER, nullptr, hr, |
| 3127 | MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPWSTR)&errorText, 0, nullptr ); |
| 3128 | |
| 3129 | if (result > 0 && errorText) |
| 3130 | { |
| 3131 | wcscpy_s( desc, count, errorText ); |
| 3132 | |
| 3133 | if ( errorText ) |
| 3134 | LocalFree( errorText ); |
| 3135 | |
| 3136 | return; |
| 3137 | } |
| 3138 | |
| 3139 | if ( errorText ) |
| 3140 | LocalFree( errorText ); |
| 3141 | |
| 3142 | switch (hr) |
| 3143 | { |
| 3144 | // Commmented out codes are actually alises for other codes |
| 3145 | |
| 3146 | // ------------------------------------------------------------- |
| 3147 | // dxgi.h error codes |
| 3148 | // ------------------------------------------------------------- |
| 3149 | CHK_ERR(DXGI_STATUS_OCCLUDED, "The target window or output has been occluded. The application should suspend rendering operations if possible.") |
| 3150 | CHK_ERR(DXGI_STATUS_CLIPPED, "Target window is clipped.") |
| 3151 | CHK_ERR(DXGI_STATUS_NO_REDIRECTION, "") |
| 3152 | CHK_ERR(DXGI_STATUS_NO_DESKTOP_ACCESS, "No access to desktop.") |
| 3153 | CHK_ERR(DXGI_STATUS_GRAPHICS_VIDPN_SOURCE_IN_USE, "") |
| 3154 | CHK_ERR(DXGI_STATUS_MODE_CHANGED, "Display mode has changed") |
| 3155 | CHK_ERR(DXGI_STATUS_MODE_CHANGE_IN_PROGRESS, "Display mode is changing") |
| 3156 | CHK_ERR(DXGI_ERROR_INVALID_CALL, "The application has made an erroneous API call that it had enough information to avoid. This error is intended to denote that the application should be altered to avoid the error. Use of the debug version of the DXGI.DLL will provide run-time debug output with further information.") |
| 3157 | CHK_ERR(DXGI_ERROR_NOT_FOUND, "The item requested was not found. For GetPrivateData calls, this means that the specified GUID had not been previously associated with the object.") |
| 3158 | CHK_ERR(DXGI_ERROR_MORE_DATA, "The specified size of the destination buffer is too small to hold the requested data.") |
| 3159 | CHK_ERR(DXGI_ERROR_UNSUPPORTED, "Unsupported.") |
| 3160 | CHK_ERR(DXGI_ERROR_DEVICE_REMOVED, "Hardware device removed.") |
| 3161 | CHK_ERR(DXGI_ERROR_DEVICE_HUNG, "Device hung due to badly formed commands.") |
| 3162 | CHK_ERR(DXGI_ERROR_DEVICE_RESET, "Device reset due to a badly formed commant.") |
| 3163 | CHK_ERR(DXGI_ERROR_WAS_STILL_DRAWING, "Was still drawing.") |
| 3164 | CHK_ERR(DXGI_ERROR_FRAME_STATISTICS_DISJOINT, "The requested functionality is not supported by the device or the driver.") |
| 3165 | CHK_ERR(DXGI_ERROR_GRAPHICS_VIDPN_SOURCE_IN_USE, "The requested functionality is not supported by the device or the driver.") |
| 3166 | CHK_ERR(DXGI_ERROR_DRIVER_INTERNAL_ERROR, "An internal driver error occurred.") |
| 3167 | CHK_ERR(DXGI_ERROR_NONEXCLUSIVE, "The application attempted to perform an operation on an DXGI output that is only legal after the output has been claimed for exclusive owenership.") |
| 3168 | CHK_ERR(DXGI_ERROR_NOT_CURRENTLY_AVAILABLE, "The requested functionality is not supported by the device or the driver.") |
| 3169 | CHK_ERR(DXGI_ERROR_REMOTE_CLIENT_DISCONNECTED, "Remote desktop client disconnected.") |
| 3170 | CHK_ERR(DXGI_ERROR_REMOTE_OUTOFMEMORY, "Remote desktop client is out of memory.") |
| 3171 | |
| 3172 | // ------------------------------------------------------------- |
| 3173 | // d3d11.h error codes |