From e37c26eeff9ff6584f82403dc2a0c71214498b0a Mon Sep 17 00:00:00 2001 From: Bryan Bernhart Date: Thu, 13 Oct 2022 19:15:36 -0700 Subject: [PATCH] Move min. recod level into descs. --- include/gpgmm_d3d12.h | 24 ++++++++++++------- src/gpgmm/d3d12/JSONSerializerD3D12.cpp | 5 +++- src/gpgmm/d3d12/ResidencyManagerD3D12.cpp | 2 +- src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp | 2 +- src/tests/D3D12Test.cpp | 4 ++-- .../D3D12EventTraceReplay.cpp | 2 +- 6 files changed, 25 insertions(+), 14 deletions(-) diff --git a/include/gpgmm_d3d12.h b/include/gpgmm_d3d12.h index 9f3f321ae..262a2c8f2 100644 --- a/include/gpgmm_d3d12.h +++ b/include/gpgmm_d3d12.h @@ -318,14 +318,6 @@ namespace gpgmm::d3d12 { */ EVENT_RECORD_FLAGS Flags; - /** \brief Minimum severity level to record messages. - - Messages with lower severity will be ignored. - - Optional parameter. By default, the minimum severity level is WARN. - */ - D3D12_MESSAGE_SEVERITY MinMessageLevel; - /** \brief Specifies the scope of the events. Optional parameter. By default, recording is per process. @@ -398,6 +390,14 @@ namespace gpgmm::d3d12 { */ RESIDENCY_FLAGS Flags; + /** \brief Minimum severity level to record messages. + + Messages with lower severity will be ignored. + + Optional parameter. By default, the minimum severity level is WARN. + */ + D3D12_MESSAGE_SEVERITY MinRecordLevel; + /** \brief Minimum severity level to log messages to console. Messages with lower severity will be ignored. @@ -850,6 +850,14 @@ namespace gpgmm::d3d12 { */ ALLOCATOR_FLAGS Flags; + /** \brief Minimum severity level to record messages. + + Messages with lower severity will be ignored. + + Optional parameter. By default, the minimum severity level is WARN. + */ + D3D12_MESSAGE_SEVERITY MinRecordLevel; + /** \brief Minimum severity level to log messages to console. Messages with lower severity will be ignored. diff --git a/src/gpgmm/d3d12/JSONSerializerD3D12.cpp b/src/gpgmm/d3d12/JSONSerializerD3D12.cpp index 455cd1589..6e9bdce71 100644 --- a/src/gpgmm/d3d12/JSONSerializerD3D12.cpp +++ b/src/gpgmm/d3d12/JSONSerializerD3D12.cpp @@ -38,6 +38,8 @@ namespace gpgmm::d3d12 { // static JSONDict JSONSerializer::Serialize(const ALLOCATOR_DESC& desc) { JSONDict dict; + dict.AddItem("MinLogLevel", desc.MinLogLevel); + dict.AddItem("MinRecordLevel", desc.MinRecordLevel); dict.AddItem("Flags", desc.Flags); dict.AddItem("RecordOptions", Serialize(desc.RecordOptions)); dict.AddItem("ResourceHeapTier", desc.ResourceHeapTier); @@ -88,7 +90,6 @@ namespace gpgmm::d3d12 { JSONDict JSONSerializer::Serialize(const EVENT_RECORD_OPTIONS& desc) { JSONDict dict; dict.AddItem("Flags", desc.Flags); - dict.AddItem("MinMessageLevel", desc.MinMessageLevel); return dict; } @@ -256,6 +257,8 @@ namespace gpgmm::d3d12 { // static JSONDict JSONSerializer::Serialize(const RESIDENCY_DESC& desc) { JSONDict dict; + dict.AddItem("MinLogLevel", desc.MinLogLevel); + dict.AddItem("MinRecordLevel", desc.MinRecordLevel); dict.AddItem("IsUMA", desc.IsUMA); dict.AddItem("Flags", desc.Flags); dict.AddItem("RecordOptions", Serialize(desc.RecordOptions)); diff --git a/src/gpgmm/d3d12/ResidencyManagerD3D12.cpp b/src/gpgmm/d3d12/ResidencyManagerD3D12.cpp index f4ddde436..727bdc952 100644 --- a/src/gpgmm/d3d12/ResidencyManagerD3D12.cpp +++ b/src/gpgmm/d3d12/ResidencyManagerD3D12.cpp @@ -197,7 +197,7 @@ namespace gpgmm::d3d12 { StartupEventTrace(descriptor.RecordOptions.TraceFile, static_cast(~descriptor.RecordOptions.Flags)); - SetEventMessageLevel(GetLogSeverity(descriptor.RecordOptions.MinMessageLevel)); + SetEventMessageLevel(GetLogSeverity(descriptor.MinRecordLevel)); } SetLogMessageLevel(GetLogSeverity(descriptor.MinLogLevel)); diff --git a/src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp b/src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp index 6d7b056d5..476399862 100644 --- a/src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp +++ b/src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp @@ -513,7 +513,7 @@ namespace gpgmm::d3d12 { StartupEventTrace(allocatorDescriptor.RecordOptions.TraceFile, static_cast(~newDescriptor.RecordOptions.Flags)); - SetEventMessageLevel(GetLogSeverity(newDescriptor.RecordOptions.MinMessageLevel)); + SetEventMessageLevel(GetLogSeverity(newDescriptor.MinRecordLevel)); } else { // Do not override the event scope from a event trace already enabled. newDescriptor.RecordOptions.EventScope = EVENT_RECORD_SCOPE_PER_PROCESS; diff --git a/src/tests/D3D12Test.cpp b/src/tests/D3D12Test.cpp index 61ef0c446..ee90c3591 100644 --- a/src/tests/D3D12Test.cpp +++ b/src/tests/D3D12Test.cpp @@ -108,7 +108,7 @@ namespace gpgmm::d3d12 { if (IsDumpEventsEnabled()) { desc.RecordOptions.Flags |= EVENT_RECORD_FLAG_ALL_EVENTS; - desc.RecordOptions.MinMessageLevel = desc.MinLogLevel; + desc.MinRecordLevel = desc.MinLogLevel; desc.RecordOptions.UseDetailedTimingEvents = true; // Format the output trace file as .. @@ -135,7 +135,7 @@ namespace gpgmm::d3d12 { if (IsDumpEventsEnabled()) { desc.RecordOptions.Flags |= EVENT_RECORD_FLAG_ALL_EVENTS; - desc.RecordOptions.MinMessageLevel = desc.MinLogLevel; + desc.MinRecordLevel = desc.MinLogLevel; desc.RecordOptions.UseDetailedTimingEvents = true; } diff --git a/src/tests/capture_replay_tests/D3D12EventTraceReplay.cpp b/src/tests/capture_replay_tests/D3D12EventTraceReplay.cpp index 25092b0a9..8b1b45d6c 100644 --- a/src/tests/capture_replay_tests/D3D12EventTraceReplay.cpp +++ b/src/tests/capture_replay_tests/D3D12EventTraceReplay.cpp @@ -190,7 +190,7 @@ class D3D12EventTraceReplay : public D3D12TestBase, public CaptureReplayTestWith baseAllocatorDesc.RecordOptions.Flags |= static_cast(envParams.CaptureEventMask); baseAllocatorDesc.RecordOptions.TraceFile = traceFile.path.c_str(); - baseAllocatorDesc.RecordOptions.MinMessageLevel = baseAllocatorDesc.MinLogLevel; + baseAllocatorDesc.MinRecordLevel = baseAllocatorDesc.MinLogLevel; // Keep recording across multiple playback iterations to ensure all // events will be captured instead of overwritten per iteration.