diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2019-03-18 15:44:28 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2019-03-18 15:44:28 +0000 |
| commit | 129d91df29d911d80b8774476c05027a1eaa0c73 (patch) | |
| tree | cbd6aed547e7d6e394847ef83ab019f8bc19634c | |
| parent | Updated readme (diff) | |
| download | DiligentEngine-129d91df29d911d80b8774476c05027a1eaa0c73.tar.gz DiligentEngine-129d91df29d911d80b8774476c05027a1eaa0c73.zip | |
Updates to comply with the new engine factory API
| m--------- | DiligentCore | 0 | ||||
| m--------- | DiligentSamples | 0 | ||||
| -rw-r--r-- | Projects/Asteroids/src/asteroids_DE.cpp | 29 | ||||
| -rw-r--r-- | Tests/TestApp/src/TestApp.cpp | 12 | ||||
| -rw-r--r-- | unityplugin/GhostCubePlugin/PluginSource/src/RenderAPI_D3D11.cpp | 2 | ||||
| -rw-r--r-- | unityplugin/GhostCubePlugin/PluginSource/src/RenderAPI_D3D12.cpp | 2 | ||||
| -rw-r--r-- | unityplugin/UnityEmulator/src/DiligentGraphicsAdapterD3D11.cpp | 2 | ||||
| -rw-r--r-- | unityplugin/UnityEmulator/src/DiligentGraphicsAdapterD3D12.cpp | 2 |
8 files changed, 28 insertions, 21 deletions
diff --git a/DiligentCore b/DiligentCore -Subproject 00e22a76eecccd022da7ab1fe404d5957b6240b +Subproject 86af8a7c8c1f4598efa6effcec3fb85d12161e9 diff --git a/DiligentSamples b/DiligentSamples -Subproject 7d07171b1db00e902d8b2c3f0cabe342ef91fa7 +Subproject b990c26ff3c712c478f270da1b72a2af326d149 diff --git a/Projects/Asteroids/src/asteroids_DE.cpp b/Projects/Asteroids/src/asteroids_DE.cpp index 5962108..c87d488 100644 --- a/Projects/Asteroids/src/asteroids_DE.cpp +++ b/Projects/Asteroids/src/asteroids_DE.cpp @@ -92,16 +92,17 @@ void Asteroids::InitDevice(HWND hWnd, DeviceType DevType) #if D3D11_SUPPORTED case DeviceType::D3D11: { - EngineD3D11CreateInfo DeviceAttribs; - DeviceAttribs.DebugFlags = (Uint32)EngineD3D11DebugFlags::VerifyCommittedShaderResources | - (Uint32)EngineD3D11DebugFlags::VerifyCommittedResourceRelevance; + EngineD3D11CreateInfo EngineCI; + EngineCI.NumDeferredContexts = mNumSubsets-1; + EngineCI.DebugFlags = (Uint32)EngineD3D11DebugFlags::VerifyCommittedShaderResources | + (Uint32)EngineD3D11DebugFlags::VerifyCommittedResourceRelevance; #if ENGINE_DLL if(!GetEngineFactoryD3D11) LoadGraphicsEngineD3D11(GetEngineFactoryD3D11); #endif auto *pFactoryD3D11 = GetEngineFactoryD3D11(); - pFactoryD3D11->CreateDeviceAndContextsD3D11( DeviceAttribs, &mDevice, ppContexts.data(), mNumSubsets-1 ); + pFactoryD3D11->CreateDeviceAndContextsD3D11( EngineCI, &mDevice, ppContexts.data() ); pFactoryD3D11->CreateSwapChainD3D11( mDevice, ppContexts[0], SwapChainDesc, FullScreenModeDesc{}, hWnd, &mSwapChain ); } break; @@ -111,19 +112,20 @@ void Asteroids::InitDevice(HWND hWnd, DeviceType DevType) #if D3D12_SUPPORTED case DeviceType::D3D12: { - EngineD3D12CreateInfo Attribs; - Attribs.GPUDescriptorHeapDynamicSize[0] = 65536*4; - Attribs.GPUDescriptorHeapSize[0] = 65536; // For mutable mode - Attribs.NumCommandsToFlushCmdList = 1024; + EngineD3D12CreateInfo EngineCI; + EngineCI.NumDeferredContexts = mNumSubsets-1; + EngineCI.GPUDescriptorHeapDynamicSize[0] = 65536*4; + EngineCI.GPUDescriptorHeapSize[0] = 65536; // For mutable mode + EngineCI.NumCommandsToFlushCmdList = 1024; #ifndef _DEBUG - Attribs.DynamicDescriptorAllocationChunkSize[0] = 8192; + EngineCI.DynamicDescriptorAllocationChunkSize[0] = 8192; #endif #if ENGINE_DLL if(!GetEngineFactoryD3D12) LoadGraphicsEngineD3D12(GetEngineFactoryD3D12); #endif auto *pFactoryD3D12 = GetEngineFactoryD3D12(); - pFactoryD3D12->CreateDeviceAndContextsD3D12( Attribs, &mDevice, ppContexts.data(), mNumSubsets-1 ); + pFactoryD3D12->CreateDeviceAndContextsD3D12( EngineCI, &mDevice, ppContexts.data() ); pFactoryD3D12->CreateSwapChainD3D12( mDevice, ppContexts[0], SwapChainDesc, FullScreenModeDesc{}, hWnd, &mSwapChain ); } break; @@ -133,14 +135,15 @@ void Asteroids::InitDevice(HWND hWnd, DeviceType DevType) #if VULKAN_SUPPORTED case DeviceType::Vulkan: { - EngineVkCreateInfo Attribs; - Attribs.DynamicHeapSize = 64 << 20; + EngineVkCreateInfo EngineCI; + EngineCI.NumDeferredContexts = mNumSubsets-1; + EngineCI.DynamicHeapSize = 64 << 20; #if ENGINE_DLL if(!GetEngineFactoryVulkan) LoadGraphicsEngineVk(GetEngineFactoryVulkan); #endif auto *pFactoryVk = GetEngineFactoryVulkan(); - pFactoryVk->CreateDeviceAndContextsVk( Attribs, &mDevice, ppContexts.data(), mNumSubsets-1 ); + pFactoryVk->CreateDeviceAndContextsVk( EngineCI, &mDevice, ppContexts.data() ); pFactoryVk->CreateSwapChainVk( mDevice, ppContexts[0], SwapChainDesc, hWnd, &mSwapChain ); } break; diff --git a/Tests/TestApp/src/TestApp.cpp b/Tests/TestApp/src/TestApp.cpp index fdf5ff7..c8633fe 100644 --- a/Tests/TestApp/src/TestApp.cpp +++ b/Tests/TestApp/src/TestApp.cpp @@ -186,8 +186,9 @@ void TestApp::InitializeDiligentEngine( AdapterDisplayModes.emplace_back(std::move(DisplayModes)); } + DeviceAttribs.NumDeferredContexts = NumDeferredCtx; ppContexts.resize(1 + NumDeferredCtx); - pFactoryD3D11->CreateDeviceAndContextsD3D11(DeviceAttribs, &m_pDevice, ppContexts.data(), NumDeferredCtx); + pFactoryD3D11->CreateDeviceAndContextsD3D11(DeviceAttribs, &m_pDevice, ppContexts.data()); if(NativeWindowHandle != nullptr) pFactoryD3D11->CreateSwapChainD3D11(m_pDevice, ppContexts[0], SCDesc, FullScreenModeDesc{}, NativeWindowHandle, &m_pSwapChain); @@ -228,7 +229,8 @@ void TestApp::InitializeDiligentEngine( EngD3D12Attribs.DynamicDescriptorAllocationChunkSize[1] = 8; // D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER ppContexts.resize(1 + NumDeferredCtx); - pFactoryD3D12->CreateDeviceAndContextsD3D12(EngD3D12Attribs, &m_pDevice, ppContexts.data(), NumDeferredCtx); + EngD3D12Attribs.NumDeferredContexts = NumDeferredCtx; + pFactoryD3D12->CreateDeviceAndContextsD3D12(EngD3D12Attribs, &m_pDevice, ppContexts.data()); if (!m_pSwapChain && NativeWindowHandle != nullptr) pFactoryD3D12->CreateSwapChainD3D12(m_pDevice, ppContexts[0], SCDesc, FullScreenModeDesc{}, NativeWindowHandle, &m_pSwapChain); @@ -299,9 +301,10 @@ void TestApp::InitializeDiligentEngine( Features.vertexPipelineStoresAndAtomics = true; Features.fragmentStoresAndAtomics = true; + EngVkAttribs.NumDeferredContexts = NumDeferredCtx; ppContexts.resize(1 + NumDeferredCtx); auto *pFactoryVk = GetEngineFactoryVk(); - pFactoryVk->CreateDeviceAndContextsVk(EngVkAttribs, &m_pDevice, ppContexts.data(), NumDeferredCtx); + pFactoryVk->CreateDeviceAndContextsVk(EngVkAttribs, &m_pDevice, ppContexts.data()); if (!m_pSwapChain && NativeWindowHandle != nullptr) pFactoryVk->CreateSwapChainVk(m_pDevice, ppContexts[0], SCDesc, NativeWindowHandle, &m_pSwapChain); @@ -314,9 +317,10 @@ void TestApp::InitializeDiligentEngine( { EngineMtlCreateInfo MtlAttribs; + MtlAttribs.NumDeferredContexts = NumDeferredCtx; ppContexts.resize(1 + NumDeferredCtx); auto *pFactoryMtl = GetEngineFactoryMtl(); - pFactoryMtl->CreateDeviceAndContextsMtl(MtlAttribs, &m_pDevice, ppContexts.data(), NumDeferredCtx); + pFactoryMtl->CreateDeviceAndContextsMtl(MtlAttribs, &m_pDevice, ppContexts.data()); if (!m_pSwapChain && NativeWindowHandle != nullptr) pFactoryMtl->CreateSwapChainMtl(m_pDevice, ppContexts[0], SCDesc, NativeWindowHandle, &m_pSwapChain); diff --git a/unityplugin/GhostCubePlugin/PluginSource/src/RenderAPI_D3D11.cpp b/unityplugin/GhostCubePlugin/PluginSource/src/RenderAPI_D3D11.cpp index ca83f18..3564939 100644 --- a/unityplugin/GhostCubePlugin/PluginSource/src/RenderAPI_D3D11.cpp +++ b/unityplugin/GhostCubePlugin/PluginSource/src/RenderAPI_D3D11.cpp @@ -51,7 +51,7 @@ void RenderAPI_D3D11::ProcessDeviceEvent(UnityGfxDeviceEventType type, IUnityInt m_d3d11Device->GetImmediateContext(&d3d11ImmediateContext); auto *pFactoryD3d11 = GetEngineFactoryD3D11(); EngineD3D11CreateInfo Attribs; - pFactoryD3d11->AttachToD3D11Device(m_d3d11Device, d3d11ImmediateContext, Attribs, &m_Device, &m_Context, 0); + pFactoryD3d11->AttachToD3D11Device(m_d3d11Device, d3d11ImmediateContext, Attribs, &m_Device, &m_Context); break; } diff --git a/unityplugin/GhostCubePlugin/PluginSource/src/RenderAPI_D3D12.cpp b/unityplugin/GhostCubePlugin/PluginSource/src/RenderAPI_D3D12.cpp index fd21662..af707ab 100644 --- a/unityplugin/GhostCubePlugin/PluginSource/src/RenderAPI_D3D12.cpp +++ b/unityplugin/GhostCubePlugin/PluginSource/src/RenderAPI_D3D12.cpp @@ -146,7 +146,7 @@ void RenderAPI_D3D12::ProcessDeviceEvent(UnityGfxDeviceEventType type, IUnityInt auto *pFactoryD3D12 = GetEngineFactoryD3D12(); EngineD3D12CreateInfo Attribs; std::array<ICommandQueueD3D12*, 1> CmdQueues = {m_CmdQueue}; - pFactoryD3D12->AttachToD3D12Device(d3d12Device, CmdQueues.size(), CmdQueues.data(), Attribs, &m_Device, &m_Context, 0); + pFactoryD3D12->AttachToD3D12Device(d3d12Device, CmdQueues.size(), CmdQueues.data(), Attribs, &m_Device, &m_Context); m_Device->QueryInterface(IID_RenderDeviceD3D12, reinterpret_cast<IObject**>(static_cast<IRenderDeviceD3D12**>(&m_RenderDeviceD3D12))); } break; diff --git a/unityplugin/UnityEmulator/src/DiligentGraphicsAdapterD3D11.cpp b/unityplugin/UnityEmulator/src/DiligentGraphicsAdapterD3D11.cpp index aea6e42..5c5b253 100644 --- a/unityplugin/UnityEmulator/src/DiligentGraphicsAdapterD3D11.cpp +++ b/unityplugin/UnityEmulator/src/DiligentGraphicsAdapterD3D11.cpp @@ -109,7 +109,7 @@ DiligentGraphicsAdapterD3D11::DiligentGraphicsAdapterD3D11(const UnityGraphicsD3 ID3D11DeviceContext *pd3d11Context = GraphicsD3D11Impl->GetD3D11Context(); auto *pFactoryD3d11 = GetEngineFactoryD3D11(); EngineD3D11CreateInfo Attribs; - pFactoryD3d11->AttachToD3D11Device(pd3d11Device, pd3d11Context, Attribs, &m_pDevice, &m_pDeviceCtx, 0); + pFactoryD3d11->AttachToD3D11Device(pd3d11Device, pd3d11Context, Attribs, &m_pDevice, &m_pDeviceCtx); } void DiligentGraphicsAdapterD3D11::InitProxySwapChain() diff --git a/unityplugin/UnityEmulator/src/DiligentGraphicsAdapterD3D12.cpp b/unityplugin/UnityEmulator/src/DiligentGraphicsAdapterD3D12.cpp index 818d0f2..34d68f3 100644 --- a/unityplugin/UnityEmulator/src/DiligentGraphicsAdapterD3D12.cpp +++ b/unityplugin/UnityEmulator/src/DiligentGraphicsAdapterD3D12.cpp @@ -206,7 +206,7 @@ DiligentGraphicsAdapterD3D12::DiligentGraphicsAdapterD3D12(UnityGraphicsD3D12Emu auto *pFactoryD3D12 = GetEngineFactoryD3D12(); EngineD3D12CreateInfo Attribs; std::array<ICommandQueueD3D12*, 1> CmdQueues = {CmdQueue}; - pFactoryD3D12->AttachToD3D12Device(d3d12Device, CmdQueues.size(), CmdQueues.data(), Attribs, &m_pDevice, &m_pDeviceCtx, 0); + pFactoryD3D12->AttachToD3D12Device(d3d12Device, CmdQueues.size(), CmdQueues.data(), Attribs, &m_pDevice, &m_pDeviceCtx); } void DiligentGraphicsAdapterD3D12::InitProxySwapChain() |
