Created
December 17, 2021 01:24
-
-
Save fujii/72df773fe7fa11fd7459755f184cee6a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <windows.h> | |
#include <vector> | |
#include <dxgi1_2.h> | |
#pragma comment(lib, "DXGI.lib") | |
int main() | |
{ | |
std::cout << "EnumAdapters\n"; | |
IDXGIAdapter * pAdapter; | |
std::vector <IDXGIAdapter2*> vAdapters; | |
IDXGIFactory* pFactory = NULL; | |
if (FAILED(CreateDXGIFactory(__uuidof(IDXGIFactory) ,(void**)&pFactory))) { | |
std::cout << "CreateDXGIFactory failed\n"; | |
return 1; | |
} | |
for (int i = 0; pFactory->EnumAdapters(i, &pAdapter) != DXGI_ERROR_NOT_FOUND; ++i) { | |
IDXGIAdapter2* adapter2; | |
if (SUCCEEDED(pAdapter->QueryInterface( __uuidof(IDXGIAdapter2), ( LPVOID* )&adapter2))) { | |
DXGI_ADAPTER_DESC2 desc; | |
if (SUCCEEDED(adapter2->GetDesc2(&desc))) | |
std::cout << "VendorId: " << std::hex << desc.VendorId << std::endl; | |
} | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment