General: Convert PanicAlerts over to fmt equivalent

Converts lingering panic alert calls over to the fmt-capable ones.
This commit is contained in:
Lioncash
2020-12-02 13:17:27 -05:00
parent 5abae61a8c
commit 139d4fc76e
45 changed files with 206 additions and 195 deletions

View File

@ -283,7 +283,7 @@ void CommandBufferManager::SubmitCommandBuffer(bool submit_on_worker_thread,
if (res != VK_SUCCESS)
{
LOG_VULKAN_ERROR(res, "vkEndCommandBuffer failed: ");
PanicAlert("Failed to end command buffer");
PanicAlertFmt("Failed to end command buffer");
}
}
@ -358,7 +358,7 @@ void CommandBufferManager::SubmitCommandBuffer(u32 command_buffer_index,
if (res != VK_SUCCESS)
{
LOG_VULKAN_ERROR(res, "vkQueueSubmit failed: ");
PanicAlert("Failed to submit command buffer.");
PanicAlertFmt("Failed to submit command buffer.");
}
// Do we have a swap chain to present?

View File

@ -55,7 +55,7 @@ bool ObjectCache::Initialize()
StreamBuffer::Create(VK_BUFFER_USAGE_TRANSFER_SRC_BIT, TEXTURE_UPLOAD_BUFFER_SIZE);
if (!m_texture_upload_buffer)
{
PanicAlert("Failed to create texture upload buffer");
PanicAlertFmt("Failed to create texture upload buffer");
return false;
}

View File

@ -32,7 +32,7 @@ bool PerfQuery::Initialize()
{
if (!CreateQueryPool())
{
PanicAlert("Failed to create query pool");
PanicAlertFmt("Failed to create query pool");
return false;
}

View File

@ -67,7 +67,7 @@ bool Renderer::Initialize()
m_bounding_box = std::make_unique<BoundingBox>();
if (!m_bounding_box->Initialize())
{
PanicAlert("Failed to initialize bounding box.");
PanicAlertFmt("Failed to initialize bounding box.");
return false;
}
@ -317,7 +317,7 @@ void Renderer::BindBackbuffer(const ClearColor& clear_color)
res = m_swap_chain->AcquireNextImage();
}
if (res != VK_SUCCESS)
PanicAlert("Failed to grab image from swap chain");
PanicAlertFmt("Failed to grab image from swap chain");
// Transition from undefined (or present src, but it can be substituted) to
// color attachment ready for writing. These transitions must occur outside
@ -385,7 +385,7 @@ void Renderer::CheckForSurfaceChange()
// Recreate the surface. If this fails we're in trouble.
if (!m_swap_chain->RecreateSurface(m_new_surface_handle))
PanicAlert("Failed to recreate Vulkan surface. Cannot continue.");
PanicAlertFmt("Failed to recreate Vulkan surface. Cannot continue.");
m_new_surface_handle = nullptr;
// Handle case where the dimensions are now different.

View File

@ -169,7 +169,7 @@ static std::optional<SPIRVCodeVector> CompileShaderToSPV(EShLanguage stage,
stream << "Dolphin Version: " + Common::scm_rev_str + "\n";
stream << "Video Backend: " + g_video_backend->GetDisplayName();
PanicAlert("%s (written to %s)", msg, filename.c_str());
PanicAlertFmt("{} (written to {})", msg, filename);
};
if (!shader->parse(GetCompilerResourceLimits(), default_version, profile, false, true, messages,
@ -250,7 +250,7 @@ bool InitializeGlslang()
if (!glslang::InitializeProcess())
{
PanicAlert("Failed to initialize glslang shader compiler");
PanicAlertFmt("Failed to initialize glslang shader compiler");
return false;
}

View File

@ -136,8 +136,8 @@ bool StreamBuffer::ReserveMemory(u32 num_bytes, u32 alignment)
// Check for sane allocations
if (required_bytes > m_size)
{
PanicAlert("Attempting to allocate %u bytes from a %u byte stream buffer",
static_cast<uint32_t>(num_bytes), static_cast<uint32_t>(m_size));
PanicAlertFmt("Attempting to allocate {} bytes from a {} byte stream buffer", num_bytes,
m_size);
return false;
}

View File

@ -182,7 +182,7 @@ bool SwapChain::SelectSurfaceFormat()
return true;
}
PanicAlert("Failed to find a suitable format for swap chain buffers.");
PanicAlertFmt("Failed to find a suitable format for swap chain buffers.");
return false;
}
@ -398,7 +398,7 @@ bool SwapChain::SetupSwapChainImages()
m_surface_format.format, VK_FORMAT_UNDEFINED, 1, VK_ATTACHMENT_LOAD_OP_CLEAR);
if (load_render_pass == VK_NULL_HANDLE || clear_render_pass == VK_NULL_HANDLE)
{
PanicAlert("Failed to get swap chain render passes.");
PanicAlertFmt("Failed to get swap chain render passes.");
return false;
}
@ -469,7 +469,7 @@ bool SwapChain::ResizeSwapChain()
DestroySwapChainImages();
if (!CreateSwapChain() || !SetupSwapChainImages())
{
PanicAlert("Failed to re-configure swap chain images, this is fatal (for now)");
PanicAlertFmt("Failed to re-configure swap chain images, this is fatal (for now)");
return false;
}
@ -482,7 +482,7 @@ bool SwapChain::RecreateSwapChain()
DestroySwapChain();
if (!CreateSwapChain() || !SetupSwapChainImages())
{
PanicAlert("Failed to re-configure swap chain images, this is fatal (for now)");
PanicAlertFmt("Failed to re-configure swap chain images, this is fatal (for now)");
return false;
}
@ -557,7 +557,7 @@ bool SwapChain::RecreateSurface(void* native_handle)
}
if (!present_supported)
{
PanicAlert("Recreated surface does not support presenting.");
PanicAlertFmt("Recreated surface does not support presenting.");
return false;
}

View File

@ -248,7 +248,7 @@ std::unique_ptr<VKPipeline> VKPipeline::Create(const AbstractPipelineConfig& con
pipeline_layout = g_object_cache->GetPipelineLayout(PIPELINE_LAYOUT_UTILITY);
break;
default:
PanicAlert("Unknown pipeline layout.");
PanicAlertFmt("Unknown pipeline layout.");
return nullptr;
}

View File

@ -217,7 +217,7 @@ VkFormat VKTexture::GetVkFormatForHostTextureFormat(AbstractTextureFormat format
return VK_FORMAT_UNDEFINED;
default:
PanicAlert("Unhandled texture format.");
PanicAlertFmt("Unhandled texture format.");
return VK_FORMAT_R8G8B8A8_UNORM;
}
}
@ -375,7 +375,7 @@ void VKTexture::Load(u32 level, u32 width, u32 height, u32 row_length, const u8*
// Try allocating again. This may cause a fence wait.
if (!stream_buffer->ReserveMemory(upload_size, upload_alignment))
PanicAlert("Failed to allocate space in texture upload buffer");
PanicAlertFmt("Failed to allocate space in texture upload buffer");
}
// Copy to the streaming buffer.
upload_buffer = stream_buffer->GetBuffer();
@ -390,7 +390,7 @@ void VKTexture::Load(u32 level, u32 width, u32 height, u32 row_length, const u8*
VK_BUFFER_USAGE_TRANSFER_SRC_BIT);
if (!temp_buffer || !temp_buffer->Map())
{
PanicAlert("Failed to allocate staging texture for large texture upload.");
PanicAlertFmt("Failed to allocate staging texture for large texture upload.");
return;
}

View File

@ -70,7 +70,7 @@ bool VertexManager::Initialize()
StreamBuffer::Create(VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, UNIFORM_STREAM_BUFFER_SIZE);
if (!m_vertex_stream_buffer || !m_index_stream_buffer || !m_uniform_stream_buffer)
{
PanicAlert("Failed to allocate streaming buffers");
PanicAlertFmt("Failed to allocate streaming buffers");
return false;
}
@ -96,7 +96,7 @@ bool VertexManager::Initialize()
StreamBuffer::Create(VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT, texel_buffer_size);
if (!m_texel_stream_buffer)
{
PanicAlert("Failed to allocate streaming texel buffer");
PanicAlertFmt("Failed to allocate streaming texel buffer");
return false;
}
@ -112,7 +112,7 @@ bool VertexManager::Initialize()
if ((m_texel_buffer_views[it.first] = CreateTexelBufferView(m_texel_stream_buffer->GetBuffer(),
it.second)) == VK_NULL_HANDLE)
{
PanicAlert("Failed to create texel buffer view");
PanicAlertFmt("Failed to create texel buffer view");
return false;
}
}
@ -161,7 +161,7 @@ void VertexManager::ResetBuffer(u32 vertex_stride)
// If we still failed, that means the allocation was too large and will never succeed, so panic
if (!has_vbuffer_allocation || !has_ibuffer_allocation)
PanicAlert("Failed to allocate space in streaming buffers for pending draw");
PanicAlertFmt("Failed to allocate space in streaming buffers for pending draw");
}
// Update pointers
@ -277,7 +277,7 @@ void VertexManager::UploadAllConstants()
// We should only be here if the buffer was full and a command buffer was submitted anyway.
if (!m_uniform_stream_buffer->ReserveMemory(allocation_size, ub_alignment))
{
PanicAlert("Failed to allocate space for constants in streaming buffer");
PanicAlertFmt("Failed to allocate space for constants in streaming buffer");
return;
}
@ -344,7 +344,7 @@ bool VertexManager::UploadTexelBuffer(const void* data, u32 data_size, TexelBuff
Renderer::GetInstance()->ExecuteCommandBuffer(false, false);
if (!m_texel_stream_buffer->ReserveMemory(data_size, elem_size))
{
PanicAlert("Failed to allocate %u bytes from texel buffer", data_size);
PanicAlertFmt("Failed to allocate {} bytes from texel buffer", data_size);
return false;
}
}
@ -374,7 +374,7 @@ bool VertexManager::UploadTexelBuffer(const void* data, u32 data_size, TexelBuff
Renderer::GetInstance()->ExecuteCommandBuffer(false, false);
if (!m_texel_stream_buffer->ReserveMemory(reserve_size, elem_size))
{
PanicAlert("Failed to allocate %u bytes from texel buffer", reserve_size);
PanicAlertFmt("Failed to allocate {} bytes from texel buffer", reserve_size);
return false;
}
}

View File

@ -779,7 +779,7 @@ u32 VulkanContext::GetUploadMemoryType(u32 bits, bool* is_coherent)
return type_index.value();
// Shouldn't happen, there should be at least one host-visible heap.
PanicAlert("Unable to get memory type for upload.");
PanicAlertFmt("Unable to get memory type for upload.");
return 0;
}
@ -821,7 +821,7 @@ u32 VulkanContext::GetReadbackMemoryType(u32 bits, bool* is_coherent)
return type_index.value();
// We should have at least one host visible memory type...
PanicAlert("Unable to get memory type for upload.");
PanicAlertFmt("Unable to get memory type for upload.");
return 0;
}

View File

@ -65,14 +65,14 @@ void VideoBackend::InitBackendInfo()
}
else
{
PanicAlert("Failed to create Vulkan instance.");
PanicAlertFmt("Failed to create Vulkan instance.");
}
UnloadVulkanLibrary();
}
else
{
PanicAlert("Failed to load Vulkan library.");
PanicAlertFmt("Failed to load Vulkan library.");
}
}
@ -98,7 +98,7 @@ bool VideoBackend::Initialize(const WindowSystemInfo& wsi)
{
if (!LoadVulkanLibrary())
{
PanicAlert("Failed to load Vulkan library.");
PanicAlertFmt("Failed to load Vulkan library.");
return false;
}
@ -118,7 +118,7 @@ bool VideoBackend::Initialize(const WindowSystemInfo& wsi)
VulkanContext::CreateVulkanInstance(wsi.type, enable_debug_reports, enable_validation_layer);
if (instance == VK_NULL_HANDLE)
{
PanicAlert("Failed to create Vulkan instance.");
PanicAlertFmt("Failed to create Vulkan instance.");
UnloadVulkanLibrary();
return false;
}
@ -126,7 +126,7 @@ bool VideoBackend::Initialize(const WindowSystemInfo& wsi)
// Load instance function pointers.
if (!LoadVulkanInstanceFunctions(instance))
{
PanicAlert("Failed to load Vulkan instance functions.");
PanicAlertFmt("Failed to load Vulkan instance functions.");
vkDestroyInstance(instance, nullptr);
UnloadVulkanLibrary();
return false;
@ -137,7 +137,7 @@ bool VideoBackend::Initialize(const WindowSystemInfo& wsi)
VulkanContext::GPUList gpu_list = VulkanContext::EnumerateGPUs(instance);
if (gpu_list.empty())
{
PanicAlert("No Vulkan physical devices available.");
PanicAlertFmt("No Vulkan physical devices available.");
vkDestroyInstance(instance, nullptr);
UnloadVulkanLibrary();
return false;
@ -154,7 +154,7 @@ bool VideoBackend::Initialize(const WindowSystemInfo& wsi)
surface = SwapChain::CreateVulkanSurface(instance, wsi);
if (surface == VK_NULL_HANDLE)
{
PanicAlert("Failed to create Vulkan surface.");
PanicAlertFmt("Failed to create Vulkan surface.");
vkDestroyInstance(instance, nullptr);
UnloadVulkanLibrary();
return false;
@ -175,7 +175,7 @@ bool VideoBackend::Initialize(const WindowSystemInfo& wsi)
enable_debug_reports, enable_validation_layer);
if (!g_vulkan_context)
{
PanicAlert("Failed to create Vulkan device");
PanicAlertFmt("Failed to create Vulkan device");
UnloadVulkanLibrary();
return false;
}
@ -197,7 +197,7 @@ bool VideoBackend::Initialize(const WindowSystemInfo& wsi)
g_command_buffer_mgr = std::make_unique<CommandBufferManager>(g_Config.bBackendMultithreading);
if (!g_command_buffer_mgr->Initialize())
{
PanicAlert("Failed to create Vulkan command buffers");
PanicAlertFmt("Failed to create Vulkan command buffers");
Shutdown();
return false;
}
@ -206,7 +206,7 @@ bool VideoBackend::Initialize(const WindowSystemInfo& wsi)
g_object_cache = std::make_unique<ObjectCache>();
if (!g_object_cache->Initialize())
{
PanicAlert("Failed to initialize Vulkan object cache.");
PanicAlertFmt("Failed to initialize Vulkan object cache.");
Shutdown();
return false;
}
@ -218,7 +218,7 @@ bool VideoBackend::Initialize(const WindowSystemInfo& wsi)
swap_chain = SwapChain::Create(wsi, surface, g_ActiveConfig.bVSyncActive);
if (!swap_chain)
{
PanicAlert("Failed to create Vulkan swap chain.");
PanicAlertFmt("Failed to create Vulkan swap chain.");
Shutdown();
return false;
}
@ -226,7 +226,7 @@ bool VideoBackend::Initialize(const WindowSystemInfo& wsi)
if (!StateTracker::CreateInstance())
{
PanicAlert("Failed to create state tracker");
PanicAlertFmt("Failed to create state tracker");
Shutdown();
return false;
}
@ -243,7 +243,7 @@ bool VideoBackend::Initialize(const WindowSystemInfo& wsi)
!g_renderer->Initialize() || !g_framebuffer_manager->Initialize() ||
!g_texture_cache->Initialize() || !PerfQuery::GetInstance()->Initialize())
{
PanicAlert("Failed to initialize renderer classes");
PanicAlertFmt("Failed to initialize renderer classes");
Shutdown();
return false;
}
@ -351,7 +351,7 @@ void VideoBackend::PrepareWindow(WindowSystemInfo& wsi)
// the user that this is an unsupported configuration, but permit them to continue.
if (!IsRunningOnMojaveOrHigher())
{
PanicAlertT(
PanicAlertFmtT(
"You are attempting to use the Vulkan (Metal) backend on an unsupported operating system. "
"For all functionality to be enabled, you must use macOS 10.14 (Mojave) or newer. Please "
"do not report any issues encountered unless they also occur on 10.14+.");