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

@ -152,7 +152,7 @@ void BoundingBox::Flush()
Renderer::GetInstance()->ExecuteCommandList(false);
if (!m_upload_buffer.ReserveMemory(copy_size, sizeof(ValueType)))
{
PanicAlert("Failed to allocate bbox stream buffer space");
PanicAlertFmt("Failed to allocate bbox stream buffer space");
return;
}
}

View File

@ -99,7 +99,7 @@ bool DXContext::Create(u32 adapter_index, bool enable_debug_layer)
!s_d3d12_library.GetSymbol("D3D12GetDebugInterface", &s_d3d12_get_debug_interface) ||
!s_d3d12_library.GetSymbol("D3D12SerializeRootSignature", &s_d3d12_serialize_root_signature))
{
PanicAlertT("d3d12.dll could not be loaded.");
PanicAlertFmtT("d3d12.dll could not be loaded.");
s_d3d12_library.Close();
return false;
}
@ -253,7 +253,7 @@ bool DXContext::CreateDescriptorHeaps()
if (!m_descriptor_heap_manager.Allocate(&m_null_srv_descriptor))
{
PanicAlert("Failed to allocate null descriptor");
PanicAlertFmt("Failed to allocate null descriptor");
return false;
}
@ -303,8 +303,8 @@ static bool BuildRootSignature(ID3D12Device* device, ID3D12RootSignature** sig_p
&root_signature_blob, &root_signature_error_blob);
if (FAILED(hr))
{
PanicAlert("Failed to serialize root signature: %s",
static_cast<const char*>(root_signature_error_blob->GetBufferPointer()));
PanicAlertFmt("Failed to serialize root signature: {}",
static_cast<const char*>(root_signature_error_blob->GetBufferPointer()));
return false;
}
@ -400,7 +400,7 @@ bool DXContext::CreateTextureUploadBuffer()
{
if (!m_texture_upload_buffer.AllocateBuffer(TEXTURE_UPLOAD_BUFFER_SIZE))
{
PanicAlert("Failed to create texture upload buffer");
PanicAlertFmt("Failed to create texture upload buffer");
return false;
}
@ -425,7 +425,7 @@ bool DXContext::CreateCommandLists()
nullptr, IID_PPV_ARGS(res.command_list.GetAddressOf()));
if (FAILED(hr))
{
PanicAlert("Failed to create command list.");
PanicAlertFmt("Failed to create command list.");
return false;
}
@ -508,7 +508,7 @@ void DXContext::RecreateGXRootSignature()
{
m_gx_root_signature.Reset();
if (!CreateGXRootSignature())
PanicAlert("Failed to re-create GX root signature.");
PanicAlertFmt("Failed to re-create GX root signature.");
}
void DXContext::DestroyPendingResources(CommandListResources& cmdlist)

View File

@ -171,7 +171,7 @@ std::unique_ptr<DXPipeline> DXPipeline::Create(const AbstractPipelineConfig& con
desc.pRootSignature = g_dx_context->GetUtilityRootSignature();
break;
default:
PanicAlert("Unknown pipeline layout.");
PanicAlertFmt("Unknown pipeline layout.");
return nullptr;
}

View File

@ -128,7 +128,7 @@ std::unique_ptr<DXTexture> DXTexture::CreateAdopted(ID3D12Resource* resource)
if (desc.Dimension != D3D12_RESOURCE_DIMENSION_TEXTURE2D ||
format == AbstractTextureFormat::Undefined)
{
PanicAlert("Unknown format for adopted texture");
PanicAlertFmt("Unknown format for adopted texture");
return nullptr;
}
@ -154,7 +154,7 @@ bool DXTexture::CreateSRVDescriptor()
{
if (!g_dx_context->GetDescriptorHeapManager().Allocate(&m_srv_descriptor))
{
PanicAlert("Failed to allocate SRV descriptor");
PanicAlertFmt("Failed to allocate SRV descriptor");
return false;
}
@ -181,7 +181,7 @@ bool DXTexture::CreateUAVDescriptor()
{
if (!g_dx_context->GetDescriptorHeapManager().Allocate(&m_uav_descriptor))
{
PanicAlert("Failed to allocate UAV descriptor");
PanicAlertFmt("Failed to allocate UAV descriptor");
return false;
}
@ -225,7 +225,7 @@ void DXTexture::Load(u32 level, u32 width, u32 height, u32 row_length, const u8*
staging_buffer = CreateTextureUploadBuffer(upload_size);
if (!staging_buffer || FAILED(staging_buffer->Map(0, &read_range, &upload_buffer_ptr)))
{
PanicAlert("Failed to allocate/map temporary texture upload buffer");
PanicAlertFmt("Failed to allocate/map temporary texture upload buffer");
return;
}
@ -245,7 +245,7 @@ void DXTexture::Load(u32 level, u32 width, u32 height, u32 row_length, const u8*
if (!g_dx_context->GetTextureUploadBuffer().ReserveMemory(
upload_size, D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT))
{
PanicAlert("Failed to allocate texture upload buffer");
PanicAlertFmt("Failed to allocate texture upload buffer");
return;
}
}
@ -436,7 +436,7 @@ bool DXFramebuffer::CreateRTVDescriptor()
{
if (!g_dx_context->GetRTVHeapManager().Allocate(&m_rtv_descriptor))
{
PanicAlert("Failed to allocate RTV descriptor");
PanicAlertFmt("Failed to allocate RTV descriptor");
return false;
}
@ -471,7 +471,7 @@ bool DXFramebuffer::CreateDSVDescriptor()
{
if (!g_dx_context->GetDSVHeapManager().Allocate(&m_dsv_descriptor))
{
PanicAlert("Failed to allocate RTV descriptor");
PanicAlertFmt("Failed to allocate RTV descriptor");
return false;
}

View File

@ -63,7 +63,7 @@ bool DescriptorHeapManager::Allocate(DescriptorHandle* handle)
return true;
}
PanicAlert("Out of fixed descriptors");
PanicAlertFmt("Out of fixed descriptors");
return false;
}

View File

@ -72,8 +72,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

@ -39,7 +39,7 @@ bool VertexManager::Initialize()
!m_uniform_stream_buffer.AllocateBuffer(UNIFORM_STREAM_BUFFER_SIZE) ||
!m_texel_stream_buffer.AllocateBuffer(TEXEL_STREAM_BUFFER_SIZE))
{
PanicAlert("Failed to allocate streaming buffers");
PanicAlertFmt("Failed to allocate streaming buffers");
return false;
}
@ -55,7 +55,7 @@ bool VertexManager::Initialize()
DescriptorHandle& dh = m_texel_buffer_views[it.first];
if (!g_dx_context->GetDescriptorHeapManager().Allocate(&dh))
{
PanicAlert("Failed to allocate descriptor for texel buffer");
PanicAlertFmt("Failed to allocate descriptor for texel buffer");
return false;
}
@ -92,7 +92,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
@ -208,7 +208,7 @@ void VertexManager::UploadAllConstants()
if (!m_uniform_stream_buffer.ReserveMemory(allocation_size,
D3D12_CONSTANT_BUFFER_DATA_PLACEMENT_ALIGNMENT))
{
PanicAlert("Failed to allocate space for constants in streaming buffer");
PanicAlertFmt("Failed to allocate space for constants in streaming buffer");
return;
}
@ -270,7 +270,7 @@ bool VertexManager::UploadTexelBuffer(const void* data, u32 data_size, TexelBuff
Renderer::GetInstance()->ExecuteCommandList(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;
}
}
@ -300,7 +300,7 @@ bool VertexManager::UploadTexelBuffer(const void* data, u32 data_size, TexelBuff
Renderer::GetInstance()->ExecuteCommandList(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

@ -100,7 +100,7 @@ bool VideoBackend::Initialize(const WindowSystemInfo& wsi)
{
if (!DXContext::Create(g_Config.iAdapter, g_Config.bEnableValidationLayer))
{
PanicAlert("Failed to create D3D12 context");
PanicAlertFmtT("Failed to create D3D12 context");
return false;
}
@ -109,7 +109,7 @@ bool VideoBackend::Initialize(const WindowSystemInfo& wsi)
if (!g_dx_context->CreateGlobalResources())
{
PanicAlert("Failed to create D3D12 global resources");
PanicAlertFmtT("Failed to create D3D12 global resources");
DXContext::Destroy();
ShutdownShared();
return false;
@ -118,7 +118,7 @@ bool VideoBackend::Initialize(const WindowSystemInfo& wsi)
std::unique_ptr<SwapChain> swap_chain;
if (wsi.render_surface && !(swap_chain = SwapChain::Create(wsi)))
{
PanicAlertT("Failed to create D3D swap chain");
PanicAlertFmtT("Failed to create D3D swap chain");
DXContext::Destroy();
ShutdownShared();
return false;
@ -136,7 +136,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");
PanicAlertFmtT("Failed to initialize renderer classes");
Shutdown();
return false;
}