diff --git a/src/gpgmm/common/EventTraceWriter.cpp b/src/gpgmm/common/EventTraceWriter.cpp index 58bd6ed7d..0020d5b43 100644 --- a/src/gpgmm/common/EventTraceWriter.cpp +++ b/src/gpgmm/common/EventTraceWriter.cpp @@ -203,7 +203,7 @@ namespace gpgmm { // Open the file but do not create it. outFile.open(mTraceFile, std::ios_base::out | std::ios_base::in); if (outFile.is_open()) { - WarningLog() << mTraceFile + " exists and will be overwritten."; + WarnLog() << mTraceFile + " exists and will be overwritten."; } outFile.close(); diff --git a/src/gpgmm/common/MemoryAllocator.cpp b/src/gpgmm/common/MemoryAllocator.cpp index 658cbbde5..c38ff08e5 100644 --- a/src/gpgmm/common/MemoryAllocator.cpp +++ b/src/gpgmm/common/MemoryAllocator.cpp @@ -210,7 +210,7 @@ namespace gpgmm { void MemoryAllocator::CheckAndReportAllocationMisalignment(const MemoryAllocation& allocation) { if (allocation.GetSize() > allocation.GetRequestSize()) { - WarningLog(MessageId::kAlignmentMismatch) + WarnLog(MessageId::kAlignmentMismatch) << "Allocation is larger then the requested size (" + std::to_string(allocation.GetSize()) + " vs " + std::to_string(allocation.GetRequestSize()) + " bytes)."; diff --git a/src/gpgmm/common/TraceEvent.cpp b/src/gpgmm/common/TraceEvent.cpp index 2a7bd0f9a..9259a9815 100644 --- a/src/gpgmm/common/TraceEvent.cpp +++ b/src/gpgmm/common/TraceEvent.cpp @@ -45,7 +45,7 @@ namespace gpgmm { void StartupEventTrace(const char* traceFile, const TraceEventPhase& ignoreMask) { #if defined(GPGMM_DISABLE_TRACING) - WarningLog() << "Event tracing enabled but unable to record due to GPGMM_DISABLE_TRACING."; + WarnLog() << "Event tracing enabled but unable to record due to GPGMM_DISABLE_TRACING."; #endif GetInstance()->SetConfiguration(traceFile, ignoreMask); diff --git a/src/gpgmm/d3d12/CapsD3D12.cpp b/src/gpgmm/d3d12/CapsD3D12.cpp index c621a9acd..d82594b36 100644 --- a/src/gpgmm/d3d12/CapsD3D12.cpp +++ b/src/gpgmm/d3d12/CapsD3D12.cpp @@ -113,7 +113,7 @@ namespace gpgmm::d3d12 { caps->mIsResourceAllocationWithinCoherent = true; } } else { - WarningLog() + WarnLog() << "Adapter was left unspecified. Device capabilities may not be fully detected."; } diff --git a/src/gpgmm/d3d12/DebugResourceAllocatorD3D12.cpp b/src/gpgmm/d3d12/DebugResourceAllocatorD3D12.cpp index 0465f1273..d11219523 100644 --- a/src/gpgmm/d3d12/DebugResourceAllocatorD3D12.cpp +++ b/src/gpgmm/d3d12/DebugResourceAllocatorD3D12.cpp @@ -50,8 +50,8 @@ namespace gpgmm::d3d12 { std::lock_guard lock(mMutex); for (auto allocationEntry : mLiveAllocations) { const ResourceAllocation* allocation = allocationEntry->GetValue().GetAllocation(); - WarningLog() << "Live ResourceAllocation at " << ToHexStr(allocation) << ", " - << JSONSerializer::Serialize(allocation->GetInfo()).ToString(); + WarnLog() << "Live ResourceAllocation at " << ToHexStr(allocation) << ", " + << JSONSerializer::Serialize(allocation->GetInfo()).ToString(); } } diff --git a/src/gpgmm/d3d12/HeapD3D12.cpp b/src/gpgmm/d3d12/HeapD3D12.cpp index 4ba0748cd..26e3410f6 100644 --- a/src/gpgmm/d3d12/HeapD3D12.cpp +++ b/src/gpgmm/d3d12/HeapD3D12.cpp @@ -147,7 +147,7 @@ namespace gpgmm::d3d12 { } } else { if (descriptor.Flags & HEAP_FLAG_ALWAYS_IN_RESIDENCY) { - WarningLog(heap.get(), MessageId::kInvalidArgument) + WarnLog(heap.get(), MessageId::kInvalidArgument) << "HEAP_FLAG_ALWAYS_IN_RESIDENCY was specified but had no effect becauase " "residency management is " "not being used."; diff --git a/src/gpgmm/d3d12/LogD3D12.h b/src/gpgmm/d3d12/LogD3D12.h index 236369180..3956eaca5 100644 --- a/src/gpgmm/d3d12/LogD3D12.h +++ b/src/gpgmm/d3d12/LogD3D12.h @@ -31,9 +31,8 @@ namespace gpgmm::d3d12 { } template - LogMessage WarningLog(const BackendT* object, MessageId messageId = MessageId::kUnknown) { - return gpgmm::WarningLog(messageId, true, gpgmm::WCharToUTF8(object->GetDebugName()), - object); + LogMessage WarnLog(const BackendT* object, MessageId messageId = MessageId::kUnknown) { + return gpgmm::WarnLog(messageId, true, gpgmm::WCharToUTF8(object->GetDebugName()), object); } template diff --git a/src/gpgmm/d3d12/ResidencyManagerD3D12.cpp b/src/gpgmm/d3d12/ResidencyManagerD3D12.cpp index 46b996229..5cb3075ad 100644 --- a/src/gpgmm/d3d12/ResidencyManagerD3D12.cpp +++ b/src/gpgmm/d3d12/ResidencyManagerD3D12.cpp @@ -185,7 +185,7 @@ namespace gpgmm::d3d12 { } if ((descriptor.Flags & RESIDENCY_FLAG_DISABLE_UNIFIED_MEMORY) && caps->IsAdapterUMA()) { - WarningLog(MessageId::kInvalidArgument, true) + WarnLog(MessageId::kInvalidArgument, true) << "RESIDENCY_FLAG_DISABLE_UNIFIED_MEMORY flag was specified but " "did not match the architecture of the adapter."; } @@ -240,13 +240,13 @@ namespace gpgmm::d3d12 { // Emit a warning if the budget was initialized to zero. // This means nothing will be ever evicted, which will lead to device lost. if (localVideoMemorySegmentInfo->Budget == 0) { - WarningLog(residencyManager.get(), MessageId::kBudgetInvalid) + WarnLog(residencyManager.get(), MessageId::kBudgetInvalid) << "GPU memory segment (" << GetMemorySegmentName(DXGI_MEMORY_SEGMENT_GROUP_LOCAL, residencyManager->mIsUMA) << ") did not initialize a budget. This means either a restricted budget was not " "used or the first OS budget update hasn't occured."; if (!residencyManager->mIsUMA && nonLocalVideoMemorySegmentInfo->Budget == 0) { - WarningLog(residencyManager.get(), MessageId::kBudgetInvalid) + WarnLog(residencyManager.get(), MessageId::kBudgetInvalid) << "GPU memory segment (" << GetMemorySegmentName(DXGI_MEMORY_SEGMENT_GROUP_NON_LOCAL, residencyManager->mIsUMA) diff --git a/src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp b/src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp index 4f71cfafe..2c32a014d 100644 --- a/src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp +++ b/src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp @@ -465,7 +465,7 @@ namespace gpgmm::d3d12 { } if (allocatorDescriptor.Flags & ALLOCATOR_FLAG_ALWAYS_IN_BUDGET && !pResidencyManager) { - WarningLog(MessageId::kInvalidArgument, true) + WarnLog(MessageId::kInvalidArgument, true) << "ALLOCATOR_FLAG_ALWAYS_IN_BUDGET has no effect when residency " "management does not exist. This is probably not what the " "developer intended to do. Please consider creating a residency " @@ -551,7 +551,7 @@ namespace gpgmm::d3d12 { D3D12_INFO_QUEUE_FILTER emptyFilter{}; GPGMM_RETURN_IF_FAILED(leakMessageQueue->PushRetrievalFilter(&emptyFilter)); } else { - WarningLog(MessageId::kInvalidArgument, true) + WarnLog(MessageId::kInvalidArgument, true) << "GPGMM_ENABLE_DEVICE_LEAK_CHECKS has no effect because the D3D12 debug " "layer was either not installed or enabled. Please call " "ID3D12Debug::EnableDebugLayer before using this flag."; @@ -1046,7 +1046,7 @@ namespace gpgmm::d3d12 { // Check memory requirements. D3D12_HEAP_FLAGS heapFlags = GetHeapFlags(resourceHeapType, IsCreateHeapNotResident()); if (!HasAllFlags(heapFlags, allocationDescriptor.ExtraRequiredHeapFlags)) { - WarningLog(this, MessageId::kPerformanceWarning) + WarnLog(this, MessageId::kPerformanceWarning) << "ALLOCATOR_FLAG_ALWAYS_COMMITTED was not requested but enabled anyway because " "the required heap flags were incompatible with resource heap type (" << std::to_string(allocationDescriptor.ExtraRequiredHeapFlags) << " vs " @@ -1091,7 +1091,7 @@ namespace gpgmm::d3d12 { if (GPGMM_UNLIKELY(requiresPadding)) { request.SizeInBytes += allocationDescriptor.RequireResourceHeapPadding; if (!neverSubAllocate) { - WarningLog(this, MessageId::kInvalidArgument) + WarnLog(this, MessageId::kInvalidArgument) << "Sub-allocation was enabled but has no effect when padding is requested: " << allocationDescriptor.RequireResourceHeapPadding << " bytes."; neverSubAllocate = true; @@ -1621,7 +1621,7 @@ namespace gpgmm::d3d12 { switch (message->ID) { case D3D12_MESSAGE_ID_LIVE_HEAP: case D3D12_MESSAGE_ID_LIVE_RESOURCE: { - WarningLog(this, MessageId::kPerformanceWarning) + WarnLog(this, MessageId::kPerformanceWarning) << "Device leak detected: " + std::string(message->pDescription); } break; default: @@ -1672,7 +1672,7 @@ namespace gpgmm::d3d12 { return S_OK; } default: { - WarningLog(this, MessageId::kBadOperation) + WarnLog(this, MessageId::kBadOperation) << "CheckFeatureSupport does not support feature (" + std::to_string(feature) + ")."; return E_INVALIDARG; diff --git a/src/gpgmm/utils/Log.cpp b/src/gpgmm/utils/Log.cpp index 0939f8cb1..836b9ed28 100644 --- a/src/gpgmm/utils/Log.cpp +++ b/src/gpgmm/utils/Log.cpp @@ -195,10 +195,10 @@ namespace gpgmm { return {MessageSeverity::kInfo, messageId, isExternal, name, object}; } - LogMessage WarningLog(MessageId messageId, - bool isExternal, - const std::string& name, - const ObjectBase* object) { + LogMessage WarnLog(MessageId messageId, + bool isExternal, + const std::string& name, + const ObjectBase* object) { return {MessageSeverity::kWarning, messageId, isExternal, name, object}; } @@ -226,7 +226,7 @@ namespace gpgmm { case MessageSeverity::kInfo: return InfoLog(messageId, isExternal, name, object); case MessageSeverity::kWarning: - return WarningLog(messageId, isExternal, name, object); + return WarnLog(messageId, isExternal, name, object); case MessageSeverity::kError: return ErrorLog(messageId, isExternal, name, object); default: diff --git a/src/gpgmm/utils/Log.h b/src/gpgmm/utils/Log.h index 5a6580e31..db3034332 100644 --- a/src/gpgmm/utils/Log.h +++ b/src/gpgmm/utils/Log.h @@ -95,10 +95,10 @@ namespace gpgmm { bool isExternal = false, const std::string& name = "", const ObjectBase* mObject = nullptr); - LogMessage WarningLog(MessageId messageId = MessageId::kUnknown, - bool isExternal = false, - const std::string& name = "", - const ObjectBase* mObject = nullptr); + LogMessage WarnLog(MessageId messageId = MessageId::kUnknown, + bool isExternal = false, + const std::string& name = "", + const ObjectBase* mObject = nullptr); LogMessage ErrorLog(MessageId messageId = MessageId::kUnknown, bool isExternal = false, const std::string& name = "", diff --git a/src/tests/capture_replay_tests/D3D12MemoryTraceReplay.cpp b/src/tests/capture_replay_tests/D3D12MemoryTraceReplay.cpp index 3074e0bdd..e30a4c93b 100644 --- a/src/tests/capture_replay_tests/D3D12MemoryTraceReplay.cpp +++ b/src/tests/capture_replay_tests/D3D12MemoryTraceReplay.cpp @@ -387,7 +387,7 @@ class D3D12MemoryTraceReplay : public D3D12TestBase, public CaptureReplayTestWit if (GetLogLevel() <= gpgmm::MessageSeverity::kWarning && mCaps->IsAdapterUMA() != snapshot["IsUMA"].asBool() && iterationIndex == 0) { - gpgmm::WarningLog() + gpgmm::WarnLog() << "Capture device does not match playback device (IsUMA: " + std::to_string(snapshot["IsUMA"].asBool()) + " vs " + std::to_string(mCaps->IsAdapterUMA()) + ")."; @@ -446,7 +446,7 @@ class D3D12MemoryTraceReplay : public D3D12TestBase, public CaptureReplayTestWit mCaps->GetMaxResourceHeapTierSupported() < snapshot["ResourceHeapTier"].asInt() && iterationIndex == 0) { - gpgmm::WarningLog() + gpgmm::WarnLog() << "Captured device exceeds capabilities of playback device " "(ResourceHeapTier: " + std::to_string(snapshot["ResourceHeapTier"].asInt()) +