From 2f5b2dd6bb2db2464d9b9c9d95fc0a57559fa331 Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Sat, 22 Sep 2018 20:51:25 -0700 Subject: Reworked message formatting --- Graphics/GraphicsEngineD3DBase/include/D3DErrors.h | 7 +++---- .../src/VulkanUtilities/VulkanMemoryManager.cpp | 5 ++--- Graphics/HLSL2GLSLConverterLib/src/HLSL2GLSLConverterImpl.cpp | 9 ++++----- 3 files changed, 9 insertions(+), 12 deletions(-) (limited to 'Graphics') diff --git a/Graphics/GraphicsEngineD3DBase/include/D3DErrors.h b/Graphics/GraphicsEngineD3DBase/include/D3DErrors.h index b1d1e068..d3d3792f 100644 --- a/Graphics/GraphicsEngineD3DBase/include/D3DErrors.h +++ b/Graphics/GraphicsEngineD3DBase/include/D3DErrors.h @@ -81,10 +81,9 @@ do{ \ HRESULT _hr_ = Expr; \ if(FAILED(_hr_)) \ { \ - Diligent::MsgStream ms; \ - Diligent::FormatMsg(ms, __VA_ARGS__); \ - ComErrorDesc ErrDesc( _hr_ ); \ - LOG_ERROR_AND_THROW( ms.str(), "\nHRESULT Desc: ", ErrDesc.Get());\ + auto msg = Diligent::FormatString(__VA_ARGS__); \ + ComErrorDesc ErrDesc( _hr_ ); \ + LOG_ERROR_AND_THROW( msg, "\nHRESULT Desc: ", ErrDesc.Get());\ } \ }while(false) diff --git a/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanMemoryManager.cpp b/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanMemoryManager.cpp index 973b1add..65e138b6 100644 --- a/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanMemoryManager.cpp +++ b/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanMemoryManager.cpp @@ -49,9 +49,8 @@ VulkanMemoryPage::VulkanMemoryPage(VulkanMemoryManager& ParentMemoryMgr, MemAlloc.allocationSize = PageSize; MemAlloc.memoryTypeIndex = MemoryTypeIndex; - std::stringstream ss; - Diligent::FormatMsg(ss, "Device memory page. Size: ", Diligent::FormatMemorySize(PageSize, 2), ", type: ", MemoryTypeIndex); - m_VkMemory = ParentMemoryMgr.m_LogicalDevice.AllocateDeviceMemory(MemAlloc, ss.str().c_str()); + auto MemoryName = Diligent::FormatString("Device memory page. Size: ", Diligent::FormatMemorySize(PageSize, 2), ", type: ", MemoryTypeIndex); + m_VkMemory = ParentMemoryMgr.m_LogicalDevice.AllocateDeviceMemory(MemAlloc, MemoryName.c_str()); if (IsHostVisible) { diff --git a/Graphics/HLSL2GLSLConverterLib/src/HLSL2GLSLConverterImpl.cpp b/Graphics/HLSL2GLSLConverterLib/src/HLSL2GLSLConverterImpl.cpp index 6eaa5497..bd032a06 100644 --- a/Graphics/HLSL2GLSLConverterLib/src/HLSL2GLSLConverterImpl.cpp +++ b/Graphics/HLSL2GLSLConverterLib/src/HLSL2GLSLConverterImpl.cpp @@ -916,11 +916,10 @@ String HLSL2GLSLConverterImpl::ConversionStream::PrintTokenContext( IteratorType #define VERIFY_PARSER_STATE( Token, Condition, ... )\ - if( !(Condition) ) \ - { \ - MsgStream ss; \ - FormatMsg( ss, __VA_ARGS__ ); \ - LOG_ERROR_AND_THROW( ss.str(), "\n", PrintTokenContext(Token, 4) );\ + if( !(Condition) ) \ + { \ + auto err = FormatString(__VA_ARGS__ ); \ + LOG_ERROR_AND_THROW( err, "\n", PrintTokenContext(Token, 4) );\ } template -- cgit v1.2.3