From 8f27b8a0351b4c1403a79155bb0c37055263d779 Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Thu, 26 Sep 2019 08:05:03 -0700 Subject: Added EngineD3D12CreateInfo::EnableDebugLayer (updated API Version to 240030) --- Graphics/GraphicsEngineD3D12/include/CommandListD3D12Impl.h | 10 +++++++++- Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp | 2 ++ Graphics/GraphicsEngineD3D12/src/EngineFactoryD3D12.cpp | 6 ++---- 3 files changed, 13 insertions(+), 5 deletions(-) (limited to 'Graphics/GraphicsEngineD3D12') diff --git a/Graphics/GraphicsEngineD3D12/include/CommandListD3D12Impl.h b/Graphics/GraphicsEngineD3D12/include/CommandListD3D12Impl.h index 3e3577af..5bb92d51 100644 --- a/Graphics/GraphicsEngineD3D12/include/CommandListD3D12Impl.h +++ b/Graphics/GraphicsEngineD3D12/include/CommandListD3D12Impl.h @@ -53,7 +53,15 @@ public: ~CommandListD3D12Impl() { - DEV_CHECK_ERR(m_pCmdContext == nullptr && m_pDeferredCtx == nullptr, "Destroying a command list that has not been executed"); + if (m_pCmdContext != nullptr) + { + LOG_WARNING_MESSAGE("Destroying command list that has not been executed"); + m_pDevice->DisposeCommandContext(std::move(m_pCmdContext)); + } + else + { + VERIFY_EXPR(m_pDeferredCtx == nullptr); + } } RenderDeviceD3D12Impl::PooledCommandContext Close(RefCntAutoPtr& pDeferredCtx) diff --git a/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp index 64fd4817..42532555 100644 --- a/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp @@ -606,6 +606,8 @@ namespace Diligent m_State = State{}; + // Setting pipeline state to null makes sure that render targets and other + // states will be restored in the command list next time a PSO is bound. m_pPipelineState = nullptr; } diff --git a/Graphics/GraphicsEngineD3D12/src/EngineFactoryD3D12.cpp b/Graphics/GraphicsEngineD3D12/src/EngineFactoryD3D12.cpp index 0dfa412f..a11d698a 100644 --- a/Graphics/GraphicsEngineD3D12/src/EngineFactoryD3D12.cpp +++ b/Graphics/GraphicsEngineD3D12/src/EngineFactoryD3D12.cpp @@ -147,8 +147,8 @@ void EngineFactoryD3D12Impl::CreateDeviceAndContextsD3D12(const EngineD3D12Creat CComPtr d3d12Device; try { -#ifdef DEVELOPMENT // Enable the D3D12 debug layer. + if (EngineCI.EnableDebugLayer) { CComPtr debugController; if (SUCCEEDED(D3D12GetDebugInterface(__uuidof(debugController), reinterpret_cast(static_cast(&debugController)) ))) @@ -156,7 +156,6 @@ void EngineFactoryD3D12Impl::CreateDeviceAndContextsD3D12(const EngineD3D12Creat debugController->EnableDebugLayer(); } } -#endif CComPtr factory; HRESULT hr = CreateDXGIFactory1(__uuidof(factory), reinterpret_cast(static_cast(&factory)) ); @@ -199,7 +198,7 @@ void EngineFactoryD3D12Impl::CreateDeviceAndContextsD3D12(const EngineD3D12Creat CHECK_D3D_RESULT_THROW(hr, "Failed to crate warp device"); } -#ifdef DEVELOPMENT + if (EngineCI.EnableDebugLayer) { CComPtr pInfoQueue; hr = d3d12Device->QueryInterface(__uuidof(pInfoQueue), reinterpret_cast(static_cast(&pInfoQueue))); @@ -235,7 +234,6 @@ void EngineFactoryD3D12Impl::CreateDeviceAndContextsD3D12(const EngineD3D12Creat VERIFY(SUCCEEDED(hr), "Failed to set break on error"); } } -#endif #ifndef RELEASE // Prevent the GPU from overclocking or underclocking to get consistent timings -- cgit v1.2.3