Skip to content

Commit

Permalink
error printing fixes (#861)
Browse files Browse the repository at this point in the history
  • Loading branch information
amarpMSFT authored Mar 25, 2024
1 parent 1922f81 commit 2ec4257
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ bool g_useWarpDevice = false;
// Look for "Start of interesting code" further below.
//=================================================================================================================================

#define PRINT(text) cout << text << "\n" << flush;
#define VERIFY_SUCCEEDED(hr) {if(FAILED(hr)) {PRINT("Error at: " << __FILE__ << ", line: " << __LINE__ << hex << hr); throw E_FAIL;} }
#define PRINT(text) cout << (char*)text << "\n" << flush;
#define VERIFY_SUCCEEDED(hr) {HRESULT hrLocal = hr; if(FAILED(hrLocal)) {PRINT("Error at: " << __FILE__ << ", line: " << __LINE__ << ", HRESULT: 0x" << hex << hrLocal); throw E_FAIL;} }

//=================================================================================================================================
class D3DContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ bool g_useWarpDevice = false;

//=================================================================================================================================
// Print with flush to get the text out in case there's delays in app
#define PRINT(text) cout << text << "\n" << flush;
#define PRINT(text) cout << (char*)text << "\n" << flush;
#define PRINT_NO_NEWLINE(text) cout << text << flush;

//=================================================================================================================================
void Analyze(HRESULT hr)
{
PRINT("HRESULT == ");
PRINT_NO_NEWLINE("HRESULT == ");
switch (hr)
{
case DXGI_ERROR_DEVICE_HUNG:
Expand All @@ -58,10 +58,10 @@ void Analyze(HRESULT hr)
PRINT("DXGI_ERROR_DEVICE_REMOVED");
break;
default:
PRINT(hex << hr);
PRINT("0x" << hex << hr);
}
}
#define VERIFY_SUCCEEDED(hr) {if(FAILED(hr)) {PRINT("Error at: " << __FILE__ << ", line: " << __LINE__ ); Analyze(hr); throw E_FAIL;} }
#define VERIFY_SUCCEEDED(hr) {HRESULT hrLocal = hr; if(FAILED(hrLocal)) {PRINT_NO_NEWLINE("Error at: " << __FILE__ << ", line: " << __LINE__ << ", "); Analyze(hrLocal); throw E_FAIL;} }

//=================================================================================================================================
class D3DContext
Expand Down

0 comments on commit 2ec4257

Please sign in to comment.