diff --git a/Source/Core/VideoBackends/Vulkan/BoundingBox.cpp b/Source/Core/VideoBackends/Vulkan/BoundingBox.cpp index a1deeafd59..d16cabfd30 100644 --- a/Source/Core/VideoBackends/Vulkan/BoundingBox.cpp +++ b/Source/Core/VideoBackends/Vulkan/BoundingBox.cpp @@ -34,7 +34,7 @@ bool BoundingBox::Initialize() { if (!g_ActiveConfig.backend_info.bSupportsBBox) { - WARN_LOG(VIDEO, "Vulkan: Bounding box is unsupported by your device."); + WARN_LOG_FMT(VIDEO, "Vulkan: Bounding box is unsupported by your device."); return true; } diff --git a/Source/Core/VideoBackends/Vulkan/ObjectCache.cpp b/Source/Core/VideoBackends/Vulkan/ObjectCache.cpp index 93b2144338..62c31eba06 100644 --- a/Source/Core/VideoBackends/Vulkan/ObjectCache.cpp +++ b/Source/Core/VideoBackends/Vulkan/ObjectCache.cpp @@ -543,7 +543,7 @@ bool ObjectCache::ValidatePipelineCache(const u8* data, size_t data_length) { if (data_length < sizeof(VK_PIPELINE_CACHE_HEADER)) { - ERROR_LOG(VIDEO, "Pipeline cache failed validation: Invalid header"); + ERROR_LOG_FMT(VIDEO, "Pipeline cache failed validation: Invalid header"); return false; } @@ -551,36 +551,36 @@ bool ObjectCache::ValidatePipelineCache(const u8* data, size_t data_length) std::memcpy(&header, data, sizeof(header)); if (header.header_length < sizeof(VK_PIPELINE_CACHE_HEADER)) { - ERROR_LOG(VIDEO, "Pipeline cache failed validation: Invalid header length"); + ERROR_LOG_FMT(VIDEO, "Pipeline cache failed validation: Invalid header length"); return false; } if (header.header_version != VK_PIPELINE_CACHE_HEADER_VERSION_ONE) { - ERROR_LOG(VIDEO, "Pipeline cache failed validation: Invalid header version"); + ERROR_LOG_FMT(VIDEO, "Pipeline cache failed validation: Invalid header version"); return false; } if (header.vendor_id != g_vulkan_context->GetDeviceProperties().vendorID) { - ERROR_LOG(VIDEO, - "Pipeline cache failed validation: Incorrect vendor ID (file: 0x%X, device: 0x%X)", - header.vendor_id, g_vulkan_context->GetDeviceProperties().vendorID); + ERROR_LOG_FMT( + VIDEO, "Pipeline cache failed validation: Incorrect vendor ID (file: {:#X}, device: {:#X})", + header.vendor_id, g_vulkan_context->GetDeviceProperties().vendorID); return false; } if (header.device_id != g_vulkan_context->GetDeviceProperties().deviceID) { - ERROR_LOG(VIDEO, - "Pipeline cache failed validation: Incorrect device ID (file: 0x%X, device: 0x%X)", - header.device_id, g_vulkan_context->GetDeviceProperties().deviceID); + ERROR_LOG_FMT( + VIDEO, "Pipeline cache failed validation: Incorrect device ID (file: {:#X}, device: {:#X})", + header.device_id, g_vulkan_context->GetDeviceProperties().deviceID); return false; } if (std::memcmp(header.uuid, g_vulkan_context->GetDeviceProperties().pipelineCacheUUID, VK_UUID_SIZE) != 0) { - ERROR_LOG(VIDEO, "Pipeline cache failed validation: Incorrect UUID"); + ERROR_LOG_FMT(VIDEO, "Pipeline cache failed validation: Incorrect UUID"); return false; } diff --git a/Source/Core/VideoBackends/Vulkan/Renderer.cpp b/Source/Core/VideoBackends/Vulkan/Renderer.cpp index e6f1b44b39..1eaf25ee9d 100644 --- a/Source/Core/VideoBackends/Vulkan/Renderer.cpp +++ b/Source/Core/VideoBackends/Vulkan/Renderer.cpp @@ -300,17 +300,17 @@ void Renderer::BindBackbuffer(const ClearColor& clear_color) if (res == VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT) { // The present keeps returning exclusive mode lost unless we re-create the swap chain. - INFO_LOG(VIDEO, "Lost exclusive fullscreen."); + INFO_LOG_FMT(VIDEO, "Lost exclusive fullscreen."); m_swap_chain->RecreateSwapChain(); } else if (res == VK_SUBOPTIMAL_KHR || res == VK_ERROR_OUT_OF_DATE_KHR) { - INFO_LOG(VIDEO, "Resizing swap chain due to suboptimal/out-of-date"); + INFO_LOG_FMT(VIDEO, "Resizing swap chain due to suboptimal/out-of-date"); m_swap_chain->ResizeSwapChain(); } else { - ERROR_LOG(VIDEO, "Unknown present error 0x%08X, please report.", res); + ERROR_LOG_FMT(VIDEO, "Unknown present error {:#010X}, please report.", res); m_swap_chain->RecreateSwapChain(); } @@ -401,7 +401,7 @@ void Renderer::CheckForSurfaceResize() // CheckForSurfaceChange should handle this case. if (!m_swap_chain) { - WARN_LOG(VIDEO, "Surface resize event received without active surface, ignoring"); + WARN_LOG_FMT(VIDEO, "Surface resize event received without active surface, ignoring"); return; } @@ -527,7 +527,7 @@ void Renderer::SetTexture(u32 index, const AbstractTexture* texture) { if (StateTracker::GetInstance()->InRenderPass()) { - WARN_LOG(VIDEO, "Transitioning image in render pass in Renderer::SetTexture()"); + WARN_LOG_FMT(VIDEO, "Transitioning image in render pass in Renderer::SetTexture()"); StateTracker::GetInstance()->EndRenderPass(); } @@ -553,7 +553,7 @@ void Renderer::SetSamplerState(u32 index, const SamplerState& state) VkSampler sampler = g_object_cache->GetSampler(state); if (sampler == VK_NULL_HANDLE) { - ERROR_LOG(VIDEO, "Failed to create sampler"); + ERROR_LOG_FMT(VIDEO, "Failed to create sampler"); sampler = g_object_cache->GetPointSampler(); } diff --git a/Source/Core/VideoBackends/Vulkan/ShaderCompiler.cpp b/Source/Core/VideoBackends/Vulkan/ShaderCompiler.cpp index 8d6a4653e2..d4a2cc5eb7 100644 --- a/Source/Core/VideoBackends/Vulkan/ShaderCompiler.cpp +++ b/Source/Core/VideoBackends/Vulkan/ShaderCompiler.cpp @@ -203,16 +203,16 @@ static std::optional CompileShaderToSPV(EShLanguage stage, // Temporary: skip if it contains "Warning, version 450 is not yet complete; most version-specific // features are present, but some are missing." if (strlen(shader->getInfoLog()) > 108) - WARN_LOG(VIDEO, "Shader info log: %s", shader->getInfoLog()); + WARN_LOG_FMT(VIDEO, "Shader info log: {}", shader->getInfoLog()); if (strlen(shader->getInfoDebugLog()) > 0) - WARN_LOG(VIDEO, "Shader debug info log: %s", shader->getInfoDebugLog()); + WARN_LOG_FMT(VIDEO, "Shader debug info log: {}", shader->getInfoDebugLog()); if (strlen(program->getInfoLog()) > 25) - WARN_LOG(VIDEO, "Program info log: %s", program->getInfoLog()); + WARN_LOG_FMT(VIDEO, "Program info log: {}", program->getInfoLog()); if (strlen(program->getInfoDebugLog()) > 0) - WARN_LOG(VIDEO, "Program debug info log: %s", program->getInfoDebugLog()); - std::string spv_messages = logger.getAllMessages(); + WARN_LOG_FMT(VIDEO, "Program debug info log: {}", program->getInfoDebugLog()); + const std::string spv_messages = logger.getAllMessages(); if (!spv_messages.empty()) - WARN_LOG(VIDEO, "SPIR-V conversion messages: %s", spv_messages.c_str()); + WARN_LOG_FMT(VIDEO, "SPIR-V conversion messages: {}", spv_messages); // Dump source code of shaders out to file if enabled. if (g_ActiveConfig.iLog & CONF_SAVESHADERS) diff --git a/Source/Core/VideoBackends/Vulkan/StateTracker.cpp b/Source/Core/VideoBackends/Vulkan/StateTracker.cpp index e25147cbe1..50ea9d61d6 100644 --- a/Source/Core/VideoBackends/Vulkan/StateTracker.cpp +++ b/Source/Core/VideoBackends/Vulkan/StateTracker.cpp @@ -351,12 +351,12 @@ bool StateTracker::Bind() if (!UpdateDescriptorSet()) { // We can fail to allocate descriptors if we exhaust the pool for this command buffer. - WARN_LOG(VIDEO, "Failed to get a descriptor set, executing buffer"); + WARN_LOG_FMT(VIDEO, "Failed to get a descriptor set, executing buffer"); Renderer::GetInstance()->ExecuteCommandBuffer(false, false); if (!UpdateDescriptorSet()) { // Something strange going on. - ERROR_LOG(VIDEO, "Failed to get descriptor set, skipping draw"); + ERROR_LOG_FMT(VIDEO, "Failed to get descriptor set, skipping draw"); return false; } } @@ -405,12 +405,12 @@ bool StateTracker::BindCompute() if (!UpdateComputeDescriptorSet()) { - WARN_LOG(VIDEO, "Failed to get a compute descriptor set, executing buffer"); + WARN_LOG_FMT(VIDEO, "Failed to get a compute descriptor set, executing buffer"); Renderer::GetInstance()->ExecuteCommandBuffer(false, false); if (!UpdateComputeDescriptorSet()) { // Something strange going on. - ERROR_LOG(VIDEO, "Failed to get descriptor set, skipping dispatch"); + ERROR_LOG_FMT(VIDEO, "Failed to get descriptor set, skipping dispatch"); return false; } } diff --git a/Source/Core/VideoBackends/Vulkan/SwapChain.cpp b/Source/Core/VideoBackends/Vulkan/SwapChain.cpp index 7c2d8c09fa..dbb1fc1cb5 100644 --- a/Source/Core/VideoBackends/Vulkan/SwapChain.cpp +++ b/Source/Core/VideoBackends/Vulkan/SwapChain.cpp @@ -283,7 +283,7 @@ bool SwapChain::CreateSwapChain() VkImageUsageFlags image_usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT; if (!(surface_capabilities.supportedUsageFlags & VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT)) { - ERROR_LOG(VIDEO, "Vulkan: Swap chain does not support usage as color attachment"); + ERROR_LOG_FMT(VIDEO, "Vulkan: Swap chain does not support usage as color attachment"); return false; } @@ -341,7 +341,7 @@ bool SwapChain::CreateSwapChain() if (res != VK_SUCCESS) { // Try without exclusive fullscreen. - WARN_LOG(VIDEO, "Failed to create exclusive fullscreen swapchain, trying without."); + WARN_LOG_FMT(VIDEO, "Failed to create exclusive fullscreen swapchain, trying without."); swap_chain_info.pNext = nullptr; g_Config.backend_info.bSupportsExclusiveFullscreen = false; g_ActiveConfig.backend_info.bSupportsExclusiveFullscreen = false; @@ -514,7 +514,7 @@ bool SwapChain::SetFullscreenState(bool state) return false; } - INFO_LOG(VIDEO, "Exclusive fullscreen acquired."); + INFO_LOG_FMT(VIDEO, "Exclusive fullscreen acquired."); } else { @@ -522,7 +522,7 @@ bool SwapChain::SetFullscreenState(bool state) if (res != VK_SUCCESS) LOG_VULKAN_ERROR(res, "vkReleaseFullScreenExclusiveModeEXT failed:"); - INFO_LOG(VIDEO, "Exclusive fullscreen released."); + INFO_LOG_FMT(VIDEO, "Exclusive fullscreen released."); } m_current_fullscreen_state = state; diff --git a/Source/Core/VideoBackends/Vulkan/VKTexture.cpp b/Source/Core/VideoBackends/Vulkan/VKTexture.cpp index 80c0c4aa86..7e77664966 100644 --- a/Source/Core/VideoBackends/Vulkan/VKTexture.cpp +++ b/Source/Core/VideoBackends/Vulkan/VKTexture.cpp @@ -369,7 +369,8 @@ void VKTexture::Load(u32 level, u32 width, u32 height, u32 row_length, const u8* if (!stream_buffer->ReserveMemory(upload_size, upload_alignment)) { // Execute the command buffer first. - WARN_LOG(VIDEO, "Executing command list while waiting for space in texture upload buffer"); + WARN_LOG_FMT(VIDEO, + "Executing command list while waiting for space in texture upload buffer"); Renderer::GetInstance()->ExecuteCommandBuffer(false); // Try allocating again. This may cause a fence wait. diff --git a/Source/Core/VideoBackends/Vulkan/VertexManager.cpp b/Source/Core/VideoBackends/Vulkan/VertexManager.cpp index f3c948a60d..1fab452a9c 100644 --- a/Source/Core/VideoBackends/Vulkan/VertexManager.cpp +++ b/Source/Core/VideoBackends/Vulkan/VertexManager.cpp @@ -149,7 +149,7 @@ void VertexManager::ResetBuffer(u32 vertex_stride) if (!has_vbuffer_allocation || !has_ibuffer_allocation) { // Flush any pending commands first, so that we can wait on the fences - WARN_LOG(VIDEO, "Executing command list while waiting for space in vertex/index buffer"); + WARN_LOG_FMT(VIDEO, "Executing command list while waiting for space in vertex/index buffer"); Renderer::GetInstance()->ExecuteCommandBuffer(false); // Attempt to allocate again, this may cause a fence wait @@ -253,7 +253,7 @@ bool VertexManager::ReserveConstantStorage() } // The only places that call constant updates are safe to have state restored. - WARN_LOG(VIDEO, "Executing command buffer while waiting for space in uniform buffer"); + WARN_LOG_FMT(VIDEO, "Executing command buffer while waiting for space in uniform buffer"); Renderer::GetInstance()->ExecuteCommandBuffer(false); // Since we are on a new command buffer, all constants have been invalidated, and we need @@ -319,7 +319,7 @@ void VertexManager::UploadUtilityUniforms(const void* data, u32 data_size) if (!m_uniform_stream_buffer->ReserveMemory(data_size, g_vulkan_context->GetUniformBufferAlignment())) { - WARN_LOG(VIDEO, "Executing command buffer while waiting for ext space in uniform buffer"); + WARN_LOG_FMT(VIDEO, "Executing command buffer while waiting for ext space in uniform buffer"); Renderer::GetInstance()->ExecuteCommandBuffer(false); } @@ -340,7 +340,7 @@ bool VertexManager::UploadTexelBuffer(const void* data, u32 data_size, TexelBuff if (!m_texel_stream_buffer->ReserveMemory(data_size, elem_size)) { // Try submitting cmdbuffer. - WARN_LOG(VIDEO, "Submitting command buffer while waiting for space in texel buffer"); + WARN_LOG_FMT(VIDEO, "Submitting command buffer while waiting for space in texel buffer"); Renderer::GetInstance()->ExecuteCommandBuffer(false, false); if (!m_texel_stream_buffer->ReserveMemory(data_size, elem_size)) { @@ -370,7 +370,7 @@ bool VertexManager::UploadTexelBuffer(const void* data, u32 data_size, TexelBuff if (!m_texel_stream_buffer->ReserveMemory(reserve_size, elem_size)) { // Try submitting cmdbuffer. - WARN_LOG(VIDEO, "Submitting command buffer while waiting for space in texel buffer"); + WARN_LOG_FMT(VIDEO, "Submitting command buffer while waiting for space in texel buffer"); Renderer::GetInstance()->ExecuteCommandBuffer(false, false); if (!m_texel_stream_buffer->ReserveMemory(reserve_size, elem_size)) { diff --git a/Source/Core/VideoBackends/Vulkan/VulkanContext.cpp b/Source/Core/VideoBackends/Vulkan/VulkanContext.cpp index 5ac43e3250..e9e1f41328 100644 --- a/Source/Core/VideoBackends/Vulkan/VulkanContext.cpp +++ b/Source/Core/VideoBackends/Vulkan/VulkanContext.cpp @@ -156,7 +156,7 @@ bool VulkanContext::SelectInstanceExtensions(std::vector* 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* 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* 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* 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 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; } diff --git a/Source/Core/VideoBackends/Vulkan/VulkanLoader.cpp b/Source/Core/VideoBackends/Vulkan/VulkanLoader.cpp index 93090fb939..a9f83fe707 100644 --- a/Source/Core/VideoBackends/Vulkan/VulkanLoader.cpp +++ b/Source/Core/VideoBackends/Vulkan/VulkanLoader.cpp @@ -67,7 +67,7 @@ bool LoadVulkanLibrary() #define VULKAN_MODULE_ENTRY_POINT(name, required) \ if (!s_vulkan_module.GetSymbol(#name, &name) && required) \ { \ - ERROR_LOG(VIDEO, "Vulkan: Failed to load required module function %s", #name); \ + ERROR_LOG_FMT(VIDEO, "Vulkan: Failed to load required module function {}", #name); \ ResetVulkanLibraryFunctionPointers(); \ s_vulkan_module.Close(); \ return false; \ @@ -92,7 +92,7 @@ bool LoadVulkanInstanceFunctions(VkInstance instance) *func_ptr = vkGetInstanceProcAddr(instance, name); if (!(*func_ptr) && is_required) { - ERROR_LOG(VIDEO, "Vulkan: Failed to load required instance function %s", name); + ERROR_LOG_FMT(VIDEO, "Vulkan: Failed to load required instance function {}", name); required_functions_missing = true; } }; @@ -112,7 +112,7 @@ bool LoadVulkanDeviceFunctions(VkDevice device) *func_ptr = vkGetDeviceProcAddr(device, name); if (!(*func_ptr) && is_required) { - ERROR_LOG(VIDEO, "Vulkan: Failed to load required device function %s", name); + ERROR_LOG_FMT(VIDEO, "Vulkan: Failed to load required device function {}", name); required_functions_missing = true; } }; @@ -213,11 +213,10 @@ void LogVulkanResult(int level, const char* func_name, VkResult res, const char* std::string real_msg = StringFromFormatV(msg, ap); va_end(ap); - real_msg = StringFromFormat("(%s) %s (%d: %s)", func_name, real_msg.c_str(), - static_cast(res), VkResultToString(res)); + real_msg = fmt::format("({}) {} ({}: {})", func_name, real_msg, static_cast(res), + VkResultToString(res)); - GENERIC_LOG(Common::Log::VIDEO, static_cast(level), "%s", - real_msg.c_str()); + GENERIC_LOG_FMT(Common::Log::VIDEO, static_cast(level), "{}", real_msg); } } // namespace Vulkan diff --git a/Source/Core/VideoBackends/Vulkan/main.cpp b/Source/Core/VideoBackends/Vulkan/main.cpp index 5a583de124..0c07f283ad 100644 --- a/Source/Core/VideoBackends/Vulkan/main.cpp +++ b/Source/Core/VideoBackends/Vulkan/main.cpp @@ -106,7 +106,7 @@ bool VideoBackend::Initialize(const WindowSystemInfo& wsi) bool enable_validation_layer = g_Config.bEnableValidationLayer; if (enable_validation_layer && !VulkanContext::CheckValidationLayerAvailablility()) { - WARN_LOG(VIDEO, "Validation layer requested but not available, disabling."); + WARN_LOG_FMT(VIDEO, "Validation layer requested but not available, disabling."); enable_validation_layer = false; } @@ -166,7 +166,7 @@ bool VideoBackend::Initialize(const WindowSystemInfo& wsi) size_t selected_adapter_index = static_cast(g_Config.iAdapter); if (selected_adapter_index >= gpu_list.size()) { - WARN_LOG(VIDEO, "Vulkan adapter index out of range, selecting first adapter."); + WARN_LOG_FMT(VIDEO, "Vulkan adapter index out of range, selecting first adapter."); selected_adapter_index = 0; } @@ -312,7 +312,7 @@ void VideoBackend::PrepareWindow(WindowSystemInfo& wsi) Class clsCAMetalLayer = objc_getClass("CAMetalLayer"); if (!clsCAMetalLayer) { - ERROR_LOG(VIDEO, "Failed to get CAMetalLayer class."); + ERROR_LOG_FMT(VIDEO, "Failed to get CAMetalLayer class."); return; } @@ -321,7 +321,7 @@ void VideoBackend::PrepareWindow(WindowSystemInfo& wsi) sel_getUid("layer")); if (!layer) { - ERROR_LOG(VIDEO, "Failed to create Metal layer."); + ERROR_LOG_FMT(VIDEO, "Failed to create Metal layer."); return; }