From 6fbbc2683eeedf3767ea3d741c62555a30d3ff45 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 22 Nov 2019 17:10:41 -0500 Subject: VideoCommon: Make use of fmt outside of shader generators Migrates most of VideoCommon over to using fmt, with the exception being the shader generator code. The shader generators are quite large and have more corner cases to deal with in terms of conversion (shaders have braces in them, so we need to make sure to escape them). Because of the large amount of code that would need to be converted, the conversion of VideoCommon will be in two parts: - This change (which converts over the general case string formatting), - A follow up change that will specifically deal with converting over the shader generators. --- Source/Core/VideoCommon/PostProcessing.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'Source/Core/VideoCommon/PostProcessing.cpp') diff --git a/Source/Core/VideoCommon/PostProcessing.cpp b/Source/Core/VideoCommon/PostProcessing.cpp index 23c0ded751..4d7b033f4e 100644 --- a/Source/Core/VideoCommon/PostProcessing.cpp +++ b/Source/Core/VideoCommon/PostProcessing.cpp @@ -8,6 +8,8 @@ #include #include +#include + #include "Common/Assert.h" #include "Common/CommonPaths.h" #include "Common/CommonTypes.h" @@ -286,8 +288,10 @@ void PostProcessingConfiguration::SaveOptionsConfiguration() { std::string value; for (size_t i = 0; i < it.second.m_integer_values.size(); ++i) - value += StringFromFormat("%d%s", it.second.m_integer_values[i], - i == (it.second.m_integer_values.size() - 1) ? "" : ", "); + { + value += fmt::format("{}{}", it.second.m_integer_values[i], + i == (it.second.m_integer_values.size() - 1) ? "" : ", "); + } ini.GetOrCreateSection(section)->Set(it.second.m_option_name, value); } break; @@ -453,7 +457,7 @@ std::string PostProcessing::GetUniformBufferHeader() const if (it.second.m_type == PostProcessingConfiguration::ConfigurationOption::OptionType::OPTION_BOOL) { - ss << StringFromFormat(" int %s;\n", it.first.c_str()); + ss << fmt::format(" int {};\n", it.first); for (u32 i = 0; i < 3; i++) ss << " int ubo_align_" << unused_counter++ << "_;\n"; } @@ -462,9 +466,9 @@ std::string PostProcessing::GetUniformBufferHeader() const { u32 count = static_cast(it.second.m_integer_values.size()); if (count == 1) - ss << StringFromFormat(" int %s;\n", it.first.c_str()); + ss << fmt::format(" int {};\n", it.first); else - ss << StringFromFormat(" int%u %s;\n", count, it.first.c_str()); + ss << fmt::format(" int{} {};\n", count, it.first); for (u32 i = count; i < 4; i++) ss << " int ubo_align_" << unused_counter++ << "_;\n"; @@ -474,9 +478,9 @@ std::string PostProcessing::GetUniformBufferHeader() const { u32 count = static_cast(it.second.m_float_values.size()); if (count == 1) - ss << StringFromFormat(" float %s;\n", it.first.c_str()); + ss << fmt::format(" float {};\n", it.first); else - ss << StringFromFormat(" float%u %s;\n", count, it.first.c_str()); + ss << fmt::format(" float{} {};\n", count, it.first); for (u32 i = count; i < 4; i++) ss << " float ubo_align_" << unused_counter++ << "_;\n"; -- cgit v1.2.3