summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineD3D12
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2018-03-27 15:58:06 +0000
committerEgor Yusov <egor.yusov@gmail.com>2018-03-27 15:58:06 +0000
commit87382bcca0ea984274477af3af1ff8d8c9495ced (patch)
treea9cdbd5490b767bd353dc39efdb46766d58f0154 /Graphics/GraphicsEngineD3D12
parentReworked debug message handling to allow user-specified callbacks (diff)
downloadDiligentCore-87382bcca0ea984274477af3af1ff8d8c9495ced.tar.gz
DiligentCore-87382bcca0ea984274477af3af1ff8d8c9495ced.zip
Added DebugMessageCallback to EngineCreation attribs
Diffstat (limited to 'Graphics/GraphicsEngineD3D12')
-rw-r--r--Graphics/GraphicsEngineD3D12/src/RenderDeviceFactoryD3D12.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/Graphics/GraphicsEngineD3D12/src/RenderDeviceFactoryD3D12.cpp b/Graphics/GraphicsEngineD3D12/src/RenderDeviceFactoryD3D12.cpp
index ac3e1992..8c62382b 100644
--- a/Graphics/GraphicsEngineD3D12/src/RenderDeviceFactoryD3D12.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/RenderDeviceFactoryD3D12.cpp
@@ -116,6 +116,9 @@ void EngineFactoryD3D12Impl::CreateDeviceAndContextsD3D12( const EngineD3D12Attr
IDeviceContext **ppContexts,
Uint32 NumDeferredContexts)
{
+ if (CreationAttribs.DebugMessageCallback != nullptr)
+ SetDebugMessageCallback(CreationAttribs.DebugMessageCallback);
+
VERIFY( ppDevice && ppContexts, "Null pointer provided" );
if( !ppDevice || !ppContexts )
return;
@@ -137,8 +140,6 @@ void EngineFactoryD3D12Impl::CreateDeviceAndContextsD3D12( const EngineD3D12Attr
}
}
- SetRawAllocator(CreationAttribs.pRawMemAllocator);
-
*ppDevice = nullptr;
memset(ppContexts, 0, sizeof(*ppContexts) * (1+NumDeferredContexts));
@@ -265,6 +266,9 @@ void EngineFactoryD3D12Impl::AttachToD3D12Device(void *pd3d12NativeDevice,
IDeviceContext **ppContexts,
Uint32 NumDeferredContexts)
{
+ if (EngineAttribs.DebugMessageCallback != nullptr)
+ SetDebugMessageCallback(EngineAttribs.DebugMessageCallback);
+
VERIFY( pd3d12NativeDevice && pCommandQueue && ppDevice && ppContexts, "Null pointer provided" );
if( !pd3d12NativeDevice || !pCommandQueue || !ppDevice || !ppContexts )
return;
@@ -274,6 +278,7 @@ void EngineFactoryD3D12Impl::AttachToD3D12Device(void *pd3d12NativeDevice,
try
{
+ SetRawAllocator(EngineAttribs.pRawMemAllocator);
auto &RawMemAllocator = GetRawAllocator();
auto d3d12Device = reinterpret_cast<ID3D12Device*>(pd3d12NativeDevice);
RenderDeviceD3D12Impl *pRenderDeviceD3D12( NEW_RC_OBJ(RawMemAllocator, "RenderDeviceD3D12Impl instance", RenderDeviceD3D12Impl)(RawMemAllocator, EngineAttribs, d3d12Device, pCommandQueue, NumDeferredContexts ) );