1

我正在尝试遍历系统上可用的 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。感谢您的帮助!

4

1 回答 1

2

尝试

auto& myAdapter = *adapter;
auto adapterDescription = DXGI_ADAPTER_DESC1();
myAdapter.GetDesc1(&adapterDescription);
于 2012-12-10T02:04:13.253 回答