diff --git a/src/ComputeSharp/Graphics/Extensions/Interop/ID3D12DeviceExtensions.cs b/src/ComputeSharp/Graphics/Extensions/Interop/ID3D12DeviceExtensions.cs index 5d05c6db..be507ae1 100644 --- a/src/ComputeSharp/Graphics/Extensions/Interop/ID3D12DeviceExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/Interop/ID3D12DeviceExtensions.cs @@ -256,15 +256,17 @@ internal static unsafe class ID3D12DeviceExtensions d3D12Device.QueryInterface(Windows.__uuidof(), d3D12InfoQueue.GetVoidAddressOf()).Assert(); - D3D12_MESSAGE_ID* d3D12MessageIds = stackalloc D3D12_MESSAGE_ID[3] + D3D12_MESSAGE_ID* d3D12MessageIds = stackalloc D3D12_MESSAGE_ID[2] { - D3D12_MESSAGE_ID_CREATEDEVICE_DEBUG_LAYER_STARTUP_OPTIONS, + // The map/unmap warnings when using null ranges are being suppressed due to + // them only being generated due to a bug in the DirectX runtime. using null + // ranges when calling Map()/Unmap() is allowed and perfeclty well defined. D3D12_MESSAGE_ID_MAP_INVALID_NULLRANGE, D3D12_MESSAGE_ID_UNMAP_INVALID_NULLRANGE }; D3D12_INFO_QUEUE_FILTER d3D12InfoQueueFilter = default; - d3D12InfoQueueFilter.DenyList.NumIDs = 3; + d3D12InfoQueueFilter.DenyList.NumIDs = 2; d3D12InfoQueueFilter.DenyList.pIDList = d3D12MessageIds; d3D12InfoQueue.Get()->PushRetrievalFilter(&d3D12InfoQueueFilter).Assert(); diff --git a/src/ComputeSharp/Graphics/Helpers/DeviceHelper.ID3D12InfoQueue.cs b/src/ComputeSharp/Graphics/Helpers/DeviceHelper.ID3D12InfoQueue.cs index 498f6e31..2ceec2b1 100644 --- a/src/ComputeSharp/Graphics/Helpers/DeviceHelper.ID3D12InfoQueue.cs +++ b/src/ComputeSharp/Graphics/Helpers/DeviceHelper.ID3D12InfoQueue.cs @@ -65,16 +65,7 @@ internal static partial class DeviceHelper hasErrorsOrWarnings = true; } - string text = builder.ToString(); - - if (Debugger.IsAttached) - { - Debug.WriteLine(text); - } - else - { - Trace.WriteLine(text); - } + Trace.WriteLine(builder); } queue->ClearStoredMessages(); @@ -94,21 +85,12 @@ internal static partial class DeviceHelper }; builder.Clear(); - builder.AppendLine($"[D3D12 device remove \"{device}\" (HW: {device.IsHardwareAccelerated}, UMA: {device.IsCacheCoherentUMA})]"); + builder.AppendLine($"[D3D12 device \"{device}\" removed (HW: {device.IsHardwareAccelerated}, UMA: {device.IsCacheCoherentUMA})]"); builder.AppendLine($"[Reason]: {message}"); hasErrorsOrWarnings = true; - string text = builder.ToString(); - - if (Debugger.IsAttached) - { - Debug.WriteLine(text); - } - else - { - Trace.WriteLine(text); - } + Trace.WriteLine(builder); } } } diff --git a/src/ComputeSharp/Properties/Configuration.cs b/src/ComputeSharp/Properties/Configuration.cs index 5af7e41f..ab805bcb 100644 --- a/src/ComputeSharp/Properties/Configuration.cs +++ b/src/ComputeSharp/Properties/Configuration.cs @@ -1,4 +1,7 @@ using System; +#if DEBUG +using System.Diagnostics; +#endif /// /// A container for all shared configuration switches for ComputeSharp. @@ -22,6 +25,13 @@ internal static class Configuration /// The value of the specified configuration setting. private static bool GetConfigurationValue(string propertyName) { +#if DEBUG + if (Debugger.IsAttached) + { + return true; + } +#endif + if (AppContext.TryGetSwitch(propertyName, out bool isEnabled)) { return isEnabled;