DirectX 11获取图形卡的说明

时间:2012-12-10 00:29:55

标签: c++ c++11 directx directx-11

我正在尝试遍历系统上的可用GPU,并将每个GPU的描述打印到控制台上。我有用于检索它们的代码,但我无法弄清楚如何获取描述。

std::vector <IDXGIAdapter1*> availableAdapters = EnumerateAdapters();

for_each(availableAdapters.begin(), availableAdapters.end(), [](IDXGIAdapter1* adapter) {
    auto myAdapter = *adapter;
    auto adapterDescription = new DXGI_ADAPTER_DESC1();
    myAdapter.GetDesc1(adapterDescription);
    // Print description to console here
});

我收到指向auto myAdapter = *adapter;行的编译时错误,但是error C2259: 'IDXGIAdapter1' : cannot instantiate abstract class

我正在使用DirectX 11,Windows 64位和Visual Studio 2012.感谢您的帮助!

1 个答案:

答案 0 :(得分:2)

auto& myAdapter = *adapter;
auto adapterDescription = DXGI_ADAPTER_DESC1();
myAdapter.GetDesc1(&adapterDescription);