public static void Initialize(ComPtr <ID3D12InfoQueue> infoQueue)
        {
            if (!IsEnabled)
            {
                return;
            }

            Debug.Assert(infoQueue.Exists);
            _infoQueue = infoQueue;

            // we deny retrieving anything that isn't an error/warning/corruption
            var deniedSeverities = stackalloc D3D12_MESSAGE_SEVERITY[2]
            {
                D3D12_MESSAGE_SEVERITY.D3D12_MESSAGE_SEVERITY_INFO,
                D3D12_MESSAGE_SEVERITY.D3D12_MESSAGE_SEVERITY_MESSAGE
            };

            var filter = new D3D12_INFO_QUEUE_FILTER
            {
                DenyList = new D3D12_INFO_QUEUE_FILTER_DESC {
                    NumSeverities = 2, pSeverityList = deniedSeverities
                }
            };

            infoQueue.Get()->AddRetrievalFilterEntries(&filter);

            // this causes an SEH exception to be thrown every time a DX error or corruption occurs
#if THROW_ON_D3D12_ERROR
            infoQueue.Get()->SetBreakOnSeverity(D3D12_MESSAGE_SEVERITY.D3D12_MESSAGE_SEVERITY_ERROR, Windows.TRUE);
            infoQueue.Get()->SetBreakOnSeverity(D3D12_MESSAGE_SEVERITY.D3D12_MESSAGE_SEVERITY_CORRUPTION, Windows.TRUE);
#endif
#if THROW_ON_WARNING
            infoQueue.Get()->SetBreakOnSeverity(D3D12_MESSAGE_SEVERITY.D3D12_MESSAGE_SEVERITY_WARNING, Windows.TRUE);
#endif
        }
        /// <summary>
        /// Creates a new <see cref="ID3D12InfoQueue"/> for a given device.
        /// </summary>
        /// <param name="d3D12Device">The target <see cref="ID3D12Device"/> to use to create the info queue.</param>
        /// <returns>A pointer to the newly created <see cref="ID3D12InfoQueue"/> instance.</returns>
        /// <exception cref="Exception">Thrown when the creation of the info queue fails.</exception>
        public static ComPtr <ID3D12InfoQueue> CreateInfoQueue(this ref ID3D12Device d3D12Device)
        {
            ComPtr <ID3D12InfoQueue> d3D12InfoQueue = default;

            d3D12Device.QueryInterface(FX.__uuidof <ID3D12InfoQueue>(), 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());
        }