summaryrefslogtreecommitdiffstats
path: root/Graphics
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2018-10-08 03:05:43 +0000
committerEgor Yusov <egor.yusov@gmail.com>2018-10-08 03:05:43 +0000
commit5afeee8a82d07a18c36f73750114885940802479 (patch)
tree2e1212e51b1cc0bee6b15d6d6544fba658b25990 /Graphics
parentFew changes to D3D12 and Vulkan backends to make implementations more consistent (diff)
downloadDiligentCore-5afeee8a82d07a18c36f73750114885940802479.tar.gz
DiligentCore-5afeee8a82d07a18c36f73750114885940802479.zip
Couple of minor updates to D3D12 and Vulkan device context implementations
Diffstat (limited to 'Graphics')
-rw-r--r--Graphics/GraphicsEngine/interface/DeviceContext.h5
-rw-r--r--Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp13
-rw-r--r--Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp13
3 files changed, 18 insertions, 13 deletions
diff --git a/Graphics/GraphicsEngine/interface/DeviceContext.h b/Graphics/GraphicsEngine/interface/DeviceContext.h
index 5469931d..785efa63 100644
--- a/Graphics/GraphicsEngine/interface/DeviceContext.h
+++ b/Graphics/GraphicsEngine/interface/DeviceContext.h
@@ -514,9 +514,10 @@ public:
/// per frame, though it can be called with different frequency. Note that unless the GPU is idled,
/// the resources may actually be released several frames after the one they were used in last time.
/// \note After the call all dynamic resources become invalid and must be written again before the next use.
- /// Also, all committed resources become invalid.
+ /// Also, all committed resources become invalid.\n
/// For deferred contexts, this method must be called after all command lists referencing dynamic resources
- /// have been executed through immediate context.
+ /// have been executed through immediate context.\n
+ /// The method does not Flush() the context.
virtual void FinishFrame() = 0;
};
diff --git a/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp
index 6cee61df..64361e5d 100644
--- a/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp
@@ -120,7 +120,7 @@ namespace Diligent
if (m_State.NumCommands != 0)
{
LOG_ERROR_MESSAGE(m_bIsDeferred ?
- "There are outstanding commands in the deferred context being destroyed, which indicates that FinishCommandList() has not been called." :
+ "There are outstanding commands in deferred context #", m_ContextId, " being destroyed, which indicates that FinishCommandList() has not been called." :
"There are outstanding commands in the immediate context being destroyed, which indicates the context has not been Flush()'ed.",
" This is unexpected and may result in synchronization errors");
}
@@ -577,7 +577,12 @@ namespace Diligent
void DeviceContextD3D12Impl::Flush()
{
- VERIFY(!m_bIsDeferred, "Flush() should only be called for immediate contexts");
+ if (m_bIsDeferred)
+ {
+ LOG_ERROR_MESSAGE("Flush() should only be called for immediate contexts");
+ return;
+ }
+
Flush(true);
}
@@ -586,7 +591,7 @@ namespace Diligent
if (GetNumCommandsInCtx() != 0)
{
LOG_ERROR_MESSAGE(m_bIsDeferred ?
- "There are outstanding commands in the deferred device context when finishing the frame. This is an error and may cause unpredicted behaviour. Close all deferred contexts and execute them before finishing the frame" :
+ "There are outstanding commands in deferred device context #", m_ContextId, " when finishing the frame. This is an error and may cause unpredicted behaviour. Close all deferred contexts and execute them before finishing the frame" :
"There are outstanding commands in the immediate device context when finishing the frame. This is an error and may cause unpredicted behaviour. Call Flush() to submit all commands for execution before finishing the frame");
}
@@ -1072,7 +1077,7 @@ namespace Diligent
{
if (m_bIsDeferred)
{
- LOG_ERROR("Only immediate context can execute command list");
+ LOG_ERROR_MESSAGE("Only immediate context can execute command list");
return;
}
// First execute commands in this context
diff --git a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp
index a29ca27d..c8f5e220 100644
--- a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp
@@ -102,11 +102,10 @@ namespace Diligent
DeviceContextVkImpl::~DeviceContextVkImpl()
{
- auto* pDeviceVkImpl = m_pDevice.RawPtr<RenderDeviceVkImpl>();
if (m_State.NumCommands != 0)
{
LOG_ERROR_MESSAGE(m_bIsDeferred ?
- "There are outstanding commands in the deferred context being destroyed, which indicates that FinishCommandList() has not been called." :
+ "There are outstanding commands in deferred context #", m_ContextId, " being destroyed, which indicates that FinishCommandList() has not been called." :
"There are outstanding commands in the immediate context being destroyed, which indicates the context has not been Flush()'ed.",
" This is unexpected and may result in synchronization errors");
}
@@ -125,6 +124,8 @@ namespace Diligent
DEV_CHECK_ERR(m_DynamicHeap.GetAllocatedMasterBlockCount() == 0, "All allocated dynamic heap master blocks must have been released");
DEV_CHECK_ERR(m_DynamicDescrSetAllocator.GetAllocatedPoolCount() == 0, "All allocated dynamic descriptor set pools must have been released at this point");
+ auto* pDeviceVkImpl = m_pDevice.RawPtr<RenderDeviceVkImpl>();
+
auto VkCmdPool = m_CmdPool.Release();
pDeviceVkImpl->SafeReleaseDeviceObject(std::move(VkCmdPool), ~Uint64{0});
@@ -754,7 +755,7 @@ namespace Diligent
if(GetNumCommandsInCtx() != 0)
{
LOG_ERROR_MESSAGE(m_bIsDeferred ?
- "There are outstanding commands in the deferred device context when finishing the frame. This is an error and may cause unpredicted behaviour. Close all deferred contexts and execute them before finishing the frame" :
+ "There are outstanding commands in deferred device context #", m_ContextId, " when finishing the frame. This is an error and may cause unpredicted behaviour. Close all deferred contexts and execute them before finishing the frame" :
"There are outstanding commands in the immediate device context when finishing the frame. This is an error and may cause unpredicted behaviour. Call Flush() to submit all commands for execution before finishing the frame");
}
@@ -787,13 +788,11 @@ namespace Diligent
void DeviceContextVkImpl::Flush()
{
-#ifdef DEVELOPMENT
if (m_bIsDeferred)
{
- LOG_ERROR("Flush() should only be called for immediate contexts");
+ LOG_ERROR_MESSAGE("Flush() should only be called for immediate contexts");
return;
}
-#endif
VkSubmitInfo SubmitInfo = {};
SubmitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
@@ -1405,7 +1404,7 @@ namespace Diligent
{
if (m_bIsDeferred)
{
- LOG_ERROR("Only immediate context can execute command list");
+ LOG_ERROR_MESSAGE("Only immediate context can execute command list");
return;
}