summaryrefslogtreecommitdiffstats
path: root/Graphics
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2019-09-26 15:05:03 +0000
committerEgor Yusov <egor.yusov@gmail.com>2019-09-26 15:05:03 +0000
commit8f27b8a0351b4c1403a79155bb0c37055263d779 (patch)
tree21298b806e5d30c5446e4ba7026062a4a8e5d553 /Graphics
parentGL backend: fixed issue with random glBindBuffer() calls messing up currently... (diff)
downloadDiligentCore-8f27b8a0351b4c1403a79155bb0c37055263d779.tar.gz
DiligentCore-8f27b8a0351b4c1403a79155bb0c37055263d779.zip
Added EngineD3D12CreateInfo::EnableDebugLayer (updated API Version to 240030)
Diffstat (limited to 'Graphics')
-rw-r--r--Graphics/GraphicsEngine/interface/APIInfo.h2
-rw-r--r--Graphics/GraphicsEngine/interface/GraphicsTypes.h5
-rw-r--r--Graphics/GraphicsEngineD3D12/include/CommandListD3D12Impl.h10
-rw-r--r--Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp2
-rw-r--r--Graphics/GraphicsEngineD3D12/src/EngineFactoryD3D12.cpp6
5 files changed, 18 insertions, 7 deletions
diff --git a/Graphics/GraphicsEngine/interface/APIInfo.h b/Graphics/GraphicsEngine/interface/APIInfo.h
index 7d4ab626..2f02c994 100644
--- a/Graphics/GraphicsEngine/interface/APIInfo.h
+++ b/Graphics/GraphicsEngine/interface/APIInfo.h
@@ -26,7 +26,7 @@
/// \file
/// Diligent API information
-#define DILIGENT_API_VERSION 240029
+#define DILIGENT_API_VERSION 240030
#include "../../../Primitives/interface/BasicTypes.h"
diff --git a/Graphics/GraphicsEngine/interface/GraphicsTypes.h b/Graphics/GraphicsEngine/interface/GraphicsTypes.h
index 9904b5c0..fb5332b3 100644
--- a/Graphics/GraphicsEngine/interface/GraphicsTypes.h
+++ b/Graphics/GraphicsEngine/interface/GraphicsTypes.h
@@ -1351,6 +1351,9 @@ namespace Diligent
/// Id of the hardware adapter the engine should be initialized on
Uint32 AdapterId = DefaultAdapterId;
+ /// Enable Direct3D12 debug layer.
+ bool EnableDebugLayer = false;
+
/// Size of the CPU descriptor heap allocations for different heap types.
Uint32 CPUDescriptorHeapAllocationSize[4] =
{
@@ -1403,7 +1406,7 @@ namespace Diligent
/// Attributes specific to Vulkan engine
struct EngineVkCreateInfo : public EngineCreateInfo
{
- /// Enable validation layers. Validation is always enabled in Debug mode
+ /// Enable Vulkan validation layers.
bool EnableValidation = false;
/// Number of global Vulkan extensions
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<DeviceContextD3D12Impl>& 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<ID3D12Device> d3d12Device;
try
{
-#ifdef DEVELOPMENT
// Enable the D3D12 debug layer.
+ if (EngineCI.EnableDebugLayer)
{
CComPtr<ID3D12Debug> debugController;
if (SUCCEEDED(D3D12GetDebugInterface(__uuidof(debugController), reinterpret_cast<void**>(static_cast<ID3D12Debug**>(&debugController)) )))
@@ -156,7 +156,6 @@ void EngineFactoryD3D12Impl::CreateDeviceAndContextsD3D12(const EngineD3D12Creat
debugController->EnableDebugLayer();
}
}
-#endif
CComPtr<IDXGIFactory4> factory;
HRESULT hr = CreateDXGIFactory1(__uuidof(factory), reinterpret_cast<void**>(static_cast<IDXGIFactory4**>(&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<ID3D12InfoQueue> pInfoQueue;
hr = d3d12Device->QueryInterface(__uuidof(pInfoQueue), reinterpret_cast<void**>(static_cast<ID3D12InfoQueue**>(&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