diff --git a/src/ComputeSharp.Graphics/Extensions/ID3D12DeviceExtensions.cs b/src/ComputeSharp.Graphics/Extensions/ID3D12DeviceExtensions.cs
index a29a900b..f7f1bd7e 100644
--- a/src/ComputeSharp.Graphics/Extensions/ID3D12DeviceExtensions.cs
+++ b/src/ComputeSharp.Graphics/Extensions/ID3D12DeviceExtensions.cs
@@ -12,6 +12,7 @@ using static TerraFX.Interop.D3D12_DESCRIPTOR_HEAP_TYPE;
using static TerraFX.Interop.D3D12_FEATURE;
using static TerraFX.Interop.D3D12_FENCE_FLAGS;
using static TerraFX.Interop.D3D12_MEMORY_POOL;
+using static TerraFX.Interop.D3D12_MESSAGE_ID;
using static TerraFX.Interop.D3D12_HEAP_TYPE;
using static TerraFX.Interop.D3D12_RESOURCE_FLAGS;
using static TerraFX.Interop.D3D12_RESOURCE_STATES;
@@ -27,6 +28,34 @@ namespace ComputeSharp.Graphics.Extensions
///
internal static unsafe class ID3D12DeviceExtensions
{
+ ///
+ /// Creates a new for a given device.
+ ///
+ /// The target to use to create the info queue.
+ /// A pointer to the newly created instance.
+ /// Thrown when the creation of the info queue fails.
+ public static ComPtr CreateInfoQueue(this ref ID3D12Device d3D12Device)
+ {
+ ComPtr d3D12InfoQueue = default;
+
+ d3D12Device.QueryInterface(FX.__uuidof(), d3D12InfoQueue.GetVoidAddressOf()).Assert();
+
+ D3D12_MESSAGE_ID* d3D12MessageIds = stackalloc D3D12_MESSAGE_ID[3]
+ {
+ D3D12_MESSAGE_ID_CREATEDEVICE_DEBUG_LAYER_STARTUP_OPTIONS,
+ D3D12_MESSAGE_ID_MAP_INVALID_NULLRANGE,
+ D3D12_MESSAGE_ID_UNMAP_INVALID_NULLRANGE
+ };
+
+ D3D12_INFO_QUEUE_FILTER d3D12InfoQueueFilter = default;
+ d3D12InfoQueueFilter.DenyList.NumIDs = 3;
+ d3D12InfoQueueFilter.DenyList.pIDList = d3D12MessageIds;
+
+ d3D12InfoQueue.Get()->PushRetrievalFilter(&d3D12InfoQueueFilter).Assert();
+
+ return d3D12InfoQueue.Move();
+ }
+
///
/// Creates a new of the specified type, for a given device.
///
diff --git a/src/ComputeSharp.Graphics/Helpers/DeviceHelper.Factory.cs b/src/ComputeSharp.Graphics/Helpers/DeviceHelper.Factory.cs
index f756e281..e2665b77 100644
--- a/src/ComputeSharp.Graphics/Helpers/DeviceHelper.Factory.cs
+++ b/src/ComputeSharp.Graphics/Helpers/DeviceHelper.Factory.cs
@@ -1,9 +1,8 @@
using System.Collections.Generic;
-using TerraFX.Interop;
#if DEBUG
-using ComputeSharp.Core.Extensions;
-using FX = TerraFX.Interop.Windows;
+using ComputeSharp.Graphics.Extensions;
#endif
+using TerraFX.Interop;
namespace ComputeSharp.Graphics.Helpers
{
@@ -41,11 +40,7 @@ namespace ComputeSharp.Graphics.Helpers
DevicesCache.Add(luid, device);
#if DEBUG
- ComPtr d3D12InfoQueue = default;
-
- int res = d3D12Device.Get()->QueryInterface(FX.__uuidof(), d3D12InfoQueue.GetVoidAddressOf());
-
- D3D12InfoQueueMap.Add(luid, d3D12InfoQueue);
+ D3D12InfoQueueMap.Add(luid, d3D12Device.Get()->CreateInfoQueue());
#endif
}
diff --git a/src/ComputeSharp.Graphics/Helpers/DeviceHelper.ID3D12InfoQueue.cs b/src/ComputeSharp.Graphics/Helpers/DeviceHelper.ID3D12InfoQueue.cs
index 8b82767e..c4d5e284 100644
--- a/src/ComputeSharp.Graphics/Helpers/DeviceHelper.ID3D12InfoQueue.cs
+++ b/src/ComputeSharp.Graphics/Helpers/DeviceHelper.ID3D12InfoQueue.cs
@@ -26,7 +26,7 @@ namespace ComputeSharp.Graphics.Helpers
var device = DevicesCache[pair.Key];
var queue = pair.Value;
- ulong messages = queue.Get()->GetNumStoredMessages();
+ ulong messages = queue.Get()->GetNumStoredMessagesAllowedByRetrievalFilter();
if (messages > 0)
{