From 87382bcca0ea984274477af3af1ff8d8c9495ced Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Tue, 27 Mar 2018 08:58:06 -0700 Subject: Added DebugMessageCallback to EngineCreation attribs --- Graphics/GraphicsEngineD3D12/src/RenderDeviceFactoryD3D12.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'Graphics/GraphicsEngineD3D12') 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(pd3d12NativeDevice); RenderDeviceD3D12Impl *pRenderDeviceD3D12( NEW_RC_OBJ(RawMemAllocator, "RenderDeviceD3D12Impl instance", RenderDeviceD3D12Impl)(RawMemAllocator, EngineAttribs, d3d12Device, pCommandQueue, NumDeferredContexts ) ); -- cgit v1.2.3