summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2018-07-22 03:31:41 +0000
committerEgor Yusov <egor.yusov@gmail.com>2018-07-22 03:31:41 +0000
commit03a7b275d254f6db7267ff894aeebb58e2e6e72f (patch)
treef05b1a86581210a21b0fe42fed4f239b25412a55
parentUpdated readme (diff)
downloadDiligentEngine-03a7b275d254f6db7267ff894aeebb58e2e6e72f.tar.gz
DiligentEngine-03a7b275d254f6db7267ff894aeebb58e2e6e72f.zip
Added IFence interface
m---------DiligentCore0
-rw-r--r--README.md6
-rw-r--r--Tests/IncludeTest/src/GraphicsEngine/FenceH_test.cpp24
-rw-r--r--Tests/IncludeTest/src/GraphicsEngineD3D11/FenceD3D11H_test.cpp25
-rw-r--r--Tests/IncludeTest/src/GraphicsEngineD3D12/FenceD3D12H_test.cpp25
-rw-r--r--Tests/IncludeTest/src/GraphicsEngineOpenGL/FenceGLH_test .cpp25
-rw-r--r--Tests/TestApp/include/TestApp.h2
-rw-r--r--Tests/TestApp/src/TestApp.cpp13
-rw-r--r--unityplugin/GhostCubePlugin/PluginSource/src/RenderAPI_D3D12.cpp5
-rw-r--r--unityplugin/UnityEmulator/src/DiligentGraphicsAdapterD3D12.cpp5
10 files changed, 130 insertions, 0 deletions
diff --git a/DiligentCore b/DiligentCore
-Subproject 985d14e5ebef7006f25c58529923c582608ed72
+Subproject 47ddd8c9f1b89ba9706c79dce8cdf73149a00ab
diff --git a/README.md b/README.md
index f6d6f9a..473aa3a 100644
--- a/README.md
+++ b/README.md
@@ -420,6 +420,12 @@ and adds implementation using Diligent Engine API to allow comparing performance
# Version History
+
+## Current Progress
+
+* Core
+ * Added `IFence` interface and `IDeviceContext::SignalFence()` method to enable CPU-GPU synchronization
+
## v2.3
* Core:
diff --git a/Tests/IncludeTest/src/GraphicsEngine/FenceH_test.cpp b/Tests/IncludeTest/src/GraphicsEngine/FenceH_test.cpp
new file mode 100644
index 0000000..64f5cc5
--- /dev/null
+++ b/Tests/IncludeTest/src/GraphicsEngine/FenceH_test.cpp
@@ -0,0 +1,24 @@
+/* Copyright 2015-2018 Egor Yusov
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS.
+ *
+ * In no event and under no legal theory, whether in tort (including negligence),
+ * contract, or otherwise, unless required by applicable law (such as deliberate
+ * and grossly negligent acts) or agreed to in writing, shall any Contributor be
+ * liable for any damages, including any direct, indirect, special, incidental,
+ * or consequential damages of any character arising as a result of this License or
+ * out of the use or inability to use the software (including but not limited to damages
+ * for loss of goodwill, work stoppage, computer failure or malfunction, or any and
+ * all other commercial damages or losses), even if such Contributor has been advised
+ * of the possibility of such damages.
+ */
+
+#include "DiligentCore/Graphics/GraphicsEngine/interface/Fence.h" \ No newline at end of file
diff --git a/Tests/IncludeTest/src/GraphicsEngineD3D11/FenceD3D11H_test.cpp b/Tests/IncludeTest/src/GraphicsEngineD3D11/FenceD3D11H_test.cpp
new file mode 100644
index 0000000..db8fcce
--- /dev/null
+++ b/Tests/IncludeTest/src/GraphicsEngineD3D11/FenceD3D11H_test.cpp
@@ -0,0 +1,25 @@
+/* Copyright 2015-2018 Egor Yusov
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS.
+ *
+ * In no event and under no legal theory, whether in tort (including negligence),
+ * contract, or otherwise, unless required by applicable law (such as deliberate
+ * and grossly negligent acts) or agreed to in writing, shall any Contributor be
+ * liable for any damages, including any direct, indirect, special, incidental,
+ * or consequential damages of any character arising as a result of this License or
+ * out of the use or inability to use the software (including but not limited to damages
+ * for loss of goodwill, work stoppage, computer failure or malfunction, or any and
+ * all other commercial damages or losses), even if such Contributor has been advised
+ * of the possibility of such damages.
+ */
+
+#include <d3d11.h>
+#include "DiligentCore/Graphics/GraphicsEngineD3D11/interface/FenceD3D11.h"
diff --git a/Tests/IncludeTest/src/GraphicsEngineD3D12/FenceD3D12H_test.cpp b/Tests/IncludeTest/src/GraphicsEngineD3D12/FenceD3D12H_test.cpp
new file mode 100644
index 0000000..8727a39
--- /dev/null
+++ b/Tests/IncludeTest/src/GraphicsEngineD3D12/FenceD3D12H_test.cpp
@@ -0,0 +1,25 @@
+/* Copyright 2015-2018 Egor Yusov
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS.
+ *
+ * In no event and under no legal theory, whether in tort (including negligence),
+ * contract, or otherwise, unless required by applicable law (such as deliberate
+ * and grossly negligent acts) or agreed to in writing, shall any Contributor be
+ * liable for any damages, including any direct, indirect, special, incidental,
+ * or consequential damages of any character arising as a result of this License or
+ * out of the use or inability to use the software (including but not limited to damages
+ * for loss of goodwill, work stoppage, computer failure or malfunction, or any and
+ * all other commercial damages or losses), even if such Contributor has been advised
+ * of the possibility of such damages.
+ */
+
+#include <d3d12.h>
+#include "DiligentCore/Graphics/GraphicsEngineD3D12/interface/FenceD3D12.h"
diff --git a/Tests/IncludeTest/src/GraphicsEngineOpenGL/FenceGLH_test .cpp b/Tests/IncludeTest/src/GraphicsEngineOpenGL/FenceGLH_test .cpp
new file mode 100644
index 0000000..f1e1e41
--- /dev/null
+++ b/Tests/IncludeTest/src/GraphicsEngineOpenGL/FenceGLH_test .cpp
@@ -0,0 +1,25 @@
+/* Copyright 2015-2018 Egor Yusov
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS.
+ *
+ * In no event and under no legal theory, whether in tort (including negligence),
+ * contract, or otherwise, unless required by applicable law (such as deliberate
+ * and grossly negligent acts) or agreed to in writing, shall any Contributor be
+ * liable for any damages, including any direct, indirect, special, incidental,
+ * or consequential damages of any character arising as a result of this License or
+ * out of the use or inability to use the software (including but not limited to damages
+ * for loss of goodwill, work stoppage, computer failure or malfunction, or any and
+ * all other commercial damages or losses), even if such Contributor has been advised
+ * of the possibility of such damages.
+ */
+
+typedef unsigned int GLuint;
+#include "DiligentCore/Graphics/GraphicsEngineOpenGL/interface/FenceGL.h"
diff --git a/Tests/TestApp/include/TestApp.h b/Tests/TestApp/include/TestApp.h
index 931007b..4c5ad53 100644
--- a/Tests/TestApp/include/TestApp.h
+++ b/Tests/TestApp/include/TestApp.h
@@ -87,6 +87,8 @@ protected:
Diligent::RefCntAutoPtr<Diligent::IBuffer> m_pInstBuff, m_pInstBuff2, m_pUniformBuff, m_pUniformBuff2, m_pUniformBuff3, m_pUniformBuff4;
Diligent::RefCntAutoPtr<Diligent::ITexture> m_pTestTex;
Diligent::RefCntAutoPtr<Diligent::ScriptParser> m_pRenderScript;
+ Diligent::RefCntAutoPtr<Diligent::IFence> m_pFence;
+ Diligent::Uint64 m_NextFenceValue = 1;
SmartPointerTest m_SmartPointerTest;
double m_CurrTime = 0;
diff --git a/Tests/TestApp/src/TestApp.cpp b/Tests/TestApp/src/TestApp.cpp
index 8c5062a..d9e81df 100644
--- a/Tests/TestApp/src/TestApp.cpp
+++ b/Tests/TestApp/src/TestApp.cpp
@@ -495,6 +495,12 @@ void TestApp::InitializeRenderers()
// This may cause D3D12 error
m_pImmediateContext->Flush();
}
+
+ {
+ FenceDesc fenceDesc;
+ fenceDesc.Name = "Test fence";
+ m_pDevice->CreateFence(fenceDesc, &m_pFence);
+ }
}
void TestApp::ProcessCommandLine(const char *CmdLine)
@@ -607,8 +613,15 @@ void TestApp::Render()
m_TestGS.Draw();
m_TestTessellation.Draw();
+ auto CompletedFenceValue = m_pFence->GetCompletedValue();
+ VERIFY_EXPR(CompletedFenceValue < m_NextFenceValue);
+ m_pImmediateContext->SignalFence(m_pFence, m_NextFenceValue++);
+
m_pImmediateContext->Flush();
m_pImmediateContext->InvalidateState();
+
+ CompletedFenceValue = m_pFence->GetCompletedValue();
+ VERIFY_EXPR(CompletedFenceValue < m_NextFenceValue);
}
void TestApp::Present()
diff --git a/unityplugin/GhostCubePlugin/PluginSource/src/RenderAPI_D3D12.cpp b/unityplugin/GhostCubePlugin/PluginSource/src/RenderAPI_D3D12.cpp
index 3850cf6..4f57a93 100644
--- a/unityplugin/GhostCubePlugin/PluginSource/src/RenderAPI_D3D12.cpp
+++ b/unityplugin/GhostCubePlugin/PluginSource/src/RenderAPI_D3D12.cpp
@@ -86,6 +86,11 @@ public:
m_ResourcesToTransition.push_back(ResourceState);
}
+ void SignalFence(ID3D12Fence* pFence, Uint64 Value)
+ {
+ UNSUPPORTED("Signalling fence via unity command graphics is not supported");
+ }
+
private:
IUnityGraphicsD3D12v2* const m_pUnityGraphicsD3D12;
HANDLE m_WaitForGPUEventHandle = {};
diff --git a/unityplugin/UnityEmulator/src/DiligentGraphicsAdapterD3D12.cpp b/unityplugin/UnityEmulator/src/DiligentGraphicsAdapterD3D12.cpp
index df5e6a9..5cae5fa 100644
--- a/unityplugin/UnityEmulator/src/DiligentGraphicsAdapterD3D12.cpp
+++ b/unityplugin/UnityEmulator/src/DiligentGraphicsAdapterD3D12.cpp
@@ -67,6 +67,11 @@ public:
m_GraphicsD3D12Impl.IdleGPU();
}
+ virtual void SignalFence(ID3D12Fence* pFence, Uint64 Value)
+ {
+ m_GraphicsD3D12Impl.GetCommandQueue()->Signal(pFence, Value);
+ }
+
private:
UnityGraphicsD3D12Impl& m_GraphicsD3D12Impl;
};