diff options
| author | Lioncash <mathew1800@gmail.com> | 2019-11-22 17:10:41 -0500 |
|---|---|---|
| committer | Lioncash <mathew1800@gmail.com> | 2019-11-23 16:00:45 -0500 |
| commit | 6fbbc2683eeedf3767ea3d741c62555a30d3ff45 (patch) | |
| tree | 746529d2d5408b83ec75e53e51e20a34b0571897 /Source/Core/VideoCommon/TextureCacheBase.cpp | |
| parent | bc449fb98f3b741f78d8881e2c02d588829aad74 (diff) | |
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.
Diffstat (limited to 'Source/Core/VideoCommon/TextureCacheBase.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/TextureCacheBase.cpp | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp index a4b7c28676..f38745a318 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/TextureCacheBase.cpp @@ -2,6 +2,8 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include "VideoCommon/TextureCacheBase.h" + #include <algorithm> #include <cmath> #include <cstring> @@ -13,6 +15,8 @@ #include <pmmintrin.h> #endif +#include <fmt/format.h> + #include "Common/Align.h" #include "Common/Assert.h" #include "Common/ChunkFile.h" @@ -22,7 +26,6 @@ #include "Common/Logging/Log.h" #include "Common/MathUtil.h" #include "Common/MemoryUtil.h" -#include "Common/StringUtil.h" #include "Core/Config/GraphicsSettings.h" #include "Core/ConfigManager.h" @@ -40,7 +43,6 @@ #include "VideoCommon/SamplerCommon.h" #include "VideoCommon/ShaderCache.h" #include "VideoCommon/Statistics.h" -#include "VideoCommon/TextureCacheBase.h" #include "VideoCommon/TextureConversionShader.h" #include "VideoCommon/TextureConverterShaderGen.h" #include "VideoCommon/TextureDecoder.h" @@ -917,13 +919,14 @@ void TextureCacheBase::DumpTexture(TCacheEntry* entry, std::string basename, uns if (level > 0) { - basename += StringFromFormat("_mip%i", level); + basename += fmt::format("_mip{}", level); } - std::string filename = szDir + "/" + basename + ".png"; + const std::string filename = fmt::format("{}/{}.png", szDir, basename); + if (File::Exists(filename)) + return; - if (!File::Exists(filename)) - entry->texture->Save(filename, level); + entry->texture->Save(filename, level); } static u32 CalculateLevelSize(u32 level_0_size, u32 level) @@ -1751,10 +1754,8 @@ TextureCacheBase::GetXFBTexture(u32 address, u32 width, u32 height, u32 stride, { // While this isn't really an xfb copy, we can treat it as such for dumping purposes static int xfb_count = 0; - entry->texture->Save(StringFromFormat("%sxfb_loaded_%i.png", - File::GetUserPath(D_DUMPTEXTURES_IDX).c_str(), - xfb_count++), - 0); + entry->texture->Save( + fmt::format("{}xfb_loaded_{}.png", File::GetUserPath(D_DUMPTEXTURES_IDX), xfb_count++), 0); } GetDisplayRectForXFBEntry(entry, width, height, display_rect); @@ -2164,19 +2165,17 @@ void TextureCacheBase::CopyRenderTargetToTexture( if (g_ActiveConfig.bDumpEFBTarget && !is_xfb_copy) { static int efb_count = 0; - entry->texture->Save(StringFromFormat("%sefb_frame_%i.png", - File::GetUserPath(D_DUMPTEXTURES_IDX).c_str(), - efb_count++), - 0); + entry->texture->Save( + fmt::format("{}efb_frame_{}.png", File::GetUserPath(D_DUMPTEXTURES_IDX), efb_count++), + 0); } if (g_ActiveConfig.bDumpXFBTarget && is_xfb_copy) { static int xfb_count = 0; - entry->texture->Save(StringFromFormat("%sxfb_copy_%i.png", - File::GetUserPath(D_DUMPTEXTURES_IDX).c_str(), - xfb_count++), - 0); + entry->texture->Save( + fmt::format("{}xfb_copy_{}.png", File::GetUserPath(D_DUMPTEXTURES_IDX), xfb_count++), + 0); } } } |
