From 57d21b1b34187df0ff1a3d31b85285fa2e21c9e5 Mon Sep 17 00:00:00 2001 From: assiduous Date: Wed, 2 Dec 2020 20:08:06 -0800 Subject: Added IDeviceContext::GetFrameNumber() method (API ) --- Graphics/GraphicsEngineVulkan/include/DeviceContextVkImpl.hpp | 2 -- Graphics/GraphicsEngineVulkan/include/VulkanDynamicHeap.hpp | 2 +- Graphics/GraphicsEngineVulkan/src/BufferVkImpl.cpp | 4 ++-- Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp | 2 +- 4 files changed, 4 insertions(+), 6 deletions(-) (limited to 'Graphics/GraphicsEngineVulkan') diff --git a/Graphics/GraphicsEngineVulkan/include/DeviceContextVkImpl.hpp b/Graphics/GraphicsEngineVulkan/include/DeviceContextVkImpl.hpp index 7f027c12..093ab8d9 100644 --- a/Graphics/GraphicsEngineVulkan/include/DeviceContextVkImpl.hpp +++ b/Graphics/GraphicsEngineVulkan/include/DeviceContextVkImpl.hpp @@ -347,8 +347,6 @@ public: virtual void ResetRenderTargets() override final; - Int64 GetContextFrameNumber() const { return m_ContextFrameNumber; } - GenerateMipsVkHelper& GetGenerateMipsHelper() { return *m_GenerateMipsHelper; } QueryManagerVk* GetQueryManager() { return m_QueryMgr.get(); } diff --git a/Graphics/GraphicsEngineVulkan/include/VulkanDynamicHeap.hpp b/Graphics/GraphicsEngineVulkan/include/VulkanDynamicHeap.hpp index 6a03cd50..0aa286a4 100644 --- a/Graphics/GraphicsEngineVulkan/include/VulkanDynamicHeap.hpp +++ b/Graphics/GraphicsEngineVulkan/include/VulkanDynamicHeap.hpp @@ -97,7 +97,7 @@ struct VulkanDynamicAllocation size_t AlignedOffset = 0; // Offset from the start of the buffer size_t Size = 0; // Reserved size of this allocation #ifdef DILIGENT_DEVELOPMENT - Int64 dvpFrameNumber = 0; + Uint64 dvpFrameNumber = 0; #endif }; diff --git a/Graphics/GraphicsEngineVulkan/src/BufferVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/BufferVkImpl.cpp index 3e61a756..0d41ec33 100644 --- a/Graphics/GraphicsEngineVulkan/src/BufferVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/BufferVkImpl.cpp @@ -460,9 +460,9 @@ VkAccessFlags BufferVkImpl::GetAccessFlags() const #ifdef DILIGENT_DEVELOPMENT void BufferVkImpl::DvpVerifyDynamicAllocation(DeviceContextVkImpl* pCtx) const { - auto ContextId = pCtx->GetContextId(); + const auto ContextId = pCtx->GetContextId(); const auto& DynAlloc = m_DynamicAllocations[ContextId]; - auto CurrentFrame = pCtx->GetContextFrameNumber(); + const auto CurrentFrame = pCtx->GetFrameNumber(); DEV_CHECK_ERR(DynAlloc.pDynamicMemMgr != nullptr, "Dynamic buffer '", m_Desc.Name, "' has not been mapped before its first use. Context Id: ", ContextId, ". Note: memory for dynamic buffers is allocated when a buffer is mapped."); DEV_CHECK_ERR(DynAlloc.dvpFrameNumber == CurrentFrame, "Dynamic allocation of dynamic buffer '", m_Desc.Name, "' in frame ", CurrentFrame, " is out-of-date. Note: contents of all dynamic resources is discarded at the end of every frame. A buffer must be mapped before its first use in any frame."); } diff --git a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp index f2b70ff7..3520fa40 100644 --- a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp @@ -2444,7 +2444,7 @@ VulkanDynamicAllocation DeviceContextVkImpl::AllocateDynamicSpace(Uint32 SizeInB { auto DynAlloc = m_DynamicHeap.Allocate(SizeInBytes, Alignment); #ifdef DILIGENT_DEVELOPMENT - DynAlloc.dvpFrameNumber = m_ContextFrameNumber; + DynAlloc.dvpFrameNumber = GetFrameNumber(); #endif return DynAlloc; } -- cgit v1.2.3