DirectX11 ReportLiveObjects实例化

Que*_*ing 3 c++ debugging directx layer directx-11

ReportLiveObjects的MSDN页面

我不确定如何调用ReportLiveObjects方法,因为我试图声明的类是抽象的,或者在IDXGIDebug"unclared"的情况下(我想我错过了一个头文件?).

这是片段.

    ID3D11Debug *debugDev = new ID3D11Debug();
    debugDev->ReportLiveDeviceObjects( D3D11_RLDO_DETAIL );
Run Code Online (Sandbox Code Playgroud)

上面的代码告诉我类是抽象的,所以我不能创建一个对象.

IDXGIDebug debugDev = new IDXGIDebug();
Run Code Online (Sandbox Code Playgroud)

上面的代码告诉我IDXGIDebug是未声明的.

头文件"DXGI"已包含在内.调试层已打开.

任何帮助,将不胜感激.

acr*_*ige 8

当然你不能ID3D11Debug直接创建界面.

第一步是创建ID3D11Device带有D3D11_CREATE_DEVICE_DEBUG标志的标志,如下所示:

creationFlags = 0;

#ifdef _DEBUG
        creationFlags |= D3D11_CREATE_DEVICE_DEBUG;
#endif

D3D11CreateDevice(...);
Run Code Online (Sandbox Code Playgroud)

然后你必须ID3D11Debug从你的设备查询界面,如下所示:

m_d3dDevice->QueryInterface(__uuidof(ID3D11Debug), reinterpret_cast<void**>(&m_d3dDebug));
Run Code Online (Sandbox Code Playgroud)

关于D3D调试层的两个有用链接:

http://msdn.microsoft.com/en-US/library/windows/desktop/jj200584(v=vs.85).aspx http://blogs.msdn.com/b/chuckw/archive/2012/11/ 30/Direct3D的SDK-调试层tricks.aspx