diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2019-03-05 06:38:04 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2019-03-05 06:38:04 +0000 |
| commit | f551f6353eaf4efe9b7f26d48822b96ebb0706a0 (patch) | |
| tree | 8d9f6fdb24bcacbdbc04d29f02fbe0a8a7b1f7c3 /Graphics/GraphicsEngineD3D12 | |
| parent | Completed D3D12 back-end refactor to comply with the new API (diff) | |
| download | DiligentCore-f551f6353eaf4efe9b7f26d48822b96ebb0706a0.tar.gz DiligentCore-f551f6353eaf4efe9b7f26d48822b96ebb0706a0.zip | |
Updated D3D11, D3D12, and Vk EngineFactory headers & structures
Diffstat (limited to 'Graphics/GraphicsEngineD3D12')
| -rw-r--r-- | Graphics/GraphicsEngineD3D12/CMakeLists.txt | 4 | ||||
| -rw-r--r-- | Graphics/GraphicsEngineD3D12/include/DeviceContextD3D12Impl.h | 12 | ||||
| -rw-r--r-- | Graphics/GraphicsEngineD3D12/include/RenderDeviceD3D12Impl.h | 16 | ||||
| -rw-r--r-- | Graphics/GraphicsEngineD3D12/interface/EngineFactoryD3D12.h (renamed from Graphics/GraphicsEngineD3D12/interface/RenderDeviceFactoryD3D12.h) | 24 | ||||
| -rw-r--r-- | Graphics/GraphicsEngineD3D12/readme.md | 2 | ||||
| -rw-r--r-- | Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp | 20 | ||||
| -rw-r--r-- | Graphics/GraphicsEngineD3D12/src/EngineFactoryD3D12.cpp (renamed from Graphics/GraphicsEngineD3D12/src/RenderDeviceFactoryD3D12.cpp) | 96 | ||||
| -rw-r--r-- | Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp | 30 | ||||
| -rw-r--r-- | Graphics/GraphicsEngineD3D12/src/ShaderResourceLayoutD3D12.cpp | 2 |
9 files changed, 103 insertions, 103 deletions
diff --git a/Graphics/GraphicsEngineD3D12/CMakeLists.txt b/Graphics/GraphicsEngineD3D12/CMakeLists.txt index d9505bd0..a5fac952 100644 --- a/Graphics/GraphicsEngineD3D12/CMakeLists.txt +++ b/Graphics/GraphicsEngineD3D12/CMakeLists.txt @@ -40,10 +40,10 @@ set(INTERFACE interface/BufferViewD3D12.h interface/CommandQueueD3D12.h interface/DeviceContextD3D12.h + interface/EngineFactoryD3D12.h interface/FenceD3D12.h interface/PipelineStateD3D12.h interface/RenderDeviceD3D12.h - interface/RenderDeviceFactoryD3D12.h interface/SamplerD3D12.h interface/ShaderD3D12.h interface/ShaderResourceBindingD3D12.h @@ -64,11 +64,11 @@ set(SRC src/DescriptorHeap.cpp src/DeviceContextD3D12Impl.cpp src/D3D12DynamicHeap.cpp + src/EngineFactoryD3D12.cpp src/FenceD3D12Impl.cpp src/GenerateMips.cpp src/PipelineStateD3D12Impl.cpp src/RenderDeviceD3D12Impl.cpp - src/RenderDeviceFactoryD3D12.cpp src/RootSignature.cpp src/SamplerD3D12Impl.cpp src/ShaderD3D12Impl.cpp diff --git a/Graphics/GraphicsEngineD3D12/include/DeviceContextD3D12Impl.h b/Graphics/GraphicsEngineD3D12/include/DeviceContextD3D12Impl.h index 438014e3..d22784dd 100644 --- a/Graphics/GraphicsEngineD3D12/include/DeviceContextD3D12Impl.h +++ b/Graphics/GraphicsEngineD3D12/include/DeviceContextD3D12Impl.h @@ -52,12 +52,12 @@ class DeviceContextD3D12Impl final : public DeviceContextNextGenBase< DeviceCont public: using TDeviceContextBase = DeviceContextNextGenBase< DeviceContextBase<IDeviceContextD3D12, DeviceContextD3D12ImplTraits> >; - DeviceContextD3D12Impl(IReferenceCounters* pRefCounters, - class RenderDeviceD3D12Impl* pDevice, - bool bIsDeferred, - const EngineD3D12Attribs& Attribs, - Uint32 ContextId, - Uint32 CommandQueueId); + DeviceContextD3D12Impl(IReferenceCounters* pRefCounters, + class RenderDeviceD3D12Impl* pDevice, + bool bIsDeferred, + const EngineD3D12CreateInfo& EngineCI, + Uint32 ContextId, + Uint32 CommandQueueId); ~DeviceContextD3D12Impl(); virtual void QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface)override final; diff --git a/Graphics/GraphicsEngineD3D12/include/RenderDeviceD3D12Impl.h b/Graphics/GraphicsEngineD3D12/include/RenderDeviceD3D12Impl.h index f9e4d3aa..376e32d1 100644 --- a/Graphics/GraphicsEngineD3D12/include/RenderDeviceD3D12Impl.h +++ b/Graphics/GraphicsEngineD3D12/include/RenderDeviceD3D12Impl.h @@ -45,13 +45,13 @@ class RenderDeviceD3D12Impl final : public RenderDeviceNextGenBase< RenderDevice public: using TRenderDeviceBase = RenderDeviceNextGenBase< RenderDeviceD3DBase<IRenderDeviceD3D12>, ICommandQueueD3D12 >; - RenderDeviceD3D12Impl( IReferenceCounters* pRefCounters, - IMemoryAllocator& RawMemAllocator, - const EngineD3D12Attribs& CreationAttribs, - ID3D12Device* pD3D12Device, - size_t CommandQueueCount, - ICommandQueueD3D12** ppCmdQueues, - Uint32 NumDeferredContexts ); + RenderDeviceD3D12Impl( IReferenceCounters* pRefCounters, + IMemoryAllocator& RawMemAllocator, + const EngineD3D12CreateInfo& EngineCI, + ID3D12Device* pD3D12Device, + size_t CommandQueueCount, + ICommandQueueD3D12** ppCmdQueues, + Uint32 NumDeferredContexts ); ~RenderDeviceD3D12Impl(); virtual void QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface)override final; @@ -108,7 +108,7 @@ private: CComPtr<ID3D12Device> m_pd3d12Device; - EngineD3D12Attribs m_EngineAttribs; + EngineD3D12CreateInfo m_EngineAttribs; CPUDescriptorHeap m_CPUDescriptorHeaps[D3D12_DESCRIPTOR_HEAP_TYPE_NUM_TYPES]; GPUDescriptorHeap m_GPUDescriptorHeaps[2]; // D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV == 0 diff --git a/Graphics/GraphicsEngineD3D12/interface/RenderDeviceFactoryD3D12.h b/Graphics/GraphicsEngineD3D12/interface/EngineFactoryD3D12.h index 80e6f580..7ac6e9e0 100644 --- a/Graphics/GraphicsEngineD3D12/interface/RenderDeviceFactoryD3D12.h +++ b/Graphics/GraphicsEngineD3D12/interface/EngineFactoryD3D12.h @@ -42,18 +42,18 @@ namespace Diligent class IEngineFactoryD3D12 { public: - virtual void CreateDeviceAndContextsD3D12( const EngineD3D12Attribs& CreationAttribs, - IRenderDevice** ppDevice, - IDeviceContext** ppContexts, - Uint32 NumDeferredContexts) = 0; - - virtual void AttachToD3D12Device(void* pd3d12NativeDevice, - size_t CommandQueueCount, - class ICommandQueueD3D12** ppCommandQueues, - const EngineD3D12Attribs& EngineAttribs, - IRenderDevice** ppDevice, - IDeviceContext** ppContexts, - Uint32 NumDeferredContexts) = 0; + virtual void CreateDeviceAndContextsD3D12(const EngineD3D12CreateInfo& EngineCI, + IRenderDevice** ppDevice, + IDeviceContext** ppContexts, + Uint32 NumDeferredContexts) = 0; + + virtual void AttachToD3D12Device(void* pd3d12NativeDevice, + size_t CommandQueueCount, + class ICommandQueueD3D12** ppCommandQueues, + const EngineD3D12CreateInfo& EngineCI, + IRenderDevice** ppDevice, + IDeviceContext** ppContexts, + Uint32 NumDeferredContexts) = 0; virtual void CreateSwapChainD3D12( IRenderDevice* pDevice, IDeviceContext* pImmediateContext, diff --git a/Graphics/GraphicsEngineD3D12/readme.md b/Graphics/GraphicsEngineD3D12/readme.md index 3827a4f0..85ad141b 100644 --- a/Graphics/GraphicsEngineD3D12/readme.md +++ b/Graphics/GraphicsEngineD3D12/readme.md @@ -8,7 +8,7 @@ Implementation of Direct3D12 back-end The following code snippet shows how to initialize Diligent Engine in D3D12 mode. ```cpp -#include "RenderDeviceFactoryD3D12.h" +#include "EngineFactoryD3D12.h" using namespace Diligent; // ... diff --git a/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp index 7e8eeeed..a1d9db3f 100644 --- a/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp @@ -51,39 +51,39 @@ namespace Diligent return ss.str(); } - DeviceContextD3D12Impl::DeviceContextD3D12Impl( IReferenceCounters* pRefCounters, - RenderDeviceD3D12Impl* pDeviceD3D12Impl, - bool bIsDeferred, - const EngineD3D12Attribs& Attribs, - Uint32 ContextId, - Uint32 CommandQueueId) : + DeviceContextD3D12Impl::DeviceContextD3D12Impl(IReferenceCounters* pRefCounters, + RenderDeviceD3D12Impl* pDeviceD3D12Impl, + bool bIsDeferred, + const EngineD3D12CreateInfo& EngineCI, + Uint32 ContextId, + Uint32 CommandQueueId) : TDeviceContextBase { pRefCounters, pDeviceD3D12Impl, ContextId, CommandQueueId, - bIsDeferred ? std::numeric_limits<decltype(m_NumCommandsToFlush)>::max() : Attribs.NumCommandsToFlushCmdList, + bIsDeferred ? std::numeric_limits<decltype(m_NumCommandsToFlush)>::max() : EngineCI.NumCommandsToFlushCmdList, bIsDeferred }, m_DynamicHeap { pDeviceD3D12Impl->GetDynamicMemoryManager(), GetContextObjectName("Dynamic heap", bIsDeferred, ContextId), - Attribs.DynamicHeapPageSize + EngineCI.DynamicHeapPageSize }, m_DynamicGPUDescriptorAllocator { { GetRawAllocator(), pDeviceD3D12Impl->GetGPUDescriptorHeap(D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV), - Attribs.DynamicDescriptorAllocationChunkSize[D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV], + EngineCI.DynamicDescriptorAllocationChunkSize[D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV], GetContextObjectName("CBV_SRV_UAV dynamic descriptor allocator", bIsDeferred, ContextId) }, { GetRawAllocator(), pDeviceD3D12Impl->GetGPUDescriptorHeap(D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER), - Attribs.DynamicDescriptorAllocationChunkSize[D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER], + EngineCI.DynamicDescriptorAllocationChunkSize[D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER], GetContextObjectName("SAMPLER dynamic descriptor allocator", bIsDeferred, ContextId) } }, diff --git a/Graphics/GraphicsEngineD3D12/src/RenderDeviceFactoryD3D12.cpp b/Graphics/GraphicsEngineD3D12/src/EngineFactoryD3D12.cpp index 3096ea9e..18a69020 100644 --- a/Graphics/GraphicsEngineD3D12/src/RenderDeviceFactoryD3D12.cpp +++ b/Graphics/GraphicsEngineD3D12/src/EngineFactoryD3D12.cpp @@ -26,7 +26,7 @@ #include "pch.h" #include <array> -#include "RenderDeviceFactoryD3D12.h" +#include "EngineFactoryD3D12.h" #include "RenderDeviceD3D12Impl.h" #include "DeviceContextD3D12Impl.h" #include "SwapChainD3D12Impl.h" @@ -51,18 +51,18 @@ public: return &TheFactory; } - void CreateDeviceAndContextsD3D12( const EngineD3D12Attribs& CreationAttribs, - IRenderDevice** ppDevice, - IDeviceContext** ppContexts, - Uint32 NumDeferredContexts)override final; + void CreateDeviceAndContextsD3D12(const EngineD3D12CreateInfo& EngineCI, + IRenderDevice** ppDevice, + IDeviceContext** ppContexts, + Uint32 NumDeferredContexts)override final; - void AttachToD3D12Device(void* pd3d12NativeDevice, - size_t CommandQueueCount, - ICommandQueueD3D12** ppCommandQueues, - const EngineD3D12Attribs& EngineAttribs, - IRenderDevice** ppDevice, - IDeviceContext** ppContexts, - Uint32 NumDeferredContexts)override final; + void AttachToD3D12Device(void* pd3d12NativeDevice, + size_t CommandQueueCount, + ICommandQueueD3D12** ppCommandQueues, + const EngineD3D12CreateInfo& EngineCI, + IRenderDevice** ppDevice, + IDeviceContext** ppContexts, + Uint32 NumDeferredContexts)override final; void CreateSwapChainD3D12( IRenderDevice* pDevice, IDeviceContext* pImmediateContext, @@ -101,7 +101,7 @@ void GetHardwareAdapter(IDXGIFactory2* pFactory, IDXGIAdapter1** ppAdapter) /// Creates render device and device contexts for Direct3D12-based engine implementation -/// \param [in] CreationAttribs - Engine creation attributes. +/// \param [in] EngineCI - Engine creation attributes. /// \param [out] ppDevice - Address of the memory location where pointer to /// the created device will be written /// \param [out] ppContexts - Address of the memory location where pointers to @@ -112,13 +112,13 @@ void GetHardwareAdapter(IDXGIFactory2* pFactory, IDXGIAdapter1** ppAdapter) /// of deferred contexts is requested, pointers to the /// contexts are written to ppContexts array starting /// at position 1 -void EngineFactoryD3D12Impl::CreateDeviceAndContextsD3D12( const EngineD3D12Attribs& CreationAttribs, - IRenderDevice** ppDevice, - IDeviceContext** ppContexts, - Uint32 NumDeferredContexts) +void EngineFactoryD3D12Impl::CreateDeviceAndContextsD3D12(const EngineD3D12CreateInfo& EngineCI, + IRenderDevice** ppDevice, + IDeviceContext** ppContexts, + Uint32 NumDeferredContexts) { - if (CreationAttribs.DebugMessageCallback != nullptr) - SetDebugMessageCallback(CreationAttribs.DebugMessageCallback); + if (EngineCI.DebugMessageCallback != nullptr) + SetDebugMessageCallback(EngineCI.DebugMessageCallback); VERIFY( ppDevice && ppContexts, "Null pointer provided" ); if( !ppDevice || !ppContexts ) @@ -126,7 +126,7 @@ void EngineFactoryD3D12Impl::CreateDeviceAndContextsD3D12( const EngineD3D12Attr for(Uint32 Type=D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV; Type < D3D12_DESCRIPTOR_HEAP_TYPE_NUM_TYPES; ++Type) { - auto CPUHeapAllocSize = CreationAttribs.CPUDescriptorHeapAllocationSize[Type]; + auto CPUHeapAllocSize = EngineCI.CPUDescriptorHeapAllocationSize[Type]; Uint32 MaxSize = 1 << 20; if( CPUHeapAllocSize > 1 << 20 ) { @@ -164,7 +164,7 @@ void EngineFactoryD3D12Impl::CreateDeviceAndContextsD3D12( const EngineD3D12Attr CHECK_D3D_RESULT_THROW(hr, "Failed to create DXGI factory"); CComPtr<IDXGIAdapter1> hardwareAdapter; - if(CreationAttribs.AdapterId == EngineD3D12Attribs::DefaultAdapterId) + if(EngineCI.AdapterId == EngineD3D12CreateInfo::DefaultAdapterId) { GetHardwareAdapter(factory, &hardwareAdapter); if(hardwareAdapter == nullptr) @@ -173,11 +173,11 @@ void EngineFactoryD3D12Impl::CreateDeviceAndContextsD3D12( const EngineD3D12Attr else { auto Adapters = FindCompatibleAdapters(); - if(CreationAttribs.AdapterId < Adapters.size()) - hardwareAdapter = Adapters[CreationAttribs.AdapterId]; + if(EngineCI.AdapterId < Adapters.size()) + hardwareAdapter = Adapters[EngineCI.AdapterId]; else { - LOG_ERROR_AND_THROW(CreationAttribs.AdapterId, " is not a valid hardware adapter id. Total number of compatible adapters available on this system: ", Adapters.size()); + LOG_ERROR_AND_THROW(EngineCI.AdapterId, " is not a valid hardware adapter id. Total number of compatible adapters available on this system: ", Adapters.size()); } } @@ -263,7 +263,7 @@ void EngineFactoryD3D12Impl::CreateDeviceAndContextsD3D12( const EngineD3D12Attr } std::array<ICommandQueueD3D12*, 1> CmdQueues = {pCmdQueueD3D12}; - AttachToD3D12Device(d3d12Device, CmdQueues.size(), CmdQueues.data(), CreationAttribs, ppDevice, ppContexts, NumDeferredContexts); + AttachToD3D12Device(d3d12Device, CmdQueues.size(), CmdQueues.data(), EngineCI, ppDevice, ppContexts, NumDeferredContexts); } @@ -272,7 +272,7 @@ void EngineFactoryD3D12Impl::CreateDeviceAndContextsD3D12( const EngineD3D12Attr /// \param [in] pd3d12NativeDevice - pointer to native D3D12 device /// \param [in] CommandQueueCount - Number of command queues /// \param [in] ppCommandQueues - pointer to the array of command queues -/// \param [in] EngineAttribs - Engine creation attributes. +/// \param [in] EngineCI - Engine creation attributes. /// \param [out] ppDevice - Address of the memory location where pointer to /// the created device will be written /// \param [out] ppContexts - Address of the memory location where pointers to @@ -283,16 +283,16 @@ void EngineFactoryD3D12Impl::CreateDeviceAndContextsD3D12( const EngineD3D12Attr /// of deferred contexts is requested, pointers to the /// contexts are written to ppContexts array starting /// at position 1 -void EngineFactoryD3D12Impl::AttachToD3D12Device(void* pd3d12NativeDevice, - size_t CommandQueueCount, - ICommandQueueD3D12** ppCommandQueues, - const EngineD3D12Attribs& EngineAttribs, - IRenderDevice** ppDevice, - IDeviceContext** ppContexts, - Uint32 NumDeferredContexts) +void EngineFactoryD3D12Impl::AttachToD3D12Device(void* pd3d12NativeDevice, + size_t CommandQueueCount, + ICommandQueueD3D12** ppCommandQueues, + const EngineD3D12CreateInfo& EngineCI, + IRenderDevice** ppDevice, + IDeviceContext** ppContexts, + Uint32 NumDeferredContexts) { - if (EngineAttribs.DebugMessageCallback != nullptr) - SetDebugMessageCallback(EngineAttribs.DebugMessageCallback); + if (EngineCI.DebugMessageCallback != nullptr) + SetDebugMessageCallback(EngineCI.DebugMessageCallback); VERIFY( pd3d12NativeDevice && ppCommandQueues && ppDevice && ppContexts, "Null pointer provided" ); if( !pd3d12NativeDevice || !ppCommandQueues || !ppDevice || !ppContexts ) @@ -303,13 +303,13 @@ void EngineFactoryD3D12Impl::AttachToD3D12Device(void* pd3d1 try { - SetRawAllocator(EngineAttribs.pRawMemAllocator); + SetRawAllocator(EngineCI.pRawMemAllocator); auto &RawMemAllocator = GetRawAllocator(); auto d3d12Device = reinterpret_cast<ID3D12Device*>(pd3d12NativeDevice); - RenderDeviceD3D12Impl *pRenderDeviceD3D12( NEW_RC_OBJ(RawMemAllocator, "RenderDeviceD3D12Impl instance", RenderDeviceD3D12Impl)(RawMemAllocator, EngineAttribs, d3d12Device, CommandQueueCount, ppCommandQueues, NumDeferredContexts ) ); + RenderDeviceD3D12Impl *pRenderDeviceD3D12( NEW_RC_OBJ(RawMemAllocator, "RenderDeviceD3D12Impl instance", RenderDeviceD3D12Impl)(RawMemAllocator, EngineCI, d3d12Device, CommandQueueCount, ppCommandQueues, NumDeferredContexts ) ); pRenderDeviceD3D12->QueryInterface(IID_RenderDevice, reinterpret_cast<IObject**>(ppDevice) ); - RefCntAutoPtr<DeviceContextD3D12Impl> pImmediateCtxD3D12( NEW_RC_OBJ(RawMemAllocator, "DeviceContextD3D12Impl instance", DeviceContextD3D12Impl)(pRenderDeviceD3D12, false, EngineAttribs, 0, 0) ); + RefCntAutoPtr<DeviceContextD3D12Impl> pImmediateCtxD3D12( NEW_RC_OBJ(RawMemAllocator, "DeviceContextD3D12Impl instance", DeviceContextD3D12Impl)(pRenderDeviceD3D12, false, EngineCI, 0, 0) ); // We must call AddRef() (implicitly through QueryInterface()) because pRenderDeviceD3D12 will // keep a weak reference to the context pImmediateCtxD3D12->QueryInterface(IID_DeviceContext, reinterpret_cast<IObject**>(ppContexts) ); @@ -317,7 +317,7 @@ void EngineFactoryD3D12Impl::AttachToD3D12Device(void* pd3d1 for (Uint32 DeferredCtx = 0; DeferredCtx < NumDeferredContexts; ++DeferredCtx) { - RefCntAutoPtr<DeviceContextD3D12Impl> pDeferredCtxD3D12( NEW_RC_OBJ(RawMemAllocator, "DeviceContextD3D12Impl instance", DeviceContextD3D12Impl)(pRenderDeviceD3D12, true, EngineAttribs, 1+DeferredCtx, 0) ); + RefCntAutoPtr<DeviceContextD3D12Impl> pDeferredCtxD3D12( NEW_RC_OBJ(RawMemAllocator, "DeviceContextD3D12Impl instance", DeviceContextD3D12Impl)(pRenderDeviceD3D12, true, EngineCI, 1+DeferredCtx, 0) ); // We must call AddRef() (implicitly through QueryInterface()) because pRenderDeviceD3D12 will // keep a weak reference to the context pDeferredCtxD3D12->QueryInterface(IID_DeviceContext, reinterpret_cast<IObject**>(ppContexts + 1 + DeferredCtx) ); @@ -358,12 +358,12 @@ void EngineFactoryD3D12Impl::AttachToD3D12Device(void* pd3d1 /// /// \param [out] ppSwapChain - Address of the memory location where pointer to the new /// swap chain will be written -void EngineFactoryD3D12Impl::CreateSwapChainD3D12( IRenderDevice* pDevice, - IDeviceContext* pImmediateContext, - const SwapChainDesc& SCDesc, - const FullScreenModeDesc& FSDesc, - void* pNativeWndHandle, - ISwapChain** ppSwapChain ) +void EngineFactoryD3D12Impl::CreateSwapChainD3D12(IRenderDevice* pDevice, + IDeviceContext* pImmediateContext, + const SwapChainDesc& SCDesc, + const FullScreenModeDesc& FSDesc, + void* pNativeWndHandle, + ISwapChain** ppSwapChain ) { VERIFY( ppSwapChain, "Null pointer provided" ); if( !ppSwapChain ) @@ -390,7 +390,7 @@ void EngineFactoryD3D12Impl::CreateSwapChainD3D12( IRenderDevice* pDe { if (auto pDeferredCtx = pDeviceD3D12->GetDeferredContext(ctx)) { - auto *pDeferredCtxD3D12 = pDeferredCtx.RawPtr<DeviceContextD3D12Impl>(); + auto* pDeferredCtxD3D12 = pDeferredCtx.RawPtr<DeviceContextD3D12Impl>(); pDeferredCtxD3D12->SetSwapChain(pSwapChainD3D12); // We cannot bind default render target here because // there is no guarantee that deferred context will be used @@ -399,7 +399,7 @@ void EngineFactoryD3D12Impl::CreateSwapChainD3D12( IRenderDevice* pDe } } } - catch( const std::runtime_error & ) + catch( const std::runtime_error& ) { if( *ppSwapChain ) { @@ -422,7 +422,7 @@ void EngineFactoryD3D12Impl::CreateSwapChainD3D12( IRenderDevice* pDe /// x86 | GraphicsEngineD3D12_32d.dll | GraphicsEngineD3D12_32r.dll /// x64 | GraphicsEngineD3D12_64d.dll | GraphicsEngineD3D12_64r.dll /// -void LoadGraphicsEngineD3D12(GetEngineFactoryD3D12Type &GetFactoryFunc) +void LoadGraphicsEngineD3D12(GetEngineFactoryD3D12Type& GetFactoryFunc) { // This function is only required because DoxyGen refuses to generate documentation for a static function when SHOW_FILES==NO #error This function must never be compiled; diff --git a/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp index 4640daad..54396583 100644 --- a/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp @@ -37,13 +37,13 @@ namespace Diligent { -RenderDeviceD3D12Impl :: RenderDeviceD3D12Impl(IReferenceCounters* pRefCounters, - IMemoryAllocator& RawMemAllocator, - const EngineD3D12Attribs& CreationAttribs, - ID3D12Device* pd3d12Device, - size_t CommandQueueCount, - ICommandQueueD3D12** ppCmdQueues, - Uint32 NumDeferredContexts) : +RenderDeviceD3D12Impl :: RenderDeviceD3D12Impl(IReferenceCounters* pRefCounters, + IMemoryAllocator& RawMemAllocator, + const EngineD3D12CreateInfo& EngineCI, + ID3D12Device* pd3d12Device, + size_t CommandQueueCount, + ICommandQueueD3D12** ppCmdQueues, + Uint32 NumDeferredContexts) : TRenderDeviceBase { pRefCounters, @@ -62,22 +62,22 @@ RenderDeviceD3D12Impl :: RenderDeviceD3D12Impl(IReferenceCounters* pRef sizeof(FenceD3D12Impl) }, m_pd3d12Device (pd3d12Device), - m_EngineAttribs (CreationAttribs), + m_EngineAttribs (EngineCI), m_CmdListManager(*this), m_CPUDescriptorHeaps { - {RawMemAllocator, *this, CreationAttribs.CPUDescriptorHeapAllocationSize[0], D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, D3D12_DESCRIPTOR_HEAP_FLAG_NONE}, - {RawMemAllocator, *this, CreationAttribs.CPUDescriptorHeapAllocationSize[1], D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER, D3D12_DESCRIPTOR_HEAP_FLAG_NONE}, - {RawMemAllocator, *this, CreationAttribs.CPUDescriptorHeapAllocationSize[2], D3D12_DESCRIPTOR_HEAP_TYPE_RTV, D3D12_DESCRIPTOR_HEAP_FLAG_NONE}, - {RawMemAllocator, *this, CreationAttribs.CPUDescriptorHeapAllocationSize[3], D3D12_DESCRIPTOR_HEAP_TYPE_DSV, D3D12_DESCRIPTOR_HEAP_FLAG_NONE} + {RawMemAllocator, *this, EngineCI.CPUDescriptorHeapAllocationSize[0], D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, D3D12_DESCRIPTOR_HEAP_FLAG_NONE}, + {RawMemAllocator, *this, EngineCI.CPUDescriptorHeapAllocationSize[1], D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER, D3D12_DESCRIPTOR_HEAP_FLAG_NONE}, + {RawMemAllocator, *this, EngineCI.CPUDescriptorHeapAllocationSize[2], D3D12_DESCRIPTOR_HEAP_TYPE_RTV, D3D12_DESCRIPTOR_HEAP_FLAG_NONE}, + {RawMemAllocator, *this, EngineCI.CPUDescriptorHeapAllocationSize[3], D3D12_DESCRIPTOR_HEAP_TYPE_DSV, D3D12_DESCRIPTOR_HEAP_FLAG_NONE} }, m_GPUDescriptorHeaps { - {RawMemAllocator, *this, CreationAttribs.GPUDescriptorHeapSize[0], CreationAttribs.GPUDescriptorHeapDynamicSize[0], D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE}, - {RawMemAllocator, *this, CreationAttribs.GPUDescriptorHeapSize[1], CreationAttribs.GPUDescriptorHeapDynamicSize[1], D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER, D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE} + {RawMemAllocator, *this, EngineCI.GPUDescriptorHeapSize[0], EngineCI.GPUDescriptorHeapDynamicSize[0], D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE}, + {RawMemAllocator, *this, EngineCI.GPUDescriptorHeapSize[1], EngineCI.GPUDescriptorHeapDynamicSize[1], D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER, D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE} }, m_ContextPool(STD_ALLOCATOR_RAW_MEM(PooledCommandContext, GetRawAllocator(), "Allocator for vector<PooledCommandContext>")), - m_DynamicMemoryManager(GetRawAllocator(), *this, CreationAttribs.NumDynamicHeapPagesToReserve, CreationAttribs.DynamicHeapPageSize), + m_DynamicMemoryManager(GetRawAllocator(), *this, EngineCI.NumDynamicHeapPagesToReserve, EngineCI.DynamicHeapPageSize), m_MipsGenerator(pd3d12Device) { m_DeviceCaps.DevType = DeviceType::D3D12; diff --git a/Graphics/GraphicsEngineD3D12/src/ShaderResourceLayoutD3D12.cpp b/Graphics/GraphicsEngineD3D12/src/ShaderResourceLayoutD3D12.cpp index de7458b6..393c1c3b 100644 --- a/Graphics/GraphicsEngineD3D12/src/ShaderResourceLayoutD3D12.cpp +++ b/Graphics/GraphicsEngineD3D12/src/ShaderResourceLayoutD3D12.cpp @@ -749,7 +749,7 @@ void ShaderResourceLayoutD3D12::CopyStaticResourceDesriptorHandles(const ShaderR // D3D12_DESCRIPTOR_RANGE_TYPE_CBV = 2 const auto& SrcRes = SrcCache.GetRootTable(RangeType).GetResource(BindPoint, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, m_pResources->GetShaderType()); if( !SrcRes.pObject ) - LOG_ERROR_MESSAGE( "No resource assigned to static shader variable '", res.Attribs.GetPrintName(ArrInd), "' in shader '", GetShaderName(), "'." ); + LOG_ERROR_MESSAGE( "No resource is assigned to static shader variable '", res.Attribs.GetPrintName(ArrInd), "' in shader '", GetShaderName(), "'." ); // Destination resource is at the root index and offset defined by the resource layout auto& DstRes = DstCache.GetRootTable(res.RootIndex).GetResource(res.OffsetFromTableStart + ArrInd, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, m_pResources->GetShaderType()); |
