Log: Add fmt overloads

This commit is contained in:
Stenzek
2023-09-21 00:11:55 +10:00
parent ac0601f408
commit 92440bdfcf
8 changed files with 145 additions and 126 deletions

View File

@ -258,7 +258,7 @@ Microsoft::WRL::ComPtr<IDXGIAdapter1> D3DCommon::GetAdapterByName(IDXGIFactory5*
adapter_names.push_back(std::move(adapter_name));
}
Log_ErrorPrintf(fmt::format("Adapter '{}' not found.", name).c_str());
Log_ErrorFmt("Adapter '{}' not found.", name);
return {};
}

View File

@ -142,7 +142,7 @@ bool MetalDevice::CreateDevice(const std::string_view& adapter, bool threaded_pr
}
if (device == nil)
Log_ErrorPrint(fmt::format("Failed to find device named '{}'. Trying default.", adapter).c_str());
Log_ErrorFmt("Failed to find device named '{}'. Trying default.", adapter);
}
if (device == nil)

View File

@ -401,7 +401,7 @@ std::unique_ptr<PostProcessing::Shader> PostProcessing::TryLoadingShader(const s
return shader;
}
Log_ErrorPrint(fmt::format("Failed to load shader '{}'", shader_name).c_str());
Log_ErrorFmt("Failed to load shader '{}'", shader_name);
return {};
}
@ -611,7 +611,7 @@ GPUSampler* PostProcessing::GetSampler(const GPUSampler::Config& config)
std::unique_ptr<GPUSampler> sampler = g_gpu_device->CreateSampler(config);
if (!sampler)
Log_ErrorPrint(fmt::format("Failed to create GPU sampler with config={:X}", config.key).c_str());
Log_ErrorFmt("Failed to create GPU sampler with config={:X}", config.key);
it = s_samplers.emplace(config.key, std::move(sampler)).first;
return it->second.get();

View File

@ -448,9 +448,8 @@ GetVectorAnnotationValue(const reshadefx::uniform_info& uniform, const std::stri
}
else
{
Log_ErrorPrint(fmt::format("Unhandled string value for '{}' (annotation type: {}, uniform type {})",
uniform.name, an.type.description(), uniform.type.description())
.c_str());
Log_ErrorFmt("Unhandled string value for '{}' (annotation type: {}, uniform type {})", uniform.name,
an.type.description(), uniform.type.description());
}
break;
@ -499,7 +498,7 @@ bool PostProcessing::ReShadeFXShader::CreateOptions(const reshadefx::module& mod
return false;
if (so != SourceOptionType::None)
{
Log_DevPrintf("Add source based option %u at offset %u (%s)", static_cast<u32>(so), ui.offset, ui.name.c_str());
Log_DevFmt("Add source based option {} at offset {} ({})", static_cast<u32>(so), ui.offset, ui.name);
SourceOption sopt;
sopt.source = so;
@ -758,15 +757,14 @@ bool PostProcessing::ReShadeFXShader::CreatePasses(GPUTexture::Format backbuffer
if (!ti.semantic.empty())
{
Log_DevPrint(fmt::format("Ignoring semantic {} texture {}", ti.semantic, ti.unique_name).c_str());
Log_DevFmt("Ignoring semantic {} texture {}", ti.semantic, ti.unique_name);
continue;
}
if (ti.render_target)
{
tex.rt_scale = 1.0f;
tex.format = MapTextureFormat(ti.format);
Log_DevPrint(
fmt::format("Creating render target '{}' {}", ti.unique_name, GPUTexture::GetFormatName(tex.format)).c_str());
Log_DevFmt("Creating render target '{}' {}", ti.unique_name, GPUTexture::GetFormatName(tex.format));
}
else
{
@ -796,7 +794,7 @@ bool PostProcessing::ReShadeFXShader::CreatePasses(GPUTexture::Format backbuffer
return false;
}
Log_DevPrint(fmt::format("Loaded {}x{} texture ({})", image.GetWidth(), image.GetHeight(), source).c_str());
Log_DevFmt("Loaded {}x{} texture ({})", image.GetWidth(), image.GetHeight(), source);
}
tex.reshade_name = ti.unique_name;
@ -863,9 +861,7 @@ bool PostProcessing::ReShadeFXShader::CreatePasses(GPUTexture::Format backbuffer
}
else if (ti.semantic == "DEPTH")
{
Log_WarningPrint(
fmt::format("Shader '{}' uses input depth as '{}' which is not supported.", m_name, si.texture_name)
.c_str());
Log_WarningFmt("Shader '{}' uses input depth as '{}' which is not supported.", m_name, si.texture_name);
sampler.texture_id = INPUT_DEPTH_TEXTURE;
break;
}
@ -896,7 +892,7 @@ bool PostProcessing::ReShadeFXShader::CreatePasses(GPUTexture::Format backbuffer
return false;
}
Log_DevPrint(fmt::format("Pass {} Texture {} => {}", pi.name, si.texture_name, sampler.texture_id).c_str());
Log_DevFmt("Pass {} Texture {} => {}", pi.name, si.texture_name, sampler.texture_id);
sampler.sampler = GetSampler(MapSampler(si));
if (!sampler.sampler)

View File

@ -1557,12 +1557,12 @@ bool VulkanDevice::IsSuitableDefaultRenderer()
// Check the first GPU, should be enough.
const std::string& name = aml.adapter_names.front();
Log_InfoPrintf(fmt::format("Using Vulkan GPU '{}' for automatic renderer check.", name).c_str());
Log_InfoFmt("Using Vulkan GPU '{}' for automatic renderer check.", name);
// Any software rendering (LLVMpipe, SwiftShader).
if (StringUtil::StartsWithNoCase(name, "llvmpipe") || StringUtil::StartsWithNoCase(name, "SwiftShader"))
{
Log_InfoPrintf("Not using Vulkan for software renderer.");
Log_InfoPrint("Not using Vulkan for software renderer.");
return false;
}
@ -1570,11 +1570,11 @@ bool VulkanDevice::IsSuitableDefaultRenderer()
// Plus, the Ivy Bridge and Haswell drivers are incomplete.
if (StringUtil::StartsWithNoCase(name, "Intel"))
{
Log_InfoPrintf("Not using Vulkan for Intel GPU.");
Log_InfoPrint("Not using Vulkan for Intel GPU.");
return false;
}
Log_InfoPrintf("Allowing Vulkan as default renderer.");
Log_InfoPrint("Allowing Vulkan as default renderer.");
return true;
#endif
}
@ -1640,7 +1640,7 @@ bool VulkanDevice::CreateDevice(const std::string_view& adapter, bool threaded_p
u32 gpu_index = 0;
for (; gpu_index < static_cast<u32>(gpus.size()); gpu_index++)
{
Log_InfoPrint(fmt::format("GPU {}: {}", gpu_index, gpus[gpu_index].second).c_str());
Log_InfoFmt("GPU {}: {}", gpu_index, gpus[gpu_index].second);
if (gpus[gpu_index].second == adapter)
{
m_physical_device = gpus[gpu_index].first;
@ -1650,13 +1650,13 @@ bool VulkanDevice::CreateDevice(const std::string_view& adapter, bool threaded_p
if (gpu_index == static_cast<u32>(gpus.size()))
{
Log_WarningPrint(fmt::format("Requested GPU '{}' not found, using first ({})", adapter, gpus[0].second).c_str());
Log_WarningFmt("Requested GPU '{}' not found, using first ({})", adapter, gpus[0].second);
m_physical_device = gpus[0].first;
}
}
else
{
Log_InfoPrint(fmt::format("No GPU requested, using first ({})", gpus[0].second).c_str());
Log_InfoFmt("No GPU requested, using first ({})", gpus[0].second);
m_physical_device = gpus[0].first;
}