Created
January 22, 2019 01:44
-
-
Save misyltoad/39da9a52e1a1f807750afbdcf284fc37 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 <windows.h> | |
#include <d3d11_1.h> | |
#include <dxgi.h> | |
#include <stdio.h> | |
#pragma comment(lib, "d3d11.lib") | |
#pragma comment(lib, "dxgi.lib") | |
int main(int argc, char** argv) { | |
IDXGIFactory* factory; | |
HRESULT result = CreateDXGIFactory(__uuidof(IDXGIFactory), (void**)&factory); | |
if (FAILED(result)) printf("CreateFactory failed."); // SUCCESS | |
IDXGIAdapter* adapter; | |
result = factory->EnumAdapters(0, &adapter); | |
if (FAILED(result)) printf("EnumAdapters failed."); // SUCCESS | |
IDXGIAdapter1* adapter1; | |
result = adapter->QueryInterface(__uuidof(IDXGIAdapter1), (void**)&adapter1); | |
if (FAILED(result)) printf("QueryInterface IDXGIAdapter1 failed."); // SUCCESS | |
IDXGIFactory1* factory1; | |
result = adapter1->GetParent(__uuidof(IDXGIFactory1), (void**)&factory); | |
if (FAILED(result)) printf("IDXGIAdapter1 parent of IDXGIFactory1 failed."); // FAIL | |
result = factory->QueryInterface(__uuidof(IDXGIFactory1), (void**)&factory); | |
if (FAILED(result)) printf("QueryInterface IDXGIFactory1 failed."); // FAIL | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment