VideoCommon: Migrate over to fmt

Migrates off the printf-based formatting where applicable.
This commit is contained in:
Lioncash
2020-11-13 22:33:26 -05:00
parent 8a621c2d5e
commit 3d9b2aa005
32 changed files with 310 additions and 281 deletions

View File

@ -76,7 +76,7 @@ void ShaderCache::Reload()
ClearCaches();
if (!CompileSharedPipelines())
PanicAlert("Failed to compile shared pipelines after reload.");
PanicAlertFmt("Failed to compile shared pipelines after reload.");
if (g_ActiveConfig.bShaderCache)
LoadCaches();
@ -249,7 +249,7 @@ void ShaderCache::LoadShaderCache(T& cache, APIType api_type, const char* type,
std::string filename = GetDiskShaderCacheFileName(api_type, type, include_gameid, true);
CacheReader reader(cache);
u32 count = cache.disk_cache.OpenAndRead(filename, reader);
INFO_LOG(VIDEO, "Loaded %u cached shaders from %s", count, filename.c_str());
INFO_LOG_FMT(VIDEO, "Loaded {} cached shaders from {}", count, filename);
}
template <typename T>
@ -303,8 +303,8 @@ void ShaderCache::LoadPipelineCache(T& cache, LinearDiskCache<DiskKeyType, u8>&
std::string filename = GetDiskShaderCacheFileName(api_type, type, include_gameid, true);
CacheReader reader(this, cache);
u32 count = disk_cache.OpenAndRead(filename, reader);
INFO_LOG(VIDEO, "Loaded %u cached pipelines from %s", count, filename.c_str());
const u32 count = disk_cache.OpenAndRead(filename, reader);
INFO_LOG_FMT(VIDEO, "Loaded {} cached pipelines from {}", count, filename);
// If any of the pipelines in the cache failed to create, it's likely because of a change of
// driver version, or system configuration. In this case, when the UID cache picks up the pipeline
@ -312,8 +312,8 @@ void ShaderCache::LoadPipelineCache(T& cache, LinearDiskCache<DiskKeyType, u8>&
// the old cache data around, so discard and recreate the disk cache.
if (reader.AnyFailed())
{
WARN_LOG(VIDEO, "Failed to load one or more pipelines from cache '%s'. Discarding.",
filename.c_str());
WARN_LOG_FMT(VIDEO, "Failed to load one or more pipelines from cache '{}'. Discarding.",
filename);
disk_cache.Close();
File::Delete(filename);
disk_cache.OpenAndRead(filename, reader);
@ -586,7 +586,8 @@ AbstractPipelineConfig ShaderCache::GetGXPipelineConfig(
if (config.blending_state.logicopenable && !g_ActiveConfig.backend_info.bSupportsLogicOp)
{
WARN_LOG(VIDEO, "Approximating logic op with blending, this will produce incorrect rendering.");
WARN_LOG_FMT(VIDEO,
"Approximating logic op with blending, this will produce incorrect rendering.");
config.blending_state.ApproximateLogicOpWithBlending();
}
@ -791,8 +792,7 @@ void ShaderCache::LoadPipelineUIDCache()
}
}
INFO_LOG(VIDEO, "Read %u pipeline UIDs from %s",
static_cast<unsigned>(m_gx_pipeline_cache.size()), filename.c_str());
INFO_LOG_FMT(VIDEO, "Read {} pipeline UIDs from {}", m_gx_pipeline_cache.size(), filename);
}
void ShaderCache::ClosePipelineUIDCache()
@ -824,7 +824,7 @@ void ShaderCache::AppendGXPipelineUID(const GXPipelineUid& config)
SerializePipelineUid(config, disk_uid);
if (!m_gx_pipeline_uid_cache_file.WriteBytes(&disk_uid, sizeof(disk_uid)))
{
WARN_LOG(VIDEO, "Writing pipeline UID to cache failed, closing file.");
WARN_LOG_FMT(VIDEO, "Writing pipeline UID to cache failed, closing file.");
m_gx_pipeline_uid_cache_file.Close();
}
}