| 4 | std::unique_ptr<DxgiWrapper> gDxgiWrapper; |
| 5 | |
| 6 | DxgiWrapper::DxgiWrapper() |
| 7 | { |
| 8 | TCHAR dxgiPath[1024 + 64]; |
| 9 | DWORD dxgiPathSize = GetSystemDirectory(dxgiPath, 1024); |
| 10 | if (dxgiPathSize == 0) |
| 11 | { |
| 12 | Fail("Could not get system directory path"); |
| 13 | } |
| 14 | |
| 15 | wcscpy_s(dxgiPath + dxgiPathSize, 1024 + 64 - dxgiPathSize, L"\\dxgi.dll"); |
| 16 | |
| 17 | dxgiHandle = LoadLibrary(dxgiPath); |
| 18 | if (dxgiHandle == NULL) |
| 19 | { |
| 20 | Fail("Could not load dxgi.dll"); |
| 21 | } |
| 22 | |
| 23 | createDXGIFactory = (CreateDXGIFactoryProc)GetProcAddress(dxgiHandle, "CreateDXGIFactory"); |
| 24 | createDXGIFactory1 = (CreateDXGIFactoryProc)GetProcAddress(dxgiHandle, "CreateDXGIFactory1"); |
| 25 | createDXGIFactory2 = (CreateDXGIFactory2Proc)GetProcAddress(dxgiHandle, "CreateDXGIFactory2"); |
| 26 | |
| 27 | if (createDXGIFactory == NULL) |
| 28 | { |
| 29 | Fail("Could not locate CreateDXGIFactory in dxgi.dll"); |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | DxgiWrapper::~DxgiWrapper() |
| 34 | { |