Skip to content

Commit 08abbf4

Browse files
committed
Wrap DebugDevice with ifdef for release mode
1 parent 84f0a71 commit 08abbf4

File tree

4 files changed

+8
-0
lines changed

4 files changed

+8
-0
lines changed

src/Cpp/1-getting-started/1-2-2-DebugLayer/DebugLayerApplication.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,13 @@ bool DebugLayerApplication::Initialize()
7575
return false;
7676
}
7777

78+
#if !defined(NDEBUG)
7879
if (FAILED(_device.As(&_debug)))
7980
{
8081
std::cerr << "D3D11: Failed to get the debug layer from the device\n";
8182
return false;
8283
}
84+
#endif
8385

8486
_deviceContext = deviceContext;
8587

src/Cpp/1-getting-started/1-2-3-NamingThings/NamingThingsApplication.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,13 @@ bool NamingThingsApplication::Initialize()
8787

8888
_deviceContext = deviceContext;
8989

90+
#if !defined(NDEBUG)
9091
if (FAILED(_device.As(&_debug)))
9192
{
9293
std::cerr << "D3D11: Failed to get the debug layer from the device\n";
9394
return false;
9495
}
96+
#endif
9597

9698
DXGI_SWAP_CHAIN_DESC1 swapChainDescriptor = {};
9799
swapChainDescriptor.Width = GetWindowWidth();

src/Cpp/1-getting-started/1-3-5-Models/LoadingMeshesApplication.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,13 @@ bool LoadingMeshesApplication::Initialize()
103103
return false;
104104
}
105105

106+
#if !defined(NDEBUG)
106107
if (FAILED(_device.As(&_debug)))
107108
{
108109
std::cerr << "D3D11: Failed to get the debug layer from the device\n";
109110
return false;
110111
}
112+
#endif
111113

112114
constexpr char deviceName[] = "DEV_Main";
113115
_device->SetPrivateData(WKPDID_D3DDebugObjectName, sizeof(deviceName), deviceName);

src/Cpp/1-getting-started/1-3-7-DearImGui/DearImGuiApplication.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,13 @@ bool DearImGuiApplication::Initialize()
104104
return false;
105105
}
106106

107+
#if !defined(NDEBUG)
107108
if (FAILED(_device.As(&_debug)))
108109
{
109110
std::cerr << "D3D11: Failed to get the debug layer from the device\n";
110111
return false;
111112
}
113+
#endif
112114

113115
InitializeImGui();
114116

0 commit comments

Comments
 (0)