【问题标题】:DirectX: Get InfoQueue before DeviceDirectX:在设备之前获取 InfoQueue
【发布时间】:2020-07-25 16:41:45
【问题描述】:

有没有办法在设备创建之前获取InfoQueue或者设置break参数?

现在我正在创建设备,然后获取 InfoQueue,但在此之前发出的任何消息都将被忽略并隐藏在输出窗口中。

ID3D11Device* pDevice;
//...Create Device...
ID3D11InfoQueue* pInfoQueue;
pDevice->QueryInterface(__uuidof(ID3D11InfoQueue), &pInfoQueue);
pInfoQueue->SetBreakOnSeverity(D3D11_MESSAGE_SEVERITY_ERROR, TRUE);

我想要类似的东西:

ID3D11InfoQueue* pInfoQueue;
//...Get InfoQueue...
pInfoQueue->SetBreakOnSeverity(D3D11_MESSAGE_SEVERITY_ERROR, TRUE);
ID3D11Device* pDevice;
//...Create Device...

【问题讨论】:

    标签: c++ directx directx-11 dxgi


    【解决方案1】:

    鉴于 ID3D11InfoQueue 的文档说您通过设备上的 QueryInterface 调用获得接口指针,我会说答案是“不”。

    【讨论】:

      【解决方案2】:

      您要做的是启用 DXGI 调试,这将为设备和交换链创建提供调试信息。

      #include <dxgidebug.h>
      
      
      #if defined(_DEBUG)
          Microsoft::WRL::ComPtr<IDXGIInfoQueue> dxgiInfoQueue;
      
          typedef HRESULT (WINAPI * LPDXGIGETDEBUGINTERFACE)(REFIID, void ** );
      
          HMODULE dxgidebug = LoadLibraryEx( L"dxgidebug.dll", nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32 );
          if ( dxgidebug )
          {
              auto dxgiGetDebugInterface = reinterpret_cast<LPDXGIGETDEBUGINTERFACE>(
                  reinterpret_cast<void*>( GetProcAddress( dxgidebug, "DXGIGetDebugInterface" ) ) );
      
              if ( SUCCEEDED( dxgiGetDebugInterface( IID_PPV_ARGS( dxgiInfoQueue.GetAddressOf() ) ) ) )
              {
                  dxgiInfoQueue->SetBreakOnSeverity( DXGI_DEBUG_ALL, DXGI_INFO_QUEUE_MESSAGE_SEVERITY_ERROR, true );
                  dxgiInfoQueue->SetBreakOnSeverity( DXGI_DEBUG_ALL, DXGI_INFO_QUEUE_MESSAGE_SEVERITY_CORRUPTION, true );
              }
          }
      #endif
      

      this blog postthis one

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2011-12-08
        • 2015-09-05
        • 1970-01-01
        • 2015-04-30
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多