From d7834bd6b4966be32c44aaf5563c3a1cd0367dc3 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 9 Nov 2020 02:59:48 -0500 Subject: [PATCH] D3D12: Migrate logging over to fmt Migrates the logging over to the fmt-capable logger. --- Source/Core/VideoBackends/D3D12/BoundingBox.cpp | 2 +- Source/Core/VideoBackends/D3D12/DXContext.cpp | 4 ++-- Source/Core/VideoBackends/D3D12/DXPipeline.cpp | 6 +++--- Source/Core/VideoBackends/D3D12/DXTexture.cpp | 3 ++- .../Core/VideoBackends/D3D12/DescriptorHeapManager.cpp | 2 +- Source/Core/VideoBackends/D3D12/Renderer.cpp | 4 ++-- Source/Core/VideoBackends/D3D12/VertexManager.cpp | 10 +++++----- 7 files changed, 16 insertions(+), 15 deletions(-) diff --git a/Source/Core/VideoBackends/D3D12/BoundingBox.cpp b/Source/Core/VideoBackends/D3D12/BoundingBox.cpp index c6b5db3b39..1de88b4e7c 100644 --- a/Source/Core/VideoBackends/D3D12/BoundingBox.cpp +++ b/Source/Core/VideoBackends/D3D12/BoundingBox.cpp @@ -148,7 +148,7 @@ void BoundingBox::Flush() const u32 copy_size = (end - start) * sizeof(ValueType); if (!m_upload_buffer.ReserveMemory(copy_size, sizeof(ValueType))) { - WARN_LOG(VIDEO, "Executing command list while waiting for space in bbox stream buffer"); + WARN_LOG_FMT(VIDEO, "Executing command list while waiting for space in bbox stream buffer"); Renderer::GetInstance()->ExecuteCommandList(false); if (!m_upload_buffer.ReserveMemory(copy_size, sizeof(ValueType))) { diff --git a/Source/Core/VideoBackends/D3D12/DXContext.cpp b/Source/Core/VideoBackends/D3D12/DXContext.cpp index 6793c915e0..9614ad108f 100644 --- a/Source/Core/VideoBackends/D3D12/DXContext.cpp +++ b/Source/Core/VideoBackends/D3D12/DXContext.cpp @@ -152,7 +152,7 @@ bool DXContext::CreateDevice(u32 adapter_index, bool enable_debug_layer) HRESULT hr = m_dxgi_factory->EnumAdapters(adapter_index, &adapter); if (FAILED(hr)) { - ERROR_LOG(VIDEO, "Adapter %u not found, using default", adapter_index); + ERROR_LOG_FMT(VIDEO, "Adapter {} not found, using default", adapter_index); adapter = nullptr; } @@ -166,7 +166,7 @@ bool DXContext::CreateDevice(u32 adapter_index, bool enable_debug_layer) } else { - ERROR_LOG(VIDEO, "Debug layer requested but not available."); + ERROR_LOG_FMT(VIDEO, "Debug layer requested but not available."); enable_debug_layer = false; } } diff --git a/Source/Core/VideoBackends/D3D12/DXPipeline.cpp b/Source/Core/VideoBackends/D3D12/DXPipeline.cpp index c32739f803..1e0616ba26 100644 --- a/Source/Core/VideoBackends/D3D12/DXPipeline.cpp +++ b/Source/Core/VideoBackends/D3D12/DXPipeline.cpp @@ -210,8 +210,8 @@ std::unique_ptr DXPipeline::Create(const AbstractPipelineConfig& con HRESULT hr = g_dx_context->GetDevice()->CreateGraphicsPipelineState(&desc, IID_PPV_ARGS(&pso)); if (FAILED(hr)) { - WARN_LOG(VIDEO, "CreateGraphicsPipelineState() %sfailed with HRESULT %08X", - cache_data ? "with cache data " : "", hr); + WARN_LOG_FMT(VIDEO, "CreateGraphicsPipelineState() {}failed with HRESULT {:08X}", + cache_data ? "with cache data " : "", hr); return nullptr; } @@ -227,7 +227,7 @@ AbstractPipeline::CacheData DXPipeline::GetCacheData() const HRESULT hr = m_pipeline->GetCachedBlob(&blob); if (FAILED(hr)) { - WARN_LOG(VIDEO, "ID3D12Pipeline::GetCachedBlob() failed with HRESULT %08X", hr); + WARN_LOG_FMT(VIDEO, "ID3D12Pipeline::GetCachedBlob() failed with HRESULT {:08X}", hr); return {}; } diff --git a/Source/Core/VideoBackends/D3D12/DXTexture.cpp b/Source/Core/VideoBackends/D3D12/DXTexture.cpp index f27ba5ad54..df63e13044 100644 --- a/Source/Core/VideoBackends/D3D12/DXTexture.cpp +++ b/Source/Core/VideoBackends/D3D12/DXTexture.cpp @@ -239,7 +239,8 @@ 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)) { - 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()->ExecuteCommandList(false); if (!g_dx_context->GetTextureUploadBuffer().ReserveMemory( upload_size, D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT)) diff --git a/Source/Core/VideoBackends/D3D12/DescriptorHeapManager.cpp b/Source/Core/VideoBackends/D3D12/DescriptorHeapManager.cpp index 2b3627c4f1..12eb1b0b9e 100644 --- a/Source/Core/VideoBackends/D3D12/DescriptorHeapManager.cpp +++ b/Source/Core/VideoBackends/D3D12/DescriptorHeapManager.cpp @@ -148,7 +148,7 @@ bool SamplerHeapManager::Lookup(const SamplerState& ss, D3D12_CPU_DESCRIPTOR_HAN { // We can clear at any time because the descriptors are copied prior to execution. // It's still not free, since we have to recreate all our samplers again. - WARN_LOG(VIDEO, "Out of samplers, resetting CPU heap"); + WARN_LOG_FMT(VIDEO, "Out of samplers, resetting CPU heap"); Clear(); } diff --git a/Source/Core/VideoBackends/D3D12/Renderer.cpp b/Source/Core/VideoBackends/D3D12/Renderer.cpp index 225057dc7a..dc4ab47afb 100644 --- a/Source/Core/VideoBackends/D3D12/Renderer.cpp +++ b/Source/Core/VideoBackends/D3D12/Renderer.cpp @@ -653,8 +653,8 @@ void Renderer::UpdateDescriptorTables() const bool uav_update_failed = (m_dirty_bits & DirtyState_PS_UAV) && !UpdateUAVDescriptorTable(); if (texture_update_failed || sampler_update_failed || uav_update_failed) { - WARN_LOG(VIDEO, "Executing command list while waiting for temporary %s", - texture_update_failed ? "descriptors" : "samplers"); + WARN_LOG_FMT(VIDEO, "Executing command list while waiting for temporary {}", + texture_update_failed ? "descriptors" : "samplers"); ExecuteCommandList(false); SetRootSignatures(); SetDescriptorHeaps(); diff --git a/Source/Core/VideoBackends/D3D12/VertexManager.cpp b/Source/Core/VideoBackends/D3D12/VertexManager.cpp index ecaec7c9c1..01d9e8a452 100644 --- a/Source/Core/VideoBackends/D3D12/VertexManager.cpp +++ b/Source/Core/VideoBackends/D3D12/VertexManager.cpp @@ -80,7 +80,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()->ExecuteCommandList(false); // Attempt to allocate again, this may cause a fence wait @@ -182,7 +182,7 @@ bool VertexManager::ReserveConstantStorage() } // The only places that call constant updates are safe to have state restored. - WARN_LOG(VIDEO, "Executing command list while waiting for space in uniform buffer"); + WARN_LOG_FMT(VIDEO, "Executing command list while waiting for space in uniform buffer"); Renderer::GetInstance()->ExecuteCommandList(false); // Since we are on a new command buffer, all constants have been invalidated, and we need @@ -244,7 +244,7 @@ void VertexManager::UploadUtilityUniforms(const void* data, u32 data_size) if (!m_uniform_stream_buffer.ReserveMemory(data_size, D3D12_CONSTANT_BUFFER_DATA_PLACEMENT_ALIGNMENT)) { - 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()->ExecuteCommandList(false); } @@ -266,7 +266,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()->ExecuteCommandList(false); if (!m_texel_stream_buffer.ReserveMemory(data_size, elem_size)) { @@ -296,7 +296,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()->ExecuteCommandList(false); if (!m_texel_stream_buffer.ReserveMemory(reserve_size, elem_size)) {