mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
Vulkan: Migrate logging over to fmt
Migrates the vulkan backend over to the fmt-capable logger.
This commit is contained in:
@ -156,7 +156,7 @@ bool VulkanContext::SelectInstanceExtensions(std::vector<const char*>* extension
|
||||
|
||||
if (extension_count == 0)
|
||||
{
|
||||
ERROR_LOG(VIDEO, "Vulkan: No extensions supported by instance.");
|
||||
ERROR_LOG_FMT(VIDEO, "Vulkan: No extensions supported by instance.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -166,7 +166,7 @@ bool VulkanContext::SelectInstanceExtensions(std::vector<const char*>* extension
|
||||
ASSERT(res == VK_SUCCESS);
|
||||
|
||||
for (const auto& extension_properties : available_extension_list)
|
||||
INFO_LOG(VIDEO, "Available extension: %s", extension_properties.extensionName);
|
||||
INFO_LOG_FMT(VIDEO, "Available extension: {}", extension_properties.extensionName);
|
||||
|
||||
auto AddExtension = [&](const char* name, bool required) {
|
||||
if (std::find_if(available_extension_list.begin(), available_extension_list.end(),
|
||||
@ -174,13 +174,13 @@ bool VulkanContext::SelectInstanceExtensions(std::vector<const char*>* extension
|
||||
return !strcmp(name, properties.extensionName);
|
||||
}) != available_extension_list.end())
|
||||
{
|
||||
INFO_LOG(VIDEO, "Enabling extension: %s", name);
|
||||
INFO_LOG_FMT(VIDEO, "Enabling extension: {}", name);
|
||||
extension_list->push_back(name);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (required)
|
||||
ERROR_LOG(VIDEO, "Vulkan: Missing required extension %s.", name);
|
||||
ERROR_LOG_FMT(VIDEO, "Vulkan: Missing required extension {}.", name);
|
||||
|
||||
return false;
|
||||
};
|
||||
@ -220,7 +220,7 @@ bool VulkanContext::SelectInstanceExtensions(std::vector<const char*>* extension
|
||||
|
||||
// VK_EXT_debug_report
|
||||
if (enable_debug_report && !AddExtension(VK_EXT_DEBUG_REPORT_EXTENSION_NAME, false))
|
||||
WARN_LOG(VIDEO, "Vulkan: Debug report requested, but extension is not available.");
|
||||
WARN_LOG_FMT(VIDEO, "Vulkan: Debug report requested, but extension is not available.");
|
||||
|
||||
AddExtension(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME, false);
|
||||
AddExtension(VK_KHR_GET_SURFACE_CAPABILITIES_2_EXTENSION_NAME, false);
|
||||
@ -437,7 +437,7 @@ bool VulkanContext::SelectDeviceExtensions(bool enable_surface)
|
||||
|
||||
if (extension_count == 0)
|
||||
{
|
||||
ERROR_LOG(VIDEO, "Vulkan: No extensions supported by device.");
|
||||
ERROR_LOG_FMT(VIDEO, "Vulkan: No extensions supported by device.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -447,7 +447,7 @@ bool VulkanContext::SelectDeviceExtensions(bool enable_surface)
|
||||
ASSERT(res == VK_SUCCESS);
|
||||
|
||||
for (const auto& extension_properties : available_extension_list)
|
||||
INFO_LOG(VIDEO, "Available extension: %s", extension_properties.extensionName);
|
||||
INFO_LOG_FMT(VIDEO, "Available extension: {}", extension_properties.extensionName);
|
||||
|
||||
auto AddExtension = [&](const char* name, bool required) {
|
||||
if (std::find_if(available_extension_list.begin(), available_extension_list.end(),
|
||||
@ -455,13 +455,13 @@ bool VulkanContext::SelectDeviceExtensions(bool enable_surface)
|
||||
return !strcmp(name, properties.extensionName);
|
||||
}) != available_extension_list.end())
|
||||
{
|
||||
INFO_LOG(VIDEO, "Enabling extension: %s", name);
|
||||
INFO_LOG_FMT(VIDEO, "Enabling extension: {}", name);
|
||||
m_device_extensions.push_back(name);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (required)
|
||||
ERROR_LOG(VIDEO, "Vulkan: Missing required extension %s.", name);
|
||||
ERROR_LOG_FMT(VIDEO, "Vulkan: Missing required extension {}.", name);
|
||||
|
||||
return false;
|
||||
};
|
||||
@ -472,7 +472,7 @@ bool VulkanContext::SelectDeviceExtensions(bool enable_surface)
|
||||
#ifdef SUPPORTS_VULKAN_EXCLUSIVE_FULLSCREEN
|
||||
// VK_EXT_full_screen_exclusive
|
||||
if (AddExtension(VK_EXT_FULL_SCREEN_EXCLUSIVE_EXTENSION_NAME, true))
|
||||
INFO_LOG(VIDEO, "Using VK_EXT_full_screen_exclusive for exclusive fullscreen.");
|
||||
INFO_LOG_FMT(VIDEO, "Using VK_EXT_full_screen_exclusive for exclusive fullscreen.");
|
||||
#endif
|
||||
|
||||
return true;
|
||||
@ -488,12 +488,14 @@ bool VulkanContext::SelectDeviceFeatures()
|
||||
|
||||
// Not having geometry shaders or wide lines will cause issues with rendering.
|
||||
if (!available_features.geometryShader && !available_features.wideLines)
|
||||
WARN_LOG(VIDEO, "Vulkan: Missing both geometryShader and wideLines features.");
|
||||
WARN_LOG_FMT(VIDEO, "Vulkan: Missing both geometryShader and wideLines features.");
|
||||
if (!available_features.largePoints)
|
||||
WARN_LOG(VIDEO, "Vulkan: Missing large points feature. CPU EFB writes will be slower.");
|
||||
WARN_LOG_FMT(VIDEO, "Vulkan: Missing large points feature. CPU EFB writes will be slower.");
|
||||
if (!available_features.occlusionQueryPrecise)
|
||||
WARN_LOG(VIDEO, "Vulkan: Missing precise occlusion queries. Perf queries will be inaccurate.");
|
||||
|
||||
{
|
||||
WARN_LOG_FMT(VIDEO,
|
||||
"Vulkan: Missing precise occlusion queries. Perf queries will be inaccurate.");
|
||||
}
|
||||
// Enable the features we use.
|
||||
m_device_features.dualSrcBlend = available_features.dualSrcBlend;
|
||||
m_device_features.geometryShader = available_features.geometryShader;
|
||||
@ -519,14 +521,14 @@ bool VulkanContext::CreateDevice(VkSurfaceKHR surface, bool enable_validation_la
|
||||
vkGetPhysicalDeviceQueueFamilyProperties(m_physical_device, &queue_family_count, nullptr);
|
||||
if (queue_family_count == 0)
|
||||
{
|
||||
ERROR_LOG(VIDEO, "No queue families found on specified vulkan physical device.");
|
||||
ERROR_LOG_FMT(VIDEO, "No queue families found on specified vulkan physical device.");
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<VkQueueFamilyProperties> queue_family_properties(queue_family_count);
|
||||
vkGetPhysicalDeviceQueueFamilyProperties(m_physical_device, &queue_family_count,
|
||||
queue_family_properties.data());
|
||||
INFO_LOG(VIDEO, "%u vulkan queue families", queue_family_count);
|
||||
INFO_LOG_FMT(VIDEO, "{} vulkan queue families", queue_family_count);
|
||||
|
||||
// Find graphics and present queues.
|
||||
m_graphics_queue_family_index = queue_family_count;
|
||||
@ -569,12 +571,12 @@ bool VulkanContext::CreateDevice(VkSurfaceKHR surface, bool enable_validation_la
|
||||
}
|
||||
if (m_graphics_queue_family_index == queue_family_count)
|
||||
{
|
||||
ERROR_LOG(VIDEO, "Vulkan: Failed to find an acceptable graphics queue.");
|
||||
ERROR_LOG_FMT(VIDEO, "Vulkan: Failed to find an acceptable graphics queue.");
|
||||
return false;
|
||||
}
|
||||
if (surface && m_present_queue_family_index == queue_family_count)
|
||||
{
|
||||
ERROR_LOG(VIDEO, "Vulkan: Failed to find an acceptable present queue.");
|
||||
ERROR_LOG_FMT(VIDEO, "Vulkan: Failed to find an acceptable present queue.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -666,16 +668,16 @@ static VKAPI_ATTR VkBool32 VKAPI_CALL DebugReportCallback(VkDebugReportFlagsEXT
|
||||
const char* pLayerPrefix,
|
||||
const char* pMessage, void* pUserData)
|
||||
{
|
||||
std::string log_message =
|
||||
StringFromFormat("Vulkan debug report: (%s) %s", pLayerPrefix ? pLayerPrefix : "", pMessage);
|
||||
const std::string log_message =
|
||||
fmt::format("Vulkan debug report: ({}) {}", pLayerPrefix ? pLayerPrefix : "", pMessage);
|
||||
if (flags & VK_DEBUG_REPORT_ERROR_BIT_EXT)
|
||||
GENERIC_LOG(Common::Log::HOST_GPU, Common::Log::LERROR, "%s", log_message.c_str());
|
||||
GENERIC_LOG_FMT(Common::Log::HOST_GPU, Common::Log::LERROR, "{}", log_message);
|
||||
else if (flags & (VK_DEBUG_REPORT_WARNING_BIT_EXT | VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT))
|
||||
GENERIC_LOG(Common::Log::HOST_GPU, Common::Log::LWARNING, "%s", log_message.c_str());
|
||||
GENERIC_LOG_FMT(Common::Log::HOST_GPU, Common::Log::LWARNING, "{}", log_message);
|
||||
else if (flags & VK_DEBUG_REPORT_INFORMATION_BIT_EXT)
|
||||
GENERIC_LOG(Common::Log::HOST_GPU, Common::Log::LINFO, "%s", log_message.c_str());
|
||||
GENERIC_LOG_FMT(Common::Log::HOST_GPU, Common::Log::LINFO, "{}", log_message);
|
||||
else
|
||||
GENERIC_LOG(Common::Log::HOST_GPU, Common::Log::LDEBUG, "%s", log_message.c_str());
|
||||
GENERIC_LOG_FMT(Common::Log::HOST_GPU, Common::Log::LDEBUG, "{}", log_message);
|
||||
|
||||
return VK_FALSE;
|
||||
}
|
||||
@ -763,13 +765,13 @@ u32 VulkanContext::GetUploadMemoryType(u32 bits, bool* is_coherent)
|
||||
type_index = GetMemoryType(bits, COHERENT_FLAGS, false, is_coherent);
|
||||
if (type_index)
|
||||
{
|
||||
WARN_LOG(VIDEO,
|
||||
"Strict check for upload memory properties failed, this may affect performance");
|
||||
WARN_LOG_FMT(VIDEO,
|
||||
"Strict check for upload memory properties failed, this may affect performance");
|
||||
return type_index.value();
|
||||
}
|
||||
|
||||
// Fall back to non-coherent memory.
|
||||
WARN_LOG(
|
||||
WARN_LOG_FMT(
|
||||
VIDEO,
|
||||
"Vulkan: Failed to find a coherent memory type for uploads, this will affect performance.");
|
||||
type_index = GetMemoryType(bits, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT, false, is_coherent);
|
||||
@ -811,8 +813,8 @@ u32 VulkanContext::GetReadbackMemoryType(u32 bits, bool* is_coherent)
|
||||
if (type_index)
|
||||
return type_index.value();
|
||||
|
||||
WARN_LOG(VIDEO, "Vulkan: Failed to find a cached memory type for readbacks, this will affect "
|
||||
"performance.");
|
||||
WARN_LOG_FMT(VIDEO, "Vulkan: Failed to find a cached memory type for readbacks, this will affect "
|
||||
"performance.");
|
||||
type_index = GetMemoryType(bits, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT, false, is_coherent);
|
||||
*is_coherent = false;
|
||||
if (type_index)
|
||||
@ -896,8 +898,8 @@ void VulkanContext::InitDriverDetails()
|
||||
}
|
||||
else
|
||||
{
|
||||
WARN_LOG(VIDEO, "Unknown Vulkan driver vendor, please report it to us.");
|
||||
WARN_LOG(VIDEO, "Vendor ID: 0x%X, Device Name: %s", vendor_id, device_name.c_str());
|
||||
WARN_LOG_FMT(VIDEO, "Unknown Vulkan driver vendor, please report it to us.");
|
||||
WARN_LOG_FMT(VIDEO, "Vendor ID: {:#X}, Device Name: {}", vendor_id, device_name);
|
||||
vendor = DriverDetails::VENDOR_UNKNOWN;
|
||||
driver = DriverDetails::DRIVER_UNKNOWN;
|
||||
}
|
||||
|
Reference in New Issue
Block a user