Reputation: 4295
I am trying to iterate through the available GPUs on my system and print a description of each out onto the console. I have the code for retrieving them but I can't figure out how to get the description.
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
});
I am getting a compile time error pointing to the auto myAdapter = *adapter;
line though which says error C2259: 'IDXGIAdapter1' : cannot instantiate abstract class
I am using DirectX 11, Windows 64bit, and Visual Studio 2012. Thank you for your help!
Upvotes: 1
Views: 2397
Reputation: 324
try
auto& myAdapter = *adapter;
auto adapterDescription = DXGI_ADAPTER_DESC1();
myAdapter.GetDesc1(&adapterDescription);
Upvotes: 2