summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineNextGenBase
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2019-02-05 21:40:56 +0000
committerEgor Yusov <egor.yusov@gmail.com>2019-02-05 21:40:56 +0000
commit4b99e2273f14f28b5d18f7ec96cefbba605b2dd3 (patch)
treed8927d09b7d75594eaa558189cc9dbb514da8048 /Graphics/GraphicsEngineNextGenBase
parentMinor updates to StandardFile (diff)
downloadDiligentCore-4b99e2273f14f28b5d18f7ec96cefbba605b2dd3.tar.gz
DiligentCore-4b99e2273f14f28b5d18f7ec96cefbba605b2dd3.zip
Fixed issue with counting invalid master blocks in DynamicHeap (fixed https://github.com/DiligentGraphics/DiligentEngine/issues/33)
Diffstat (limited to 'Graphics/GraphicsEngineNextGenBase')
-rw-r--r--Graphics/GraphicsEngineNextGenBase/include/DynamicHeap.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/Graphics/GraphicsEngineNextGenBase/include/DynamicHeap.h b/Graphics/GraphicsEngineNextGenBase/include/DynamicHeap.h
index 52d122a3..146f00df 100644
--- a/Graphics/GraphicsEngineNextGenBase/include/DynamicHeap.h
+++ b/Graphics/GraphicsEngineNextGenBase/include/DynamicHeap.h
@@ -131,7 +131,7 @@ public:
StaleMasterBlock (const StaleMasterBlock&) = delete;
StaleMasterBlock& operator= (const StaleMasterBlock&) = delete;
StaleMasterBlock& operator= ( StaleMasterBlock&&) = delete;
-
+
StaleMasterBlock(StaleMasterBlock&& rhs)noexcept :
Block (std::move(rhs.Block)),
Mgr (rhs.Mgr)
@@ -154,6 +154,7 @@ public:
};
for(auto& Block : Blocks)
{
+ DEV_CHECK_ERR(Block.IsValid(), "Attempting to release invalid master block");
Device.SafeReleaseDeviceObject(StaleMasterBlock{std::move(Block), this}, CmdQueueMask);
}
}
@@ -169,10 +170,14 @@ protected:
MasterBlock AllocateMasterBlock(OffsetType SizeInBytes, OffsetType Alignment)
{
std::lock_guard<std::mutex> Lock(m_AllocationsMgrMtx);
+ auto NewBlock = m_AllocationsMgr.Allocate(SizeInBytes, Alignment);
#ifdef DEVELOPMENT
- ++m_MasterBlockCounter;
+ if (NewBlock.IsValid())
+ {
+ ++m_MasterBlockCounter;
+ }
#endif
- return m_AllocationsMgr.Allocate(SizeInBytes, Alignment);
+ return NewBlock;
}
private: