Skip to content

Commit 2ec4257

Browse files
authored
error printing fixes (#861)
1 parent 1922f81 commit 2ec4257

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Samples/Desktop/D3D12HelloWorld/src/HelloWorkGraphs/D3D12HelloWorkGraphs.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ bool g_useWarpDevice = false;
3939
// Look for "Start of interesting code" further below.
4040
//=================================================================================================================================
4141

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

4545
//=================================================================================================================================
4646
class D3DContext

Samples/Desktop/D3D12HelloWorld/src/WorkGraphsSandbox/D3D12WorkGraphsSandbox.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ bool g_useWarpDevice = false;
4242

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

4848
//=================================================================================================================================
4949
void Analyze(HRESULT hr)
5050
{
51-
PRINT("HRESULT == ");
51+
PRINT_NO_NEWLINE("HRESULT == ");
5252
switch (hr)
5353
{
5454
case DXGI_ERROR_DEVICE_HUNG:
@@ -58,10 +58,10 @@ void Analyze(HRESULT hr)
5858
PRINT("DXGI_ERROR_DEVICE_REMOVED");
5959
break;
6060
default:
61-
PRINT(hex << hr);
61+
PRINT("0x" << hex << hr);
6262
}
6363
}
64-
#define VERIFY_SUCCEEDED(hr) {if(FAILED(hr)) {PRINT("Error at: " << __FILE__ << ", line: " << __LINE__ ); Analyze(hr); throw E_FAIL;} }
64+
#define VERIFY_SUCCEEDED(hr) {HRESULT hrLocal = hr; if(FAILED(hrLocal)) {PRINT_NO_NEWLINE("Error at: " << __FILE__ << ", line: " << __LINE__ << ", "); Analyze(hrLocal); throw E_FAIL;} }
6565

6666
//=================================================================================================================================
6767
class D3DContext

0 commit comments

Comments
 (0)