diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2018-12-02 18:22:22 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2018-12-02 18:22:22 +0000 |
| commit | 111636445d2e19420468cdf78ffd2b87b7ad6489 (patch) | |
| tree | adb5457b4f0cd56a323c99f1cedc5a2fce0667ee /Graphics/GraphicsEngineVulkan | |
| parent | Added explicit state transition control to UpdateBuffer and UpdateTexture com... (diff) | |
| download | DiligentCore-111636445d2e19420468cdf78ffd2b87b7ad6489.tar.gz DiligentCore-111636445d2e19420468cdf78ffd2b87b7ad6489.zip | |
Brought back MapType paramter to UnmapBuffer() function. The performance hit of keeping track of mapped buffers turned out to be unacceptable
Diffstat (limited to 'Graphics/GraphicsEngineVulkan')
| -rw-r--r-- | Graphics/GraphicsEngineVulkan/include/DeviceContextVkImpl.h | 8 | ||||
| -rw-r--r-- | Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp | 27 |
2 files changed, 5 insertions, 30 deletions
diff --git a/Graphics/GraphicsEngineVulkan/include/DeviceContextVkImpl.h b/Graphics/GraphicsEngineVulkan/include/DeviceContextVkImpl.h index 978c374b..4f207929 100644 --- a/Graphics/GraphicsEngineVulkan/include/DeviceContextVkImpl.h +++ b/Graphics/GraphicsEngineVulkan/include/DeviceContextVkImpl.h @@ -112,7 +112,7 @@ public: virtual void MapBuffer(IBuffer* pBuffer, MAP_TYPE MapType, MAP_FLAGS MapFlags, PVoid& pMappedData)override final; - virtual void UnmapBuffer(IBuffer* pBuffer)override final; + virtual void UnmapBuffer(IBuffer* pBuffer, MAP_TYPE MapType)override final; virtual void UpdateTexture(ITexture* pTexture, Uint32 MipLevel, @@ -346,12 +346,6 @@ private: }; std::unordered_map<MappedTextureKey, MappedTexture, MappedTextureKey::Hasher> m_MappedTextures; - struct MappedBufferInfo - { - MAP_TYPE MapType; - }; - std::unordered_map<BufferVkImpl*, MappedBufferInfo> m_MappedBuffers; - VulkanUtilities::VulkanCommandBufferPool m_CmdPool; VulkanUploadHeap m_UploadHeap; VulkanDynamicHeap m_DynamicHeap; diff --git a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp index 226faf1a..b0fe445b 100644 --- a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp @@ -861,8 +861,8 @@ namespace Diligent void DeviceContextVkImpl::FinishFrame() { -#ifdef DEVELOPMENT - for(const auto& MappedBuffIt : m_MappedBuffers) +#ifdef _DEBUG + for(const auto& MappedBuffIt : m_DbgMappedBuffers) { const auto& BuffDesc = MappedBuffIt.first->GetDesc(); if (BuffDesc.Usage == USAGE_DYNAMIC) @@ -1340,13 +1340,6 @@ namespace Diligent auto* pBufferVk = ValidatedCast<BufferVkImpl>(pBuffer); const auto& BuffDesc = pBufferVk->GetDesc(); -#ifdef DEVELOPMENT - if (m_MappedBuffers.find(pBufferVk) != m_MappedBuffers.end()) - { - LOG_ERROR_MESSAGE("Buffer '", BuffDesc.Name, "' has already been mapped"); - } -#endif - if (MapType == MAP_READ ) { LOG_ERROR("Mapping buffer for reading is not yet imlemented in Vulkan backend"); @@ -1398,23 +1391,13 @@ namespace Diligent { LOG_ERROR("Only MAP_WRITE_DISCARD and MAP_READ are currently implemented in Vk"); } - m_MappedBuffers[pBufferVk] = MappedBufferInfo{MapType}; } - void DeviceContextVkImpl::UnmapBuffer(IBuffer* pBuffer) + void DeviceContextVkImpl::UnmapBuffer(IBuffer* pBuffer, MAP_TYPE MapType) { - TDeviceContextBase::UnmapBuffer(pBuffer); + TDeviceContextBase::UnmapBuffer(pBuffer, MapType); auto* pBufferVk = ValidatedCast<BufferVkImpl>(pBuffer); - - auto MappedBufferIt = m_MappedBuffers.find(pBufferVk); - if (MappedBufferIt == m_MappedBuffers.end()) - { - LOG_ERROR_MESSAGE("Buffer '", pBufferVk->GetDesc().Name, "' has not been mapped."); - return; - } - const auto& MapInfo = MappedBufferIt->second; const auto& BuffDesc = pBufferVk->GetDesc(); - auto MapType = MapInfo.MapType; if (MapType == MAP_READ ) { @@ -1438,8 +1421,6 @@ namespace Diligent } } } - - m_MappedBuffers.erase(MappedBufferIt); } void DeviceContextVkImpl::UpdateTexture(ITexture* pTexture, |
